import { Address } from '../../../../domain/entities/address';
import { AddressEntity } from '../../entities/address.entity';

export const addressMapper = {
  toDomain(entity: AddressEntity): Address {
    return new Address(
      entity.id,
      entity.address,
      entity.type,
      entity.walletId,
      entity.isPrimary,
      entity.createdAt,
      entity.updatedAt,
    );
  },

  toEntity(domain: Address): AddressEntity {
    const entity = new AddressEntity();
    entity.id = domain.id;
    entity.address = domain.address;
    entity.type = domain.type;
    entity.walletId = domain.walletId;
    entity.isPrimary = domain.isPrimary;
    entity.createdAt = domain.createdAt;
    entity.updatedAt = domain.updatedAt;
    return entity;
  },
};
