/*
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, markStruct } from "igniteui-angular-core";
import { Color } from "igniteui-angular-core";
import { DocCoreUtils } from "./DocCoreUtils";
import { CultureInfo } from "igniteui-angular-core";
import { tryParseInt32_2, intToString1 } from "igniteui-angular-core";
/**
 * @hidden
 */
export class ST_HexColorRGB extends ValueType {
    constructor(a, ..._rest) {
        super();
        this.m = 0;
        this.l = 0;
        this.k = 0;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0: break;
            case 1:
                {
                    let c = _rest[0];
                    let d = [c.o, c.n, c.m];
                    {
                        let f = d[0];
                        let g = d[1];
                        let h = d[2];
                        this.m = f;
                        this.l = g;
                        this.k = h;
                    }
                }
                break;
            case 2:
                {
                    let c = _rest[0];
                    let d = _rest[1];
                    let e = _rest[2];
                    this.m = c;
                    this.l = d;
                    this.k = e;
                }
                break;
        }
    }
    equals(a) {
        let b = toNullable(ST_HexColorRGB.$, typeCast(ST_HexColorRGB.$, a));
        if (ST_HexColorRGB.h(b, toNullable(ST_HexColorRGB.$, null))) {
            return false;
        }
        return ST_HexColorRGB.e(this, b.getValueOrDefault());
    }
    getHashCode() {
        return (this.m << 16) | (this.l << 8) | this.k;
    }
    static d(a) {
        let b = ST_HexColorRGB.p(a);
        if (ST_HexColorRGB.h(b, toNullable(ST_HexColorRGB.$, null))) {
            return b.getValueOrDefault();
        }
        throw DocCoreUtils.n(ST_HexColorRGB.$, a);
    }
    static p(a) {
        let b;
        if (((() => { let c = tryParseInt32_2(a, 515, CultureInfo.invariantCulture, b); b = c.p3; return c.ret; })()) == false) {
            return toNullable(ST_HexColorRGB.$, null);
        }
        let c = ((b & 16711680) >> 16);
        let d = ((b & 65280) >> 8);
        let e = ((b & 255) >> 0);
        return toNullable(ST_HexColorRGB.$, new ST_HexColorRGB(2, c, d, e));
    }
    toString() {
        return intToString1(this.m, "X2", CultureInfo.invariantCulture) + intToString1(this.l, "X2", CultureInfo.invariantCulture) + intToString1(this.k, "X2", CultureInfo.invariantCulture);
    }
    get r() {
        return Color.u(255, this.m, this.l, this.k);
    }
    q() {
        return this.toString();
    }
    static e(a, b) {
        return a.k == b.k && a.l == b.l && a.m == b.m;
    }
    static f(a, b) {
        if (!a.hasValue) {
            return !b.hasValue;
        }
        else if (!b.hasValue) {
            return false;
        }
        return ST_HexColorRGB.e(a.value, b.value);
    }
    static g(a, b) {
        return !(ST_HexColorRGB.e(a, b));
    }
    static h(a, b) {
        if (!a.hasValue) {
            return b.hasValue;
        }
        else if (!b.hasValue) {
            return true;
        }
        return ST_HexColorRGB.g(a.value, b.value);
    }
    static s(a) {
        return a.r;
    }
    static n(a) {
        if (!a.hasValue) {
            return toNullable(Color.$, null);
        }
        return toNullable(Color.$, ST_HexColorRGB.s(a.value));
    }
    static b(a) {
        return new ST_HexColorRGB(2, a.o, a.n, a.m);
    }
    static o(a) {
        if (!a.hasValue) {
            return toNullable(ST_HexColorRGB.$, null);
        }
        return toNullable(ST_HexColorRGB.$, ST_HexColorRGB.b(a.value));
    }
}
ST_HexColorRGB.$t = markStruct(ST_HexColorRGB, 'ST_HexColorRGB');
ST_HexColorRGB.a = new ST_HexColorRGB(0);
//# sourceMappingURL=ST_HexColorRGB.js.map