"use strict";
// SPDX-License-Identifier: Apache-2.0
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImpactData = void 0;
const ValidatedArgs_1 = __importDefault(require("../../../core/validation/ValidatedArgs"));
const FormatValidation_1 = __importDefault(require("../../../port/in/request/FormatValidation"));
const InvalidNegativeRate_1 = require("./error/InvalidNegativeRate");
class ImpactData extends ValidatedArgs_1.default {
    maxDeviationCap;
    baseLine;
    maxDeviationFloor;
    impactDataDecimals;
    adjustmentPrecision;
    constructor(maxDeviationCap, baseLine, maxDeviationFloor, impactDataDecimals, adjustmentPrecision) {
        super({
            baseLine: FormatValidation_1.default.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;
        ValidatedArgs_1.default.handleValidation(ImpactData.name, this);
    }
    static checkRate(value) {
        const errorList = [];
        if (value < 0) {
            errorList.push(new InvalidNegativeRate_1.InvalidNegativeRate(value));
        }
        return errorList;
    }
}
exports.ImpactData = ImpactData;
