part of '../game_dtos.dart'; @freezed class GamePrizeDto with _$GamePrizeDto { const factory GamePrizeDto({ @JsonKey(name: 'id') String? id, @JsonKey(name: 'game_id') String? gameId, @JsonKey(name: 'name') String? name, @JsonKey(name: 'weight') int? weight, @JsonKey(name: 'stock') int? stock, @JsonKey(name: 'max_stock') int? maxStock, @JsonKey(name: 'threshold') int? threshold, @JsonKey(name: 'metadata') Map? metadata, @JsonKey(name: 'game') GameDto? game, @JsonKey(name: 'created_at') String? createdAt, @JsonKey(name: 'updated_at') String? updatedAt, }) = _GamePrizeDto; factory GamePrizeDto.fromJson(Map json) => _$GamePrizeDtoFromJson(json); const GamePrizeDto._(); /// mapping ke domain GamePrize toDomain() => GamePrize( id: id ?? '', gameId: gameId ?? '', name: name ?? '', weight: weight ?? 0, stock: stock ?? 0, maxStock: maxStock ?? 0, threshold: threshold ?? 0, metadata: metadata ?? const {}, game: game?.toDomain() ?? Game.empty(), createdAt: createdAt ?? '', updatedAt: updatedAt ?? '', ); }