import { Address } from '@isa/shared/address';

export const formatAddress = (address?: Address): string | undefined => {
  if (!address) return undefined;

  const streetPart = [address.street, address.streetNumber]
    .filter(Boolean)
    .join(' ');

  const cityPart = [address.zipCode, address.city].filter(Boolean).join(' ');

  return [streetPart, cityPart].filter(Boolean).join(' | ');
};
