/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { FinancialUtils } from "./FinancialUtils";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
export let UltraCalcFunctionPPmt = /*@__PURE__*/ (() => {
    class UltraCalcFunctionPPmt extends BuiltInFunctionBase {
        evaluate(a, b) {
            let c = 0;
            let d = 0;
            let e = 0;
            let f, g, h, i;
            if ((b == 6 && !((() => { let j = a.pop()._toDouble1(d); d = j.p0; return j.ret; })())) || (b >= 5 && !((() => { let j = a.pop()._toDouble1(e); e = j.p0; return j.ret; })())) || !((() => { let j = a.pop()._toDouble1(f); f = j.p0; return j.ret; })()) || !((() => { let j = a.pop()._toDouble1(g); g = j.p0; return j.ret; })()) || !((() => { let j = a.pop()._toDouble1(h); h = j.p0; return j.ret; })()) || !((() => { let j = a.pop()._toDouble1(i); i = j.p0; return j.ret; })())) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            if (g <= 0 || h <= 0 || h > g) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            let j = d;
            c = FinancialUtils.pPmt(i, h, g, f, e, j);
            return new ExcelCalcValue(c);
        }
        get_name() {
            return "ppmt";
        }
        get name() {
            return this.get_name();
        }
        get_minArgs() {
            return 4;
        }
        get minArgs() {
            return this.get_minArgs();
        }
        get_maxArgs() {
            return 6;
        }
        get maxArgs() {
            return this.get_maxArgs();
        }
    }
    UltraCalcFunctionPPmt.$t = markType(UltraCalcFunctionPPmt, 'UltraCalcFunctionPPmt', BuiltInFunctionBase.$);
    return UltraCalcFunctionPPmt;
})();
