/*
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 UltraCalcFunctionIPmt = /*@__PURE__*/ (() => {
    class UltraCalcFunctionIPmt extends BuiltInFunctionBase {
        evaluate(a, b) {
            let c = 0;
            let d = 0;
            let e, f, g, h;
            if ((b == 6 && !((() => { let i = a.pop()._toDouble1(c); c = i.p0; return i.ret; })())) || (b >= 5 && !((() => { let i = a.pop()._toDouble1(d); d = i.p0; return i.ret; })())) || !((() => { let i = a.pop()._toDouble1(e); e = i.p0; return i.ret; })()) || !((() => { let i = a.pop()._toDouble1(f); f = i.p0; return i.ret; })()) || !((() => { let i = a.pop()._toDouble1(g); g = i.p0; return i.ret; })()) || !((() => { let i = a.pop()._toDouble1(h); h = i.p0; return i.ret; })())) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            if (f <= 0 || g <= 0 || g > f) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            let i = 0;
            let j = c;
            i = FinancialUtils.iPmt(h, g, f, e, d, j);
            return new ExcelCalcValue(i);
        }
        get_name() {
            return "ipmt";
        }
        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();
        }
    }
    UltraCalcFunctionIPmt.$t = markType(UltraCalcFunctionIPmt, 'UltraCalcFunctionIPmt', BuiltInFunctionBase.$);
    return UltraCalcFunctionIPmt;
})();
