part of '../auth_dtos.dart';

@freezed
class CheckPhoneDto with _$CheckPhoneDto {
  const CheckPhoneDto._();

  const factory CheckPhoneDto({
    @JsonKey(name: 'status') String? status,
    @JsonKey(name: 'message') String? message,
    @JsonKey(name: 'data') CheckPhoneDataDto? data,
  }) = _CheckPhoneDto;

  factory CheckPhoneDto.fromJson(Map<String, dynamic> json) =>
      _$CheckPhoneDtoFromJson(json);
  CheckPhone toDomain() => CheckPhone(
    status: status?.toCheckPhoneStatus() ?? CheckPhoneStatus.unknown,
    message: message ?? '',
    phoneNumber: data?.phoneNumber ?? '',
  );
}

@freezed
class CheckPhoneDataDto with _$CheckPhoneDataDto {
  const factory CheckPhoneDataDto({
    @JsonKey(name: 'phone_number') String? phoneNumber,
  }) = _CheckPhoneDataDto;

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