"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 lodash_1 = require("lodash");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var __object = typescript_angular_utilities_1.services.object;
var __array = typescript_angular_utilities_1.services.array;
var dataSources = require("../dataSources/index");
var index_1 = require("../sorts/index");
var DataSourceBuilderOld = (function () {
    function DataSourceBuilderOld(injector, object, array, sorter) {
        this.injector = injector;
        this.object = object;
        this.array = array;
        this.sorter = sorter;
    }
    DataSourceBuilderOld.prototype.init = function (parent) {
        this.parent = parent;
        parent._dataSource = this.buildSimpleDataSource([]);
    };
    DataSourceBuilderOld.prototype.buildSimpleDataSource = function (data) {
        var processor = new dataSources.DataSourceProcessorOld(this.object, this.sorter);
        this.parent._dataSource = new dataSources.SimpleDataSource(data, processor, this.array);
        return this.parent._dataSource;
    };
    DataSourceBuilderOld.prototype.buildDataServiceDataSource = function (getDataSet) {
        var processor = new dataSources.DataSourceProcessorOld(this.object, this.sorter);
        this.parent._dataSource = new dataSources.DataServiceDataSource(getDataSet, processor, this.array);
        return this.parent._dataSource;
    };
    DataSourceBuilderOld.prototype.buildClientServerDataSource = function (getDataSet, getFilterModel, validateModel) {
        if (lodash_1.isUndefined(this.parent._searchFilter)) {
            this.parent.useSearch();
        }
        var processor = new dataSources.DataSourceProcessorOld(this.object, this.sorter);
        this.parent._dataSource = new dataSources.ClientServerDataSource(getDataSet, this.parent._searchFilter, getFilterModel, validateModel, processor, this.array, this.object);
        return this.parent._dataSource;
    };
    DataSourceBuilderOld.prototype.buildServerSideDataSource = function (getDataSet) {
        var processor = new dataSources.DataSourceProcessorOld(this.object, this.sorter);
        this.parent._dataSource = new dataSources.ServerSideDataSource(getDataSet, processor, this.array, this.object);
        return this.parent._dataSource;
    };
    DataSourceBuilderOld.prototype.buildSmartDataSource = function (getDataSet) {
        var processor = new dataSources.DataSourceProcessorOld(this.object, this.sorter);
        this.parent._dataSource = new dataSources.SmartDataSourceOld(getDataSet, processor, this.array, this.object);
        return this.parent._dataSource;
    };
    DataSourceBuilderOld.prototype.buildCustomDataSource = function (dataSource) {
        this.parent._dataSource = dataSource;
        return this.parent._dataSource;
    };
    return DataSourceBuilderOld;
}());
DataSourceBuilderOld = __decorate([
    core_1.Injectable(),
    __metadata("design:paramtypes", [core_1.Injector, __object.ObjectUtility, __array.ArrayUtility, index_1.Sorter])
], DataSourceBuilderOld);
exports.DataSourceBuilderOld = DataSourceBuilderOld;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YVNvdXJjZUJ1aWxkZXJPbGQuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImRhdGFTb3VyY2VCdWlsZGVyT2xkLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHNDQUFxRDtBQUNyRCxpQ0FBcUM7QUFFckMsNkVBQXdEO0FBQ3hELElBQU8sUUFBUSxHQUFHLHVDQUFRLENBQUMsTUFBTSxDQUFDO0FBQ2xDLElBQU8sT0FBTyxHQUFHLHVDQUFRLENBQUMsS0FBSyxDQUFDO0FBRWhDLGtEQUFvRDtBQUNwRCx3Q0FBaUQ7QUFlakQsSUFBYSxvQkFBb0I7SUFPaEMsOEJBQVksUUFBa0IsRUFDMUIsTUFBOEIsRUFDOUIsS0FBMkIsR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