import { CustomerDTO } from '@swagger/crm';
import { CustomerAddresses } from '../defs';

export function customerDtoToCustomerAddresses(customerDto: CustomerDTO): CustomerAddresses {
  return {
    generalAddress: customerDto.address,
    shippingAddresses: [],
    payerAddresses: [],

    shippingAddressIds: customerDto.shippingAddresses.map((addressData) => addressData.id),
    payerAddressIds: customerDto.payers.filter((addressData) => addressData.payer).map((addressData) => addressData.payer.id),
  };
}
