/** * This file is generated by the SwaggerTSGenerator. * Do not edit. */ /* tslint:disable */ import { BaseModel } from './base-model'; import { SubTypeFactory } from './sub-type-factory'; import { IFlatDeductibleAmount, FlatDeductibleAmount } from './flat-deductible-amount.model'; import { IRatedDeductibleAmount, RatedDeductibleAmount } from './rated-deductible-amount.model'; export interface IDeductible { amount?: IFlatDeductibleAmount | IRatedDeductibleAmount; id?: string; typeSelector?: string; } export class Deductible extends BaseModel implements IDeductible { static TYPE_SELECTOR = 'Deductible'; static AMOUNT_FIELD_NAME = 'amount'; static ID_FIELD_NAME = 'id'; static TYPE_SELECTOR_FIELD_NAME = 'typeSelector'; amount: FlatDeductibleAmount | RatedDeductibleAmount; id: 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 = Deductible.TYPE_SELECTOR; this.amount = new FlatDeductibleAmount(); 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.amount && rawValues.amount.typeSelector && this.amount.typeSelector !== rawValues.amount.typeSelector) { this.amount = SubTypeFactory.createSubTypeInstance(rawValues.amount) as FlatDeductibleAmount | RatedDeductibleAmount; } this.amount.setValues(rawValues.amount); this.id = this.getValue(rawValues, Deductible.ID_FIELD_NAME); this.typeSelector = this.getValue(rawValues, Deductible.TYPE_SELECTOR_FIELD_NAME); } } }