/*
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, markStruct } from "igniteui-angular-core";
import { DocCoreUtils } from "./DocCoreUtils";
import { ST_UnsignedDecimalNumber } from "./ST_UnsignedDecimalNumber";
import { ST_PositiveUniversalMeasure } from "./ST_PositiveUniversalMeasure";
import { truncate } from "igniteui-angular-core";
import { nullableNotEquals } from "igniteui-angular-core";
import { stringEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
export class ST_TwipsMeasure extends ValueType {
    constructor(a, ..._rest) {
        super();
        this.c = toNullable(ST_UnsignedDecimalNumber.$, null);
        this.d = toNullable(ST_PositiveUniversalMeasure.$, null);
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0: break;
            case 1:
                {
                    let c = _rest[0];
                    let d = [ST_UnsignedDecimalNumber.b(truncate(DocCoreUtils.j(c)))];
                    {
                        let f = d[0];
                        this.c = toNullable(ST_UnsignedDecimalNumber.$, f);
                        this.d = toNullable(ST_PositiveUniversalMeasure.$, null);
                    }
                }
                break;
            case 2:
                {
                    let c = _rest[0];
                    this.c = toNullable(ST_UnsignedDecimalNumber.$, c);
                    this.d = toNullable(ST_PositiveUniversalMeasure.$, null);
                }
                break;
            case 3:
                {
                    let c = _rest[0];
                    this.c = toNullable(ST_UnsignedDecimalNumber.$, null);
                    this.d = toNullable(ST_PositiveUniversalMeasure.$, c);
                }
                break;
        }
    }
    toString() {
        if (nullableNotEquals(this.c, null)) {
            return this.c.value.toString();
        }
        if (nullableNotEquals(this.d, null)) {
            return this.d.value.toString();
        }
        return stringEmpty();
    }
    b() {
        if (nullableNotEquals(this.c, null)) {
            return ST_UnsignedDecimalNumber.h(this.c.value);
        }
        if (nullableNotEquals(this.d, null)) {
            return this.d.value.d();
        }
        return 0;
    }
    static a(a) {
        let b = ST_UnsignedDecimalNumber.f(a);
        if (nullableNotEquals(b, null)) {
            return new ST_TwipsMeasure(2, b.value);
        }
        let c = ST_PositiveUniversalMeasure.e(a);
        if (nullableNotEquals(c, null)) {
            return new ST_TwipsMeasure(3, c.value);
        }
        throw DocCoreUtils.n(ST_TwipsMeasure.$, a);
    }
}
ST_TwipsMeasure.$t = markStruct(ST_TwipsMeasure, 'ST_TwipsMeasure');
//# sourceMappingURL=ST_TwipsMeasure.js.map