"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var ObjectUtility = typescript_angular_utilities_1.services.object.ObjectUtility;
var DateUtility = typescript_angular_utilities_1.services.date.DateUtility;
var TransformService = typescript_angular_utilities_1.services.transform.TransformService;
var index_1 = require("../dataSources/index");
var index_2 = require("../filters/index");
var CardContainerType;
(function (CardContainerType) {
    CardContainerType[CardContainerType["standard"] = 0] = "standard";
    CardContainerType[CardContainerType["selectable"] = 1] = "selectable";
})(CardContainerType = exports.CardContainerType || (exports.CardContainerType = {}));
var CardContainerBuilderService = (function () {
    function CardContainerBuilderService(injector) {
        this.injector = injector;
    }
    CardContainerBuilderService.prototype.getInstance = function (settings) {
        return {
            search: settings.search,
            paging: settings.paging,
            maxColumnSorts: settings.maxColumnSorts,
            permanentFooters: settings.permanentFooters,
            disableSelection: settings.disableSelection,
            columns: [],
            filters: [],
        };
    };
    CardContainerBuilderService.prototype.addColumn = function (container, column) {
        container.columns.push(column);
    };
    // data sources
    CardContainerBuilderService.prototype.buildObservableDataSource = function (container, data$) {
        var dataSource = new index_1.ObservableDataSource(data$);
        container.dataSource = dataSource;
        return dataSource;
    };
    CardContainerBuilderService.prototype.buildSmartDataSource = function (container, getDataSet) {
        var dataSource = new index_1.SmartDataSource(getDataSet);
        container.dataSource = dataSource;
        return dataSource;
    };
    // filters
    CardContainerBuilderService.prototype.buildFilterGroup = function (container, settings) {
        var filter = new index_2.FilterGroup(settings);
        container.filters.push(filter);
        return filter;
    };
    CardContainerBuilderService.prototype.buildModeFilterGroup = function (container, settings) {
        var transformService = this.injector.get(TransformService);
        var filter = new index_2.ModeFilterGroup(settings, transformService);
        container.filters.push(filter);
        return filter;
    };
    CardContainerBuilderService.prototype.buildRangeFilterGroup = function (container, settings) {
        var transformService = this.injector.get(TransformService);
        var filter = new index_2.RangeFilterGroup(settings, transformService);
        container.filters.push(filter);
        return filter;
    };
    CardContainerBuilderService.prototype.buildSelectFilter = function (container, settings) {
        var transformService = this.injector.get(TransformService);
        var objectUtility = this.injector.get(ObjectUtility);
        var filter = new index_2.SelectFilter(settings, objectUtility, transformService);
        container.filters.push(filter);
        return filter;
    };
    CardContainerBuilderService.prototype.buildDateFilter = function (container, settings) {
        var dateUtility = this.injector.get(DateUtility);
        var transformService = this.injector.get(TransformService);
        var filter = new index_2.DateFilter(settings, dateUtility, transformService);
        container.filters.push(filter);
        return filter;
    };
    return CardContainerBuilderService;
}());
CardContainerBuilderService = __decorate([
    core_1.Injectable(),
    __metadata("design:paramtypes", [core_1.Injector])
], CardContainerBuilderService);
exports.CardContainerBuilderService = CardContainerBuilderService;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FyZENvbnRhaW5lckJ1aWxkZXIuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNhcmRDb250YWluZXJCdWlsZGVyLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHNDQUFxRDtBQUdyRCw2RUFBd0Q7QUFDeEQsSUFBTyxhQUFhLEdBQUcsdUNBQVEsQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFDO0FBQ3JELElBQU8sV0FBVyxHQUFHLHVDQUFRLENBQUMsSUFBSSxDQUFDLFdBQVcsQ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