import type { Address } from "@customer-portal/domain/customer";

export function formatAddressLabel(address?: Partial<Address> | null): string {
  if (!address) return "";
  return [
    address.address1,
    address.address2,
    address.city,
    address.state,
    address.postcode,
    address.country || address.countryCode,
  ]
    .filter(Boolean)
    .map(part => String(part).trim())
    .filter(part => part.length > 0)
    .join(", ");
}
