/*
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, fromEnum, markType } from "./type";
import { List$1 } from "./List$1";
import { FastIterationDictionary$2 } from "./FastIterationDictionary$2";
import { ISummaryResult_$type } from "./ISummaryResult";
import { stringIsNullOrWhiteSpace } from "./string";
/**
 * @hidden
 */
var DataSourceSpecialRow = /** @class */ (function (_super) {
    tslib_1.__extends(DataSourceSpecialRow, _super);
    function DataSourceSpecialRow() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.$$isSpecialRow = true;
        _this.j = new FastIterationDictionary$2(String_$type, Base.$, 0);
        _this.i = new FastIterationDictionary$2(String_$type, Base.$, 0);
        _this._rowType = 0;
        _this._targetRow = null;
        _this._level = 0;
        _this._summaryResults = null;
        return _this;
    }
    Object.defineProperty(DataSourceSpecialRow.prototype, "rowType", {
        get: function () {
            return this._rowType;
        },
        set: function (a) {
            this._rowType = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "keys", {
        get: function () {
            var a = new List$1(String_$type, 0);
            for (var b = 0; b < this.j.o.count; b++) {
                if (this.j.p._inner[b]) {
                    continue;
                }
                a.add(this.j.o._inner[b]);
            }
            return a.toArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "values", {
        get: function () {
            var a = new List$1(Base.$, 0);
            for (var b = 0; b < this.j.q.count; b++) {
                if (this.j.p._inner[b]) {
                    continue;
                }
                a.add1(this.j.q._inner[b]);
            }
            return a.toArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "sectionKeys", {
        get: function () {
            var a = new List$1(String_$type, 0);
            for (var b = 0; b < this.i.o.count; b++) {
                if (this.i.p._inner[b]) {
                    continue;
                }
                a.add(this.i.o._inner[b]);
            }
            return a.toArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "sectionValues", {
        get: function () {
            var a = new List$1(Base.$, 0);
            for (var b = 0; b < this.i.q.count; b++) {
                if (this.i.p._inner[b]) {
                    continue;
                }
                a.add1(this.i.q._inner[b]);
            }
            return a.toArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "targetRow", {
        get: function () {
            return this._targetRow;
        },
        set: function (a) {
            this._targetRow = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "level", {
        get: function () {
            return this._level;
        },
        set: function (a) {
            this._level = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DataSourceSpecialRow.prototype, "summaryResults", {
        get: function () {
            return this._summaryResults;
        },
        set: function (a) {
            this._summaryResults = a;
        },
        enumerable: true,
        configurable: true
    });
    DataSourceSpecialRow.prototype.getValue = function (a) {
        var _this = this;
        if (a == "SectionInformation") {
            return this.i;
        }
        var b = null;
        if (((function () { var c = _this.j.h(a, b); b = c.p1; return c.ret; })())) {
            return b;
        }
        b = this.getSummaryValue(a);
        return b;
    };
    DataSourceSpecialRow.prototype.getSectionValue = function (a) {
        var _this = this;
        if (a == "SectionInformation") {
            return this.i;
        }
        var b = null;
        if (((function () { var c = _this.i.h(a, b); b = c.p1; return c.ret; })())) {
            return b;
        }
        b = this.getSummaryValue(a);
        return b;
    };
    DataSourceSpecialRow.prototype.setValue = function (a, b) {
        this.j.item(a, b);
    };
    DataSourceSpecialRow.prototype.setSectionValue = function (a, b) {
        this.i.item(a, b);
    };
    DataSourceSpecialRow.prototype.getSectionKeys = function () {
        var e_1, _a;
        var a = new Array(this.i.r);
        var b = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.i.m)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                a[b] = c;
                b++;
            }
        }
        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 a;
    };
    DataSourceSpecialRow.prototype.getSummaryValue = function (a) {
        if (this.summaryResults != null) {
            for (var b = 0; b < this.summaryResults.length; b++) {
                if (this.summaryResults[b] != null && this.summaryResults[b].propertyName == a) {
                    return this.summaryResults[b].value;
                }
            }
        }
        return null;
    };
    DataSourceSpecialRow.prototype.getSummaryResults = function (a) {
        if (stringIsNullOrWhiteSpace(a)) {
            return this.summaryResults;
        }
        var b = new List$1(ISummaryResult_$type, 0);
        for (var c = 0; c < this.summaryResults.length; c++) {
            if (this.summaryResults[c] != null && this.summaryResults[c].propertyName == a) {
                b.add(this.summaryResults[c]);
            }
        }
        return b.toArray();
    };
    DataSourceSpecialRow.prototype.isHeaderSame = function (a) {
        if (a.rowType != 1) {
            return false;
        }
        if (a.i.r != this.i.r) {
            return false;
        }
        for (var b = 0; b < a.i.o.count; b++) {
            var c = a.i.o._inner[b];
            var d = a.i.q._inner[b];
            if (!this.i.d(c)) {
                return false;
            }
            if (this.i.item(c) == null) {
                if (this.i.item(c) != d) {
                    return false;
                }
                continue;
            }
            if (!Base.equalsStatic(this.i.item(c), d)) {
                return false;
            }
        }
        return true;
    };
    DataSourceSpecialRow.$t = markType(DataSourceSpecialRow, 'DataSourceSpecialRow');
    return DataSourceSpecialRow;
}(Base));
export { DataSourceSpecialRow };
//# sourceMappingURL=DataSourceSpecialRow.js.map