/*
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 { ISummaryResult_$type } from "./ISummaryResult";
import { FastIterationDictionary$2 } from "./FastIterationDictionary$2";
import { List$1 } from "./List$1";
import { stringIsNullOrWhiteSpace } from "./string";
/**
 * @hidden
 */
var DataSourceSpecialRow = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(DataSourceSpecialRow, _super);
    function DataSourceSpecialRow() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.$$isSpecialRow = true;
        _this.f = new FastIterationDictionary$2(String_$type, Base.$, 0);
        _this.e = 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, "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.e;
        }
        var b = null;
        if (((function () { var c = _this.f.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.e;
        }
        var b = null;
        if (((function () { var c = _this.e.h(a, b); b = c.p1; return c.ret; })())) {
            return b;
        }
        b = this.getSummaryValue(a);
        return b;
    };
    DataSourceSpecialRow.prototype.setValue = function (a, b) {
        this.f.item(a, b);
    };
    DataSourceSpecialRow.prototype.setSectionValue = function (a, b) {
        this.e.item(a, b);
    };
    DataSourceSpecialRow.prototype.getSectionKeys = function () {
        var e_1, _a;
        var a = new Array(this.e.r);
        var b = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.e.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.e.r != this.e.r) {
            return false;
        }
        for (var b = 0; b < a.e.o.count; b++) {
            var c = a.e.o._inner[b];
            var d = a.e.q._inner[b];
            if (!this.e.d(c)) {
                return false;
            }
            if (this.e.item(c) == null) {
                if (this.e.item(c) != d) {
                    return false;
                }
                continue;
            }
            if (!Base.equalsStatic(this.e.item(c), d)) {
                return false;
            }
        }
        return true;
    };
    DataSourceSpecialRow.$t = markType(DataSourceSpecialRow, 'DataSourceSpecialRow');
    return DataSourceSpecialRow;
}(Base));
export { DataSourceSpecialRow };
//# sourceMappingURL=DataSourceSpecialRow.js.map
