/**
 * Account and Transaction API SpecificationLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { array, object, optional, Schema, string } from '../schema';
import { AddressTypeEnum, addressTypeEnumSchema } from './addressTypeEnum';

/** Information that locates and identifies a specific address, as defined by postal services or in free format text. */
export interface DeliveryAddress {
  /** Identifies the nature of the postal address. */
  addressType?: AddressTypeEnum;
  /** Information that locates and identifies a specific address, as defined by postal services, that is presented in free format text. */
  addressLine?: string[];
  /** Name of a street or thoroughfare. */
  streetName?: string;
  /** Number that identifies the position of a building on a street. */
  buildingNumber?: string;
  /** Identifier consisting of a group of letters and/or numbers that is added to a postal address to assist the sorting of mail */
  postCode?: string;
  /** Name of a built-up area, with defined boundaries, and a local government. */
  townName?: string;
  /** Identifies a subdivision of a country, for instance state, region, county. */
  countrySubDivision?: string;
  /** Nation with its own government, occupying a particular territory. */
  country: string;
}

export const deliveryAddressSchema: Schema<DeliveryAddress> = object({
  addressType: ['AddressType', optional(addressTypeEnumSchema)],
  addressLine: ['AddressLine', optional(array(string()))],
  streetName: ['StreetName', optional(string())],
  buildingNumber: ['BuildingNumber', optional(string())],
  postCode: ['PostCode', optional(string())],
  townName: ['TownName', optional(string())],
  countrySubDivision: ['CountrySubDivision', optional(string())],
  country: ['Country', string()],
});
