/*
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 { __extends } from "tslib";
import { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { FinancialUtils } from "./FinancialUtils";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionPPmt = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(UltraCalcFunctionPPmt, _super);
    function UltraCalcFunctionPPmt() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionPPmt.prototype.evaluate = function (a, b) {
        var c = 0;
        var d = 0;
        var e = 0;
        var f, g, h, i;
        if ((b == 6 && !((function () { var j = a.pop()._toDouble1(d); d = j.p0; return j.ret; })())) || (b >= 5 && !((function () { var j = a.pop()._toDouble1(e); e = j.p0; return j.ret; })())) || !((function () { var j = a.pop()._toDouble1(f); f = j.p0; return j.ret; })()) || !((function () { var j = a.pop()._toDouble1(g); g = j.p0; return j.ret; })()) || !((function () { var j = a.pop()._toDouble1(h); h = j.p0; return j.ret; })()) || !((function () { var 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));
        }
        var j = d;
        c = FinancialUtils.pPmt(i, h, g, f, e, j);
        return new ExcelCalcValue(c);
    };
    UltraCalcFunctionPPmt.prototype.get_name = function () {
        return "ppmt";
    };
    Object.defineProperty(UltraCalcFunctionPPmt.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionPPmt.prototype.get_minArgs = function () {
        return 4;
    };
    Object.defineProperty(UltraCalcFunctionPPmt.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionPPmt.prototype.get_maxArgs = function () {
        return 6;
    };
    Object.defineProperty(UltraCalcFunctionPPmt.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionPPmt.$t = markType(UltraCalcFunctionPPmt, 'UltraCalcFunctionPPmt', BuiltInFunctionBase.$);
    return UltraCalcFunctionPPmt;
}(BuiltInFunctionBase));
export { UltraCalcFunctionPPmt };
