/**
 * @fileoverview added by tsickle
 * Generated from: shared/storage/filters-storage.service.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { StorageService } from "./storage.service";
var FiltersStorageService = /** @class */ (function (_super) {
    tslib_1.__extends(FiltersStorageService, _super);
    function FiltersStorageService() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.FILTERS_KEY = "SENIOR_FILTERS";
        return _this;
    }
    /**
     * @param {?} key
     * @param {?} filters
     * @return {?}
     */
    FiltersStorageService.prototype.storeFilters = /**
     * @param {?} key
     * @param {?} filters
     * @return {?}
     */
    function (key, filters) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var store;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, _super.prototype.get.call(this, this.FILTERS_KEY)];
                    case 1:
                        store = (_a.sent()) || {};
                        this.removeEmptyValues(filters);
                        store[key] = filters;
                        return [4 /*yield*/, _super.prototype.store.call(this, this.FILTERS_KEY, store)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    /**
     * @param {?} key
     * @return {?}
     */
    FiltersStorageService.prototype.getFilters = /**
     * @param {?} key
     * @return {?}
     */
    function (key) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var store;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, _super.prototype.get.call(this, this.FILTERS_KEY)];
                    case 1:
                        store = (_a.sent()) || {};
                        return [2 /*return*/, store[key] || {}];
                }
            });
        });
    };
    /**
     * @param {?} key
     * @return {?}
     */
    FiltersStorageService.prototype.removeFilter = /**
     * @param {?} key
     * @return {?}
     */
    function (key) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var store;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, _super.prototype.get.call(this, this.FILTERS_KEY)];
                    case 1:
                        store = (_a.sent()) || {};
                        delete store[key];
                        return [4 /*yield*/, _super.prototype.store.call(this, this.FILTERS_KEY, store)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    /**
     * @param {?} key
     * @param {?} filters
     * @return {?}
     */
    FiltersStorageService.prototype.clearFilterValue = /**
     * @param {?} key
     * @param {?} filters
     * @return {?}
     */
    function (key, filters) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var store;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, _super.prototype.get.call(this, this.FILTERS_KEY)];
                    case 1:
                        store = (_a.sent()) || {};
                        this.removeEmptyValues(filters);
                        store[key] = filters;
                        return [4 /*yield*/, _super.prototype.store.call(this, this.FILTERS_KEY, store)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    /**
     * @private
     * @param {?} filters
     * @return {?}
     */
    FiltersStorageService.prototype.removeEmptyValues = /**
     * @private
     * @param {?} filters
     * @return {?}
     */
    function (filters) {
        Object.keys(filters).forEach((/**
         * @param {?} field
         * @return {?}
         */
        function (field) {
            if (Array.isArray(filters[field]) ? filters[field].length === 0 : !filters[field]) {
                delete filters[field];
            }
        }));
    };
    return FiltersStorageService;
}(StorageService));
export { FiltersStorageService };
if (false) {
    /**
     * @type {?}
     * @private
     */
    FiltersStorageService.prototype.FILTERS_KEY;
}
//# sourceMappingURL=data:application/json;base64, 