/** * This file is generated by the SwaggerTSGenerator. * Do not edit. */ /* tslint:disable */ import { BaseModel } from './base-model'; import { SubTypeFactory } from './sub-type-factory'; import { IPeriod, Period } from './period.model'; import { IBoundedPeriod, BoundedPeriod } from './bounded-period.model'; export interface IExchangeRate { effectivePeriod?: IPeriod | IBoundedPeriod; rate?: string; } export class ExchangeRate extends BaseModel implements IExchangeRate { static EFFECTIVE_PERIOD_FIELD_NAME = 'effectivePeriod'; static RATE_FIELD_NAME = 'rate'; effectivePeriod: Period | BoundedPeriod; rate: string; /** * constructor * @param values Can be used to set a webapi response or formValues to this newly constructed model */ constructor(values?: Partial) { super(); this.effectivePeriod = new Period(); 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 if (rawValues.effectivePeriod && rawValues.effectivePeriod.typeSelector && this.effectivePeriod.typeSelector !== rawValues.effectivePeriod.typeSelector) { this.effectivePeriod = SubTypeFactory.createSubTypeInstance(rawValues.effectivePeriod) as Period | BoundedPeriod; } this.effectivePeriod.setValues(rawValues.effectivePeriod); this.rate = this.getValue(rawValues, ExchangeRate.RATE_FIELD_NAME); } } }