part of '../auth_dtos.dart';

@freezed
class VerifyDto with _$VerifyDto {
  const factory VerifyDto({
    @JsonKey(name: 'status') String? status,
    @JsonKey(name: 'message') String? message,
    @JsonKey(name: 'data') VerifyDataDto? data,
  }) = _VerifyDto;

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

  const VerifyDto._(); // biar bisa bikin method

  /// mapping ke domain
  Verify toDomain() => Verify(
    status: status ?? '',
    message: message ?? '',
    registrationToken: data?.registrationToken ?? '',
  );
}

@freezed
class VerifyDataDto with _$VerifyDataDto {
  const factory VerifyDataDto({
    @JsonKey(name: 'registration_token') String? registrationToken,
  }) = _VerifyDataDto;

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