import { AbstractDto } from '../../../common/dto/abstract.dto'; import { IncentiveName, IncentivePeriod, IncentiveType, } from '../../../constants'; import { BooleanField, EnumField, NumberField, StringFieldOptional, } from '../../../decorators'; import { type IncentiveSettingEntity } from '../incentive-settings.entity'; export class IncentiveSettingDto extends AbstractDto { @EnumField(() => IncentiveName) name!: IncentiveName; @StringFieldOptional() unit?: string; @NumberField() threshold!: number; @NumberField() amount!: number; @EnumField(() => IncentiveType) type!: IncentiveType; @EnumField(() => IncentivePeriod) period!: IncentivePeriod; @BooleanField() isActive!: boolean; constructor(incentiveSetting: IncentiveSettingEntity) { super(incentiveSetting); this.name = incentiveSetting.name; this.unit = incentiveSetting.unit; this.isActive = incentiveSetting.isActive; this.amount = incentiveSetting.amount; this.threshold = incentiveSetting.threshold; this.type = incentiveSetting.type; this.period = incentiveSetting.period; } }