/*
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 { 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
 */
export let ST_SignedTwipsMeasure = /*@__PURE__*/ (() => {
    class ST_SignedTwipsMeasure extends ValueType {
        constructor(a, ..._rest) {
            super();
            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:
                    {
                        let c = _rest[0];
                        let d = [truncate(c)];
                        {
                            let f = d[0];
                            this.c = toNullable(Number_$type, f);
                            this.d = toNullable(ST_UniversalMeasure.$, null);
                        }
                    }
                    break;
                case 2:
                    {
                        let c = _rest[0];
                        this.c = toNullable(Number_$type, c);
                        this.d = toNullable(ST_UniversalMeasure.$, null);
                    }
                    break;
                case 3:
                    {
                        let c = _rest[0];
                        this.c = toNullable(Number_$type, null);
                        this.d = toNullable(ST_UniversalMeasure.$, c);
                    }
                    break;
            }
        }
        toString() {
            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();
        }
        b() {
            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;
        }
        static a(a) {
            let b;
            if (((() => { let c = tryParseInt32_2(a, 7, CultureInfo.invariantCulture, b); b = c.p3; return c.ret; })())) {
                return new ST_SignedTwipsMeasure(2, b);
            }
            let 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;
})();
