import { AddressType, getAddressType } from '@msfa-enums/address-type.enum';
import { AddressResponse } from './api/address.response.model';

export interface Address {
  type: AddressType;
  street: string;
  postalCode: string;
  city: string;
  country: string;
}

export function mapResponseToAddress(data: AddressResponse): Address {
  return {
    type: getAddressType(data.adresstyp),
    street: data.gatuadress,
    postalCode: data.postnummer,
    city: data.postort,
    country: data.land,
  };
}
