part of '../game_dtos.dart';

@freezed
class GameDto with _$GameDto {
  const factory GameDto({
    @JsonKey(name: 'id') String? id,
    @JsonKey(name: 'name') String? name,
    @JsonKey(name: 'type') String? type,
    @JsonKey(name: 'is_active') bool? isActive,
    @JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
    @JsonKey(name: 'created_at') String? createdAt,
    @JsonKey(name: 'updated_at') String? updatedAt,
  }) = _GameDto;

  factory GameDto.fromJson(Map<String, dynamic> json) =>
      _$GameDtoFromJson(json);

  const GameDto._();

  Game toDomain() => Game(
    id: id ?? '',
    name: name ?? '',
    type: type ?? '',
    isActive: isActive ?? false,
    metadata: metadata ?? const {},
    createdAt: createdAt ?? '',
    updatedAt: updatedAt ?? '',
  );
}
