/*
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 * as tslib_1 from "tslib";
import { Base, String_$type, toNullable, Number_$type, Boolean_$type, fromEnum, typeCast, markType, getInstanceType } from "igniteui-angular-core";
import { ISupportSetProperty_$type } from "./ISupportSetProperty";
import { List$1 } from "igniteui-angular-core";
import { CT_ColorScale } from "./CT_ColorScale";
import { CT_DataBar } from "./CT_DataBar";
import { CT_IconSet } from "./CT_IconSet";
import { CT_ExtensionList } from "./CT_ExtensionList";
import { ST_CfType_$type } from "./ST_CfType";
import { ST_ConditionalFormattingOperator_$type } from "./ST_ConditionalFormattingOperator";
import { ST_TimePeriod_$type } from "./ST_TimePeriod";
import { XmlNamespaceDefinitionBase } from "./XmlNamespaceDefinitionBase";
import { CultureInfo } from "igniteui-angular-core";
import { ST_OnOff } from "./ST_OnOff";
import { parseUInt32_1, parseInt32_1 } from "igniteui-angular-core";
/**
 * @hidden
 */
var CT_CfRule = /** @class */ (function (_super) {
    tslib_1.__extends(CT_CfRule, _super);
    function CT_CfRule() {
        var _this = _super.call(this) || this;
        _this.k = null;
        _this.b = null;
        _this.c = null;
        _this.d = null;
        _this.a = null;
        _this.e = 0;
        _this.o = toNullable(Number_$type, null);
        _this.l = 0;
        _this.u = toNullable(Boolean_$type, null);
        _this.m = toNullable(Boolean_$type, null);
        _this.r = toNullable(Boolean_$type, null);
        _this.n = toNullable(Boolean_$type, null);
        _this.q = toNullable(ST_ConditionalFormattingOperator_$type, null);
        _this.w = null;
        _this.v = toNullable(ST_TimePeriod_$type, null);
        _this.s = toNullable(Number_$type, null);
        _this.t = toNullable(Number_$type, null);
        _this.p = toNullable(Boolean_$type, null);
        _this.k = new List$1(String_$type, 0);
        return _this;
    }
    CT_CfRule.y = function (a, b, c, d, e, f, g, h, i, j, k, l, m, n) {
        var e_1, _a;
        b = 0;
        c = toNullable(Number_$type, null);
        d = 0;
        e = toNullable(Boolean_$type, null);
        f = toNullable(Boolean_$type, null);
        g = toNullable(Boolean_$type, null);
        h = toNullable(Boolean_$type, null);
        i = toNullable(ST_ConditionalFormattingOperator_$type, null);
        j = null;
        k = toNullable(ST_TimePeriod_$type, null);
        l = toNullable(Number_$type, null);
        m = toNullable(Number_$type, null);
        n = toNullable(Boolean_$type, null);
        try {
            for (var _b = tslib_1.__values(fromEnum(a.ab.u)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var o = _c.value;
                switch (o.a.e(a.d)) {
                    case "type":
                        b = XmlNamespaceDefinitionBase.b(ST_CfType_$type, o.d);
                        break;
                    case "dxfId":
                        c = toNullable(Number_$type, parseUInt32_1(o.d, CultureInfo.invariantCulture));
                        break;
                    case "priority":
                        d = parseInt32_1(o.d, CultureInfo.invariantCulture);
                        break;
                    case "stopIfTrue":
                        e = toNullable(Boolean_$type, ST_OnOff.e(o.d));
                        break;
                    case "aboveAverage":
                        f = toNullable(Boolean_$type, ST_OnOff.e(o.d));
                        break;
                    case "percent":
                        g = toNullable(Boolean_$type, ST_OnOff.e(o.d));
                        break;
                    case "bottom":
                        h = toNullable(Boolean_$type, ST_OnOff.e(o.d));
                        break;
                    case "operator":
                        i = toNullable(ST_ConditionalFormattingOperator_$type, XmlNamespaceDefinitionBase.b(ST_ConditionalFormattingOperator_$type, o.d));
                        break;
                    case "text":
                        j = o.d;
                        break;
                    case "timePeriod":
                        k = toNullable(ST_TimePeriod_$type, XmlNamespaceDefinitionBase.b(ST_TimePeriod_$type, o.d));
                        break;
                    case "rank":
                        l = toNullable(Number_$type, parseUInt32_1(o.d, CultureInfo.invariantCulture));
                        break;
                    case "stdDev":
                        m = toNullable(Number_$type, parseInt32_1(o.d, CultureInfo.invariantCulture));
                        break;
                    case "equalAverage":
                        n = toNullable(Boolean_$type, ST_OnOff.e(o.d));
                        break;
                    default: break;
                }
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
        return {
            p1: b,
            p2: c,
            p3: d,
            p4: e,
            p5: f,
            p6: g,
            p7: h,
            p8: i,
            p9: j,
            p10: k,
            p11: l,
            p12: m,
            p13: n
        };
    };
    CT_CfRule.z = function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) {
        a.ad.p(b, null);
        var p = null;
        var q = null;
        if (c.hasValue) {
            q = "operator";
            p = XmlNamespaceDefinitionBase.f(ST_ConditionalFormattingOperator_$type, c.value);
            a.ad.h(q, p);
        }
        if (d.hasValue) {
            q = "aboveAverage";
            p = ST_OnOff.g(d.value);
            a.ad.h(q, p);
        }
        if (e.hasValue) {
            q = "bottom";
            p = ST_OnOff.g(e.value);
            a.ad.h(q, p);
        }
        if (f.hasValue) {
            q = "dxfId";
            p = f.value.toString();
            a.ad.h(q, p);
        }
        if (g.hasValue) {
            q = "equalAverage";
            p = ST_OnOff.g(g.value);
            a.ad.h(q, p);
        }
        if (h.hasValue) {
            q = "percent";
            p = ST_OnOff.g(h.value);
            a.ad.h(q, p);
        }
        if (i.hasValue) {
            q = "rank";
            p = i.value.toString();
            a.ad.h(q, p);
        }
        if (j.hasValue) {
            q = "stdDev";
            p = j.value.toString();
            a.ad.h(q, p);
        }
        if (k.hasValue) {
            q = "stopIfTrue";
            p = ST_OnOff.g(k.value);
            a.ad.h(q, p);
        }
        if (l != null) {
            q = "text";
            p = l;
            a.ad.h(q, p);
        }
        if (m.hasValue) {
            q = "timePeriod";
            p = XmlNamespaceDefinitionBase.f(ST_TimePeriod_$type, m.value);
            a.ad.h(q, p);
        }
        q = "priority";
        p = n.toString();
        a.ad.h(q, p);
        q = "type";
        p = XmlNamespaceDefinitionBase.f(ST_CfType_$type, o);
        a.ad.h(q, p);
    };
    CT_CfRule.prototype.setProperty = function (a, b) {
        switch (a) {
            case 677:
                this.k.add(typeCast(String_$type, b));
                break;
            case 310:
                this.b = typeCast(CT_ColorScale.$, b);
                break;
            case 411:
                this.c = typeCast(CT_DataBar.$, b);
                break;
            case 815:
                this.d = typeCast(CT_IconSet.$, b);
                break;
            case 601:
                this.a = typeCast(CT_ExtensionList.$, b);
                break;
            default: break;
        }
    };
    CT_CfRule.prototype.toString = function () {
        var a = getInstanceType(this);
        return a != null ? a.typeName : _super.prototype.toString.call(this);
    };
    CT_CfRule.$t = markType(CT_CfRule, 'CT_CfRule', Base.$, [ISupportSetProperty_$type]);
    return CT_CfRule;
}(Base));
export { CT_CfRule };
//# sourceMappingURL=CT_CfRule.js.map