"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRateModelName = exports.mantissaToBps = void 0;
const utils_1 = require("ethers/lib/utils");
const mantissaToBps = (num) => {
    return num.div((0, utils_1.parseUnits)("1", 14)).toString();
};
exports.mantissaToBps = mantissaToBps;
const getRateModelName = (params, blocksPerYear) => {
    const suffix = `bpy${blocksPerYear}`;
    switch (params.model) {
        case "whitepaper": {
            const [b, m] = [params.baseRatePerYear, params.multiplierPerYear].map(exports.mantissaToBps);
            return `WhitePaperInterestRateModel_base${b}bps_slope${m}bps_${suffix}`;
        }
        case "jump": {
            const { baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink } = params;
            const [b, m, j, k] = [baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink].map(exports.mantissaToBps);
            return `JumpRateModel_base${b}bps_slope${m}bps_jump${j}bps_kink${k}bps_${suffix}`;
        }
        case "two-kinks": {
            const [b, m, k, m2, b2, k2, j] = [
                params.baseRatePerYear,
                params.multiplierPerYear,
                params.kink,
                params.multiplierPerYear2,
                params.baseRatePerYear2,
                params.kink2,
                params.jumpMultiplierPerYear,
            ].map(exports.mantissaToBps);
            return `TwoKinks_base${b}bps_slope${m}bps_kink${k}bps_slope2${m2}bps_base2${b2}bps_kink2${k2}bps_jump${j}bps_${suffix}`;
        }
    }
};
exports.getRateModelName = getRateModelName;
