Surface/lib/types/auth.dart
2024-11-09 18:28:45 +08:00

58 lines
1.5 KiB
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
part 'auth.freezed.dart';
part 'auth.g.dart';
@freezed
class SnAuthResult with _$SnAuthResult {
const factory SnAuthResult({
required bool isFinished,
required SnAuthTicket? ticket,
}) = _SnAuthResult;
factory SnAuthResult.fromJson(Map<String, Object?> json) =>
_$SnAuthResultFromJson(json);
}
@freezed
class SnAuthTicket with _$SnAuthTicket {
const factory SnAuthTicket({
required int id,
required DateTime createdAt,
required DateTime updatedAt,
required DateTime? deletedAt,
required int stepRemain,
required String? grantToken,
required String? accessToken,
required String? refreshToken,
required String ipAddress,
required String location,
required String userAgent,
required DateTime? expiredAt,
required DateTime? lastGrantAt,
required DateTime? availableAt,
required String? nonce,
required int? accountId,
@Default([]) List<int> factorTrail,
}) = _SnAuthTicket;
factory SnAuthTicket.fromJson(Map<String, Object?> json) =>
_$SnAuthTicketFromJson(json);
}
@freezed
class SnAuthFactor with _$SnAuthFactor {
const factory SnAuthFactor({
required int id,
required DateTime createdAt,
required DateTime updatedAt,
required DateTime? deletedAt,
required int type,
required Map<String, dynamic>? config,
required int? accountId,
}) = _SnAuthFactor;
factory SnAuthFactor.fromJson(Map<String, Object?> json) =>
_$SnAuthFactorFromJson(json);
}