/*
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 { markType } from "igniteui-angular-core";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { CalcManagerUtilities } from "./CalcManagerUtilities";
/**
 * @hidden
 */
var UltraCalcFunctionDateDiff = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionDateDiff, _super);
    function UltraCalcFunctionDateDiff() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionDateDiff.prototype.evaluate = function (a, b) {
        var c = a.pop();
        var d = a.pop();
        var e = a.pop().toString().toLowerCase().trim();
        if (c.isNull || d.isNull) {
            var f = new ExcelCalcErrorValue(4);
            return new ExcelCalcValue(f);
        }
        var g = c._toDateTime1();
        var h = d._toDateTime1();
        var i = UltraCalcFunctionDateDiff._an(a._w, e, h, g);
        return new ExcelCalcValue(i);
    };
    UltraCalcFunctionDateDiff._al = function (a) {
        if (a >= 0) {
            return Math.floor(a);
        }
        return -Math.floor(-a);
    };
    UltraCalcFunctionDateDiff.prototype.get_name = function () {
        return "datediff";
    };
    Object.defineProperty(UltraCalcFunctionDateDiff.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionDateDiff.prototype.get_minArgs = function () {
        return 3;
    };
    Object.defineProperty(UltraCalcFunctionDateDiff.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionDateDiff.prototype.get_maxArgs = function () {
        return 3;
    };
    Object.defineProperty(UltraCalcFunctionDateDiff.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionDateDiff._ak = function (a) {
        switch (a) {
            case 2: return 2;
            case 1: return 3;
            case 0:
            default: return 1;
        }
    };
    UltraCalcFunctionDateDiff._an = function (a, b, c, d) {
        var e = 1;
        var f = UltraCalcFunctionDateDiff._ak(0);
        var g = CalcManagerUtilities.e(b, c, d, e, f);
        return g;
    };
    UltraCalcFunctionDateDiff._am = function (a, b, c, d) {
        var e = 1;
        var f = UltraCalcFunctionDateDiff._ak(0);
        var g = CalcManagerUtilities.d(b, c, d, e, f);
        return g;
    };
    UltraCalcFunctionDateDiff.$t = markType(UltraCalcFunctionDateDiff, 'UltraCalcFunctionDateDiff', BuiltInFunctionBase.$);
    return UltraCalcFunctionDateDiff;
}(BuiltInFunctionBase));
export { UltraCalcFunctionDateDiff };
//# sourceMappingURL=UltraCalcFunctionDateDiff.js.map