// SPDX-License-Identifier: Apache-2.0
import ValidatedDomain from "../../../core/validation/ValidatedArgs";
import FormatValidation from "../../../port/in/request/FormatValidation";
import { InvalidNegativeRate } from "./error/InvalidNegativeRate";
export class ImpactData extends ValidatedDomain {
    maxDeviationCap;
    baseLine;
    maxDeviationFloor;
    impactDataDecimals;
    adjustmentPrecision;
    constructor(maxDeviationCap, baseLine, maxDeviationFloor, impactDataDecimals, adjustmentPrecision) {
        super({
            baseLine: FormatValidation.checkNumber({
                max: maxDeviationCap,
                min: maxDeviationFloor,
            }),
            impactDataDecimals: (_) => {
                return ImpactData.checkRate(this.impactDataDecimals);
            },
        });
        this.maxDeviationCap = maxDeviationCap;
        this.baseLine = baseLine;
        this.maxDeviationFloor = maxDeviationFloor;
        this.impactDataDecimals = impactDataDecimals;
        this.adjustmentPrecision = adjustmentPrecision;
        ValidatedDomain.handleValidation(ImpactData.name, this);
    }
    static checkRate(value) {
        const errorList = [];
        if (value < 0) {
            errorList.push(new InvalidNegativeRate(value));
        }
        return errorList;
    }
}
