/*
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, typeCast, Number_$type, markStruct } from "igniteui-angular-core";
import { ST_Percentage } from "./ST_Percentage";
import { DocCoreUtils } from "./DocCoreUtils";
import { ArgumentOutOfRangeException } from "igniteui-angular-core";
import { truncate } from "igniteui-angular-core";
/**
 * @hidden
 */
export class ST_PositiveFixedPercentage extends ValueType {
    constructor(a, ..._rest) {
        super();
        this.a = new ST_Percentage();
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0: break;
            case 1:
                {
                    let c = _rest[0];
                    DocCoreUtils.av(ST_PositiveFixedPercentage.$, ST_Percentage.l(c), "value", 0, 100);
                    this.a = c;
                }
                break;
        }
    }
    equals(a) {
        let b = toNullable(ST_PositiveFixedPercentage.$, typeCast(ST_PositiveFixedPercentage.$, a));
        if (ST_PositiveFixedPercentage.j(b, toNullable(ST_PositiveFixedPercentage.$, null))) {
            return false;
        }
        return ST_PositiveFixedPercentage.g(this, b.getValueOrDefault());
    }
    getHashCode() {
        return this.a.getHashCode();
    }
    toString() {
        return this.u(1);
    }
    u(a) {
        return this.a.r(a);
    }
    static f(a, b) {
        let c = ST_PositiveFixedPercentage.t(a, b);
        if (ST_PositiveFixedPercentage.j(c, toNullable(ST_PositiveFixedPercentage.$, null))) {
            return c.getValueOrDefault();
        }
        throw DocCoreUtils.n(ST_PositiveFixedPercentage.$, a);
    }
    static t(a, b) {
        return ST_PositiveFixedPercentage.s(ST_Percentage.q(a, b));
    }
    static o(a) {
        if (a < 0 || a > 1) {
            throw new ArgumentOutOfRangeException(1, "value");
        }
        return (a * 100);
    }
    static p(a) {
        return truncate((a * 1000));
    }
    static g(a, b) {
        return ST_Percentage.e(a.a, b.a);
    }
    static h(a, b) {
        if (!a.hasValue) {
            return !b.hasValue;
        }
        else if (!b.hasValue) {
            return false;
        }
        return ST_PositiveFixedPercentage.g(a.value, b.value);
    }
    static i(a, b) {
        return !(ST_PositiveFixedPercentage.g(a, b));
    }
    static j(a, b) {
        if (!a.hasValue) {
            return b.hasValue;
        }
        else if (!b.hasValue) {
            return true;
        }
        return ST_PositiveFixedPercentage.i(a.value, b.value);
    }
    static d(a) {
        return new ST_PositiveFixedPercentage(1, a);
    }
    static s(a) {
        if (!a.hasValue) {
            return toNullable(ST_PositiveFixedPercentage.$, null);
        }
        return toNullable(ST_PositiveFixedPercentage.$, ST_PositiveFixedPercentage.d(a.value));
    }
    static b(a) {
        return a.a;
    }
    static r(a) {
        if (!a.hasValue) {
            return toNullable(ST_Percentage.$, null);
        }
        return toNullable(ST_Percentage.$, ST_PositiveFixedPercentage.b(a.value));
    }
    static m(a) {
        return ST_Percentage.l(a.a);
    }
    static q(a) {
        if (!a.hasValue) {
            return toNullable(Number_$type, null);
        }
        return toNullable(Number_$type, ST_PositiveFixedPercentage.m(a.value));
    }
}
ST_PositiveFixedPercentage.$t = markStruct(ST_PositiveFixedPercentage, 'ST_PositiveFixedPercentage');
//# sourceMappingURL=ST_PositiveFixedPercentage.js.map