/*
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, markType } from "./type";
import { List$1 } from "./List$1";
import { AggregatedDataProviderLayerInfo } from "./AggregatedDataProviderLayerInfo";
import { SummaryOperand_$type } from "./SummaryOperand";
/**
 * @hidden
 */
var AggregatedDataProviderTopLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(AggregatedDataProviderTopLayer, _super);
    function AggregatedDataProviderTopLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.q = "";
        _this.m = "";
        _this.c = new List$1(AggregatedDataProviderLayerInfo.$, 0);
        _this.e = new List$1(String_$type, 0);
        _this.d = new List$1(String_$type, 0);
        _this.g = new List$1(Base.$, 0);
        _this.f = new List$1(SummaryOperand_$type, 0);
        return _this;
    }
    AggregatedDataProviderTopLayer.prototype.n = function () {
        return {};
    };
    AggregatedDataProviderTopLayer.prototype.z = function (a, b, c) {
        var d = a;
        d[b] = c;
    };
    AggregatedDataProviderTopLayer.prototype.o = function (a) {
        var b = this.n();
        this.z(b, this.w, this.p);
        if (this.j.count == 0) {
        }
        var c = this.a();
        for (var d = 0; d < this.j.count; d++) {
            var e = this.s(d);
            this.z(b, e, this.l._inner[d]);
            var f = this.r(d);
            this.z(b, f, c);
        }
        for (var g = 0; g < this.h.count; g++) {
            var h = this.h._inner[g];
            if (h.a) {
                continue;
            }
            var i = this.b(h);
            if (h.m != null && h.m.count > 0) {
                for (var j = 0; j < h.m.count; j++) {
                    var k = h.m._inner[j];
                    var l = h.n._inner[j];
                    var m = h.o._inner[j];
                    var n = this.u(h, k, l);
                    this.z(b, n, m);
                    var o = this.t(h, k, l);
                    this.z(b, o, c);
                    if (!a.contains(n)) {
                        a.add(n);
                    }
                }
            }
        }
        return b;
    };
    AggregatedDataProviderTopLayer.prototype.t = function (a, b, c) {
        var d = this.u(a, b, c);
        return d + "_Drill";
    };
    AggregatedDataProviderTopLayer.prototype.u = function (a, b, c) {
        var d = "";
        for (var e = 1; e < a.j.count; e++) {
            var f = a.j._inner[e];
            if (f == null) {
                continue;
            }
            d += f.toString();
        }
        var g = b;
        var h = this.v(c);
        return d + g + h;
    };
    AggregatedDataProviderTopLayer.prototype.r = function (a) {
        return this.s(a) + "_Drill";
    };
    AggregatedDataProviderTopLayer.prototype.v = function (a) {
        var b = "";
        switch (a) {
            case 3:
                b = "Average";
                break;
            case 4:
                b = "Count";
                break;
            case 5:
                b = "Custom";
                break;
            case 1:
                b = "Max";
                break;
            case 0:
                b = "Min";
                break;
            case 2:
                b = "Sum";
                break;
        }
        return b;
    };
    AggregatedDataProviderTopLayer.prototype.s = function (a) {
        if (this.i._inner[a] != null) {
            return this.i._inner[a];
        }
        var b = this.j._inner[a];
        var c = this.v(this.k._inner[a]);
        return b + c;
    };
    AggregatedDataProviderTopLayer.prototype.x = function () {
        var a = this.a();
        var b = a.length;
        this.j.add(this.w);
        this.k.add(4);
        this.l.add1(b);
    };
    AggregatedDataProviderTopLayer.prototype.a = function () {
        var a = new List$1(Base.$, 0);
        for (var b = 0; b < this.h.count; b++) {
            if (this.h._inner[b].a) {
                for (var c = 0; c < this.h._inner[b].k.count; c++) {
                    a.add1(this.h._inner[b].k._inner[c]);
                }
            }
        }
        return a.toArray();
    };
    AggregatedDataProviderTopLayer.prototype.b = function (a) {
        var b = new List$1(Base.$, 0);
        for (var c = 0; c < a.k.count; c++) {
            b.add1(a.k._inner[c]);
        }
        return b.toArray();
    };
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "w", {
        get: function () {
            return this.q;
        },
        set: function (a) {
            this.q = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "p", {
        get: function () {
            return this.m;
        },
        set: function (a) {
            this.m = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "h", {
        get: function () {
            return this.c;
        },
        enumerable: true,
        configurable: true
    });
    AggregatedDataProviderTopLayer.prototype.y = function (a, b, c, d) {
        this.j.add(a);
        this.i.add(b);
        this.k.add(c);
        this.l.add1(d);
    };
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "j", {
        get: function () {
            return this.e;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "i", {
        get: function () {
            return this.d;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "l", {
        get: function () {
            return this.g;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AggregatedDataProviderTopLayer.prototype, "k", {
        get: function () {
            return this.f;
        },
        enumerable: true,
        configurable: true
    });
    AggregatedDataProviderTopLayer.$t = markType(AggregatedDataProviderTopLayer, 'AggregatedDataProviderTopLayer');
    return AggregatedDataProviderTopLayer;
}(Base));
export { AggregatedDataProviderTopLayer };
