import { DataSourceSchemaPropertyType_$type } from "igniteui-webcomponents-core";
import { IgcGridFilterDialogViewModelGroupingLevelCollection } from "./igc-grid-filter-dialog-view-model-grouping-level-collection";
import { IgcGridFilterDialogViewModelRowCollection } from "./igc-grid-filter-dialog-view-model-row-collection";
import { GridFilterDialogViewModel as GridFilterDialogViewModel_internal } from "./GridFilterDialogViewModel";
import { ensureEnum, ensureBool } from "igniteui-webcomponents-core";
import { GridFilterDialogViewModelGroupingLevelCollection as GridFilterDialogViewModelGroupingLevelCollection_internal } from "./GridFilterDialogViewModelGroupingLevelCollection";
import { GridFilterDialogViewModelGroupingLevel } from "./GridFilterDialogViewModelGroupingLevel";
import { SyncableObservableCollection$1 } from "igniteui-webcomponents-core";
import { GridFilterDialogViewModelRowCollection as GridFilterDialogViewModelRowCollection_internal } from "./GridFilterDialogViewModelRowCollection";
import { GridFilterDialogViewModelRow } from "./GridFilterDialogViewModelRow";
var IgcGridFilterDialogViewModel = /** @class */ /*@__PURE__*/ (function () {
    function IgcGridFilterDialogViewModel() {
        this._groupingLevels = null;
        this._rows = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    IgcGridFilterDialogViewModel.prototype.createImplementation = function () {
        return new GridFilterDialogViewModel_internal();
    };
    Object.defineProperty(IgcGridFilterDialogViewModel.prototype, "i", {
        /**
         * @hidden
         */
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgcGridFilterDialogViewModel.prototype.onImplementationCreated = function () {
    };
    IgcGridFilterDialogViewModel.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    };
    Object.defineProperty(IgcGridFilterDialogViewModel.prototype, "propertyType", {
        get: function () {
            return this.i.a;
        },
        set: function (v) {
            this.i.a = ensureEnum(DataSourceSchemaPropertyType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcGridFilterDialogViewModel.prototype, "groupingLevels", {
        get: function () {
            if (this._groupingLevels === null) {
                var coll = new IgcGridFilterDialogViewModelGroupingLevelCollection();
                var innerColl = this.i.e;
                if (!innerColl) {
                    innerColl = new GridFilterDialogViewModelGroupingLevelCollection_internal();
                }
                this._groupingLevels = coll._fromInner(innerColl);
                this.i.e = innerColl;
            }
            return this._groupingLevels;
        },
        set: function (v) {
            if (this._groupingLevels !== null) {
                this._groupingLevels._setSyncTarget(null);
                this._groupingLevels = null;
            }
            var coll = new IgcGridFilterDialogViewModelGroupingLevelCollection();
            this._groupingLevels = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(GridFilterDialogViewModelGroupingLevel.$type);
            var innerColl = this.i.e;
            if (!innerColl) {
                innerColl = new GridFilterDialogViewModelGroupingLevelCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._groupingLevels._setSyncTarget(syncColl);
            this.i.e = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcGridFilterDialogViewModel.prototype, "isTopLevelOr", {
        get: function () {
            return this.i.k;
        },
        set: function (v) {
            this.i.k = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcGridFilterDialogViewModel.prototype, "maxGroupingLevels", {
        get: function () {
            return this.i.m;
        },
        set: function (v) {
            this.i.m = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcGridFilterDialogViewModel.prototype, "rows", {
        get: function () {
            if (this._rows === null) {
                var coll = new IgcGridFilterDialogViewModelRowCollection();
                var innerColl = this.i.f;
                if (!innerColl) {
                    innerColl = new GridFilterDialogViewModelRowCollection_internal();
                }
                this._rows = coll._fromInner(innerColl);
                this.i.f = innerColl;
            }
            return this._rows;
        },
        set: function (v) {
            if (this._rows !== null) {
                this._rows._setSyncTarget(null);
                this._rows = null;
            }
            var coll = new IgcGridFilterDialogViewModelRowCollection();
            this._rows = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(GridFilterDialogViewModelRow.$type);
            var innerColl = this.i.f;
            if (!innerColl) {
                innerColl = new GridFilterDialogViewModelRowCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._rows._setSyncTarget(syncColl);
            this.i.f = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    IgcGridFilterDialogViewModel.prototype.findByName = function (name) {
        if (this.rows != null && this.rows.findByName && this.rows.findByName(name)) {
            return this.rows.findByName(name);
        }
        return null;
    };
    IgcGridFilterDialogViewModel.prototype.addNewRow = function () {
        this.i.n();
    };
    IgcGridFilterDialogViewModel.prototype.canGroupRange = function (startIndex, endIndex) {
        var iv = this.i.h(startIndex, endIndex);
        return (iv);
    };
    IgcGridFilterDialogViewModel.prototype.ungroupRange = function (startIndex, endIndex) {
        this.i.aa(startIndex, endIndex);
    };
    IgcGridFilterDialogViewModel.prototype.targetingRange = function (startIndex, endIndex) {
        var iv = this.i.l(startIndex, endIndex);
        return (iv);
    };
    IgcGridFilterDialogViewModel.prototype.toggleRange = function (startIndex, endIndex) {
        this.i.z(startIndex, endIndex);
    };
    IgcGridFilterDialogViewModel.prototype.groupRange = function (startIndex, endIndex, isOrGrouping) {
        this.i.o(startIndex, endIndex, isOrGrouping);
    };
    return IgcGridFilterDialogViewModel;
}());
export { IgcGridFilterDialogViewModel };
//# sourceMappingURL=igc-grid-filter-dialog-view-model.js.map
