/*
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 * as tslib_1 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 UltraCalcFunctionIPmt = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionIPmt, _super);
    function UltraCalcFunctionIPmt() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionIPmt.prototype.evaluate = function (a, b) {
        var c = 0;
        var d = 0;
        var e, f, g, h;
        if ((b == 6 && !((function () { var i = a.pop()._toDouble1(c); c = i.p0; return i.ret; })())) || (b >= 5 && !((function () { var i = a.pop()._toDouble1(d); d = i.p0; return i.ret; })())) || !((function () { var i = a.pop()._toDouble1(e); e = i.p0; return i.ret; })()) || !((function () { var i = a.pop()._toDouble1(f); f = i.p0; return i.ret; })()) || !((function () { var i = a.pop()._toDouble1(g); g = i.p0; return i.ret; })()) || !((function () { var 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));
        }
        var i = 0;
        var j = c;
        i = FinancialUtils.iPmt(h, g, f, e, d, j);
        return new ExcelCalcValue(i);
    };
    UltraCalcFunctionIPmt.prototype.get_name = function () {
        return "ipmt";
    };
    Object.defineProperty(UltraCalcFunctionIPmt.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionIPmt.prototype.get_minArgs = function () {
        return 4;
    };
    Object.defineProperty(UltraCalcFunctionIPmt.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionIPmt.prototype.get_maxArgs = function () {
        return 6;
    };
    Object.defineProperty(UltraCalcFunctionIPmt.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionIPmt.$t = markType(UltraCalcFunctionIPmt, 'UltraCalcFunctionIPmt', BuiltInFunctionBase.$);
    return UltraCalcFunctionIPmt;
}(BuiltInFunctionBase));
export { UltraCalcFunctionIPmt };
//# sourceMappingURL=UltraCalcFunctionIPmt.js.map