/** * This file is generated by the SwaggerTSGenerator. * Do not edit. */ /* tslint:disable */ import { BaseModel } from './base-model'; import { SubTypeFactory } from './sub-type-factory'; import { ICountry, Country } from './country.model'; import { IPeriod, Period } from './period.model'; import { IBoundedPeriod, BoundedPeriod } from './bounded-period.model'; import { ICountrySubdivision, CountrySubdivision } from './country-subdivision.model'; export interface IPostalAddress { city?: string; co?: string; country: ICountry; effectivity?: IPeriod | IBoundedPeriod; fao?: string; postCode: string; region?: ICountrySubdivision; street?: string; typeSelector?: string; } export class PostalAddress extends BaseModel implements IPostalAddress { static TYPE_SELECTOR = 'PostalAddress'; static CITY_FIELD_NAME = 'city'; static CO_FIELD_NAME = 'co'; static COUNTRY_FIELD_NAME = 'country'; static EFFECTIVITY_FIELD_NAME = 'effectivity'; static FAO_FIELD_NAME = 'fao'; static POST_CODE_FIELD_NAME = 'postCode'; static REGION_FIELD_NAME = 'region'; static STREET_FIELD_NAME = 'street'; static TYPE_SELECTOR_FIELD_NAME = 'typeSelector'; city: string; co: string; country: Country; effectivity: Period | BoundedPeriod; fao: string; postCode: string; region: CountrySubdivision; street: string; typeSelector: string; /** * constructor * @param values Can be used to set a webapi response or formValues to this newly constructed model */ constructor(values?: Partial) { super(); this.typeSelector = PostalAddress.TYPE_SELECTOR; this.country = new Country(); this.effectivity = new Period(); this.region = new CountrySubdivision(); if (values) { this.setValues(values); } } /** * set the values. * @param values Can be used to set a webapi response to this newly constructed model */ setValues(values: Partial): void { if (values) { const rawValues = values this.city = this.getValue(rawValues, PostalAddress.CITY_FIELD_NAME); this.co = this.getValue(rawValues, PostalAddress.CO_FIELD_NAME); this.country.setValues(rawValues.country); if (rawValues.effectivity && rawValues.effectivity.typeSelector && this.effectivity.typeSelector !== rawValues.effectivity.typeSelector) { this.effectivity = SubTypeFactory.createSubTypeInstance(rawValues.effectivity) as Period | BoundedPeriod; } this.effectivity.setValues(rawValues.effectivity); this.fao = this.getValue(rawValues, PostalAddress.FAO_FIELD_NAME); this.postCode = this.getValue(rawValues, PostalAddress.POST_CODE_FIELD_NAME); this.region.setValues(rawValues.region); this.street = this.getValue(rawValues, PostalAddress.STREET_FIELD_NAME); this.typeSelector = this.getValue(rawValues, PostalAddress.TYPE_SELECTOR_FIELD_NAME); } } }