mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-16 05:33:17 +00:00
45 lines
1.1 KiB
Dart
45 lines
1.1 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart';
|
|
|
|
part 'recovery_token_status.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class RecoveryKeyStatus extends Equatable {
|
|
factory RecoveryKeyStatus.fromJson(final Map<String, dynamic> json) =>
|
|
_$RecoveryKeyStatusFromJson(json);
|
|
const RecoveryKeyStatus({
|
|
required this.exists,
|
|
required this.valid,
|
|
this.date,
|
|
this.expiration,
|
|
this.usesLeft,
|
|
});
|
|
|
|
RecoveryKeyStatus.fromGraphQL(
|
|
final Query$RecoveryKey$api$recoveryKey recoveryKey,
|
|
) : this(
|
|
exists: recoveryKey.exists,
|
|
date: recoveryKey.creationDate,
|
|
expiration: recoveryKey.expirationDate,
|
|
usesLeft: recoveryKey.usesLeft,
|
|
valid: recoveryKey.valid,
|
|
);
|
|
|
|
final bool exists;
|
|
final DateTime? date;
|
|
final DateTime? expiration;
|
|
@JsonKey(name: 'uses_left')
|
|
final int? usesLeft;
|
|
final bool valid;
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
exists,
|
|
date,
|
|
expiration,
|
|
usesLeft,
|
|
valid,
|
|
];
|
|
}
|