/**
 * 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 {
  AddressTypeOptionEnum,
  addressTypeOptionEnumSchema,
} from './addressTypeOptionEnum';

/** Postal address of a party. */
export interface Address {
  /** Identifies the nature of the postal address. */
  addressType?: AddressTypeOptionEnum;
  /** 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 eg, state, region, county. */
  countrySubDivision?: string;
  /** Nation with its own government, occupying a particular territory. */
  country: string;
}

export const addressSchema: Schema<Address> = object({
  addressType: ['AddressType', optional(addressTypeOptionEnumSchema)],
  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()],
});
