/** Defines the interface for a component that handles address lookup functionality. */
export interface AddressLookup {
  /**
   * Updates the list of address lookup results displayed to the user.
   * @param {AddressLookupItem[]} results - An array of address lookup items to display.
   * Each item typically contains address details and potentially
   * additional information for the user to select from.
   */
  update(results: AddressLookupItem[]): void;
  /**
   * Confirms the user's selection of an address from the lookup results.
   * @param {AddressLookupItem} address - The address lookup item that the user has selected.
   */
  confirm(address: AddressLookupItem): void;
  /**
   * Indicates that the address lookup process has failed.
   * @param {{ message: string }?} error - An optional object containing an error message
   * providing details about the rejection.
   */
  reject(error?: { message: string }): void;
}

export interface PostalAddress {
  /** The house number or extra house information. */
  houseNumberOrName?: string;
  /** Additional information associated with the location, typically defined at the city or town level (such as district or neighborhood), in a postal address. */
  stateOrProvince?: string;
  /** The city for the contact. */
  city?: string;
  /** The zip code or postal code, where applicable, for the contact. */
  postalCode?: string;
  /** The subadministrative area (such as a county or other region) in a postal address. */
  street?: string;
  /** The state for the contact. */
  country?: string;
}

export interface AddressLookupItem {
  /** The postal address information. */
  address: PostalAddress;
  /** The unique identifier of postal address */
  id: string;
}
