import 'package:auth/src/features/sign_up/domain/entities/address_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'address_model.freezed.dart';
part 'address_model.g.dart';

@freezed
abstract class AddressModel with _$AddressModel {
  const factory AddressModel({
    required String street,
    required String city,
    required String province,
    required String state,
    required String country,
    required int postCode,
  }) = _AddressModel;

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

extension AddressModelMapper on AddressEntity {
  AddressModel toModel() => AddressModel(
    street: street,
    city: city,
    province: province,
    state: state,
    country: country,
    postCode: postCode,
  );
}
