/*
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, intDivide } 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 class ST_SignedHpsMeasure 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];
                    this.c = toNullable(Number_$type, truncate((c * 2)));
                    this.d = toNullable(ST_UniversalMeasure.$, null);
                }
                break;
            case 2:
                {
                    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 * 10;
        }
        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_SignedHpsMeasure(1, intDivide(b, 2));
        }
        let c = ST_UniversalMeasure.o(a);
        if (ST_UniversalMeasure.f(c, toNullable(ST_UniversalMeasure.$, null))) {
            return new ST_SignedHpsMeasure(2, c.value);
        }
        throw DocCoreUtils.n(ST_SignedHpsMeasure.$, a);
    }
}
ST_SignedHpsMeasure.$t = markStruct(ST_SignedHpsMeasure, 'ST_SignedHpsMeasure');
//# sourceMappingURL=ST_SignedHpsMeasure.js.map