Skip to content

Commit

Permalink
[Domain] Added a model to backup game codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Feb 5, 2023
1 parent 5b4991f commit 99d21c0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/domain/enums/app_backup_data_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ enum AppBackupDataType {
calculatorAscMaterials,
tierList,
customBuilds,
gameCodes,
notifications,
}
29 changes: 29 additions & 0 deletions lib/domain/models/backup/backup_game_code_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'backup_game_code_model.freezed.dart';
part 'backup_game_code_model.g.dart';

@freezed
class BackupGameCodeModel with _$BackupGameCodeModel {
const factory BackupGameCodeModel({
required String code,
DateTime? usedOn,
DateTime? discoveredOn,
DateTime? expiredOn,
required bool isExpired,
int? region,
@Default(<BackupGameCodeRewardModel>[]) List<BackupGameCodeRewardModel> rewards,
}) = _BackupGameCodeModel;

factory BackupGameCodeModel.fromJson(Map<String, dynamic> json) => _$BackupGameCodeModelFromJson(json);
}

@freezed
class BackupGameCodeRewardModel with _$BackupGameCodeRewardModel {
const factory BackupGameCodeRewardModel({
required String itemKey,
required int quantity,
}) = _BackupGameCodeRewardModel;

factory BackupGameCodeRewardModel.fromJson(Map<String, dynamic> json) => _$BackupGameCodeRewardModelFromJson(json);
}
1 change: 1 addition & 0 deletions lib/domain/models/backup/backup_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class BackupModel with _$BackupModel {
List<BackupCalculatorAscMaterialsSessionModel>? calculatorAscMaterials,
List<BackupCustomBuildModel>? customBuilds,
List<BackupTierListModel>? tierList,
List<BackupGameCodeModel>? gameCodes,
BackupNotificationsModel? notifications,
}) = _BackupModel;

Expand Down
1 change: 1 addition & 0 deletions lib/domain/models/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export 'artifacts/artifact_card_model.dart';
export 'backup/backup_app_settings_model.dart';
export 'backup/backup_calculator_asc_materials_model.dart';
export 'backup/backup_custom_builds_model.dart';
export 'backup/backup_game_code_model.dart';
export 'backup/backup_inventory_model.dart';
export 'backup/backup_model.dart';
export 'backup/backup_notifications_model.dart';
Expand Down

0 comments on commit 99d21c0

Please sign in to comment.