/*
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 { ValueType, toNullable, Number_$type, markStruct } from "igniteui-angular-core";
import { ST_UniversalMeasure } from "./ST_UniversalMeasure";
import { CultureInfo } from "igniteui-angular-core";
import { DocCoreUtils } from "./DocCoreUtils";
import { truncate } from "igniteui-angular-core";
import { nullableNotEquals } from "igniteui-angular-core";
import { tryParseInt32_2 } from "igniteui-angular-core";
import { stringEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var ST_SignedTwipsMeasure = /** @class */ (function (_super) {
    tslib_1.__extends(ST_SignedTwipsMeasure, _super);
    function ST_SignedTwipsMeasure(a) {
        var _rest = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            _rest[_i - 1] = arguments[_i];
        }
        var _this = _super.call(this) || this;
        _this.c = toNullable(Number_$type, null);
        _this.d = toNullable(ST_UniversalMeasure.$, null);
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0: break;
            case 1:
                {
                    var c = _rest[0];
                    var d = [truncate(c)];
                    {
                        var f = d[0];
                        _this.c = toNullable(Number_$type, f);
                        _this.d = toNullable(ST_UniversalMeasure.$, null);
                    }
                }
                break;
            case 2:
                {
                    var c = _rest[0];
                    _this.c = toNullable(Number_$type, c);
                    _this.d = toNullable(ST_UniversalMeasure.$, null);
                }
                break;
            case 3:
                {
                    var c = _rest[0];
                    _this.c = toNullable(Number_$type, null);
                    _this.d = toNullable(ST_UniversalMeasure.$, c);
                }
                break;
        }
        return _this;
    }
    ST_SignedTwipsMeasure.prototype.toString = function () {
        if (nullableNotEquals(this.c, null)) {
            return this.c.value.toString();
        }
        if (ST_UniversalMeasure.f(this.d, toNullable(ST_UniversalMeasure.$, null))) {
            return this.d.toString();
        }
        return stringEmpty();
    };
    ST_SignedTwipsMeasure.prototype.b = function () {
        if (nullableNotEquals(this.c, null)) {
            return this.c.value;
        }
        if (ST_UniversalMeasure.f(this.d, toNullable(ST_UniversalMeasure.$, null))) {
            return this.d.value.k();
        }
        return 0;
    };
    ST_SignedTwipsMeasure.a = function (a) {
        var b;
        if (((function () { var c = tryParseInt32_2(a, 7, CultureInfo.invariantCulture, b); b = c.p3; return c.ret; })())) {
            return new ST_SignedTwipsMeasure(2, b);
        }
        var c = ST_UniversalMeasure.o(a);
        if (ST_UniversalMeasure.f(c, toNullable(ST_UniversalMeasure.$, null))) {
            return new ST_SignedTwipsMeasure(3, c.value);
        }
        throw DocCoreUtils.n(ST_SignedTwipsMeasure.$, a);
    };
    ST_SignedTwipsMeasure.$t = markStruct(ST_SignedTwipsMeasure, 'ST_SignedTwipsMeasure');
    return ST_SignedTwipsMeasure;
}(ValueType));
export { ST_SignedTwipsMeasure };
//# sourceMappingURL=ST_SignedTwipsMeasure.js.map