"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FiltersContainer = void 0;
var react_1 = __importStar(require("react"));
var Button_1 = require("../../Button");
var CloseBtn_1 = require("../../CloseBtn");
var Modal_1 = require("../../Modal");
var ScreenMedia_1 = require("../../ScreenMedia");
var PageListingContext_1 = require("../PageListingContext");
var S = __importStar(require("./FiltersContainer.style"));
var FiltersContainer = function FiltersComponent(props) {
    var pageListing = react_1.useContext(PageListingContext_1.PageListingContext);
    return (react_1.default.createElement(S.FiltersContainerStyle, null,
        react_1.default.createElement(FiltersDesktop, { FiltersComponent: props.filterComponent, handleFilters: pageListing.updateFilters, clearFilters: pageListing.clearFilters, filters: pageListing.filters, data: pageListing.data }),
        react_1.default.createElement(FiltersMobile, { FiltersComponent: props.filterComponent, handleFilters: pageListing.updateFiltersDebounce, filters: pageListing.filters, data: pageListing.data, filterMobileOpen: pageListing.filterMobileOpen, clean: props.useClean, clearFilters: pageListing.clearFilters, closeFilters: pageListing.closeFilters, applyFilters: pageListing.applyFiltersDebounce })));
};
exports.FiltersContainer = FiltersContainer;
var FiltersDesktop = function FiltersDesktop(props) {
    var FiltersComponent = props.FiltersComponent;
    return (react_1.default.createElement(ScreenMedia_1.ScreenMedia, { showIn: "desktop" },
        react_1.default.createElement("div", { className: "filters" },
            react_1.default.createElement("div", { className: "filters-content", "data-testid": "desktop-filters" },
                react_1.default.createElement(FiltersComponent, { handleFilters: props.handleFilters, filters: props.filters, data: props.data })))));
};
function FiltersMobile(_a) {
    var filterMobileOpen = _a.filterMobileOpen, FiltersComponent = _a.FiltersComponent, handleFilters = _a.handleFilters, filters = _a.filters, clearFilters = _a.clearFilters, closeFilters = _a.closeFilters, applyFilters = _a.applyFilters, data = _a.data, _b = _a.clean, clean = _b === void 0 ? true : _b;
    function ClearFilters() {
        clearFilters();
    }
    function ApplyFilters() {
        applyFilters();
    }
    return (react_1.default.createElement(ScreenMedia_1.ScreenMedia, { showIn: "mobile" },
        react_1.default.createElement(Modal_1.Modal, { show: filterMobileOpen, animation: "slideDown" },
            react_1.default.createElement(S.FiltersMobileStyle, { "data-testid": "filters-mobile-container" },
                !clean && (react_1.default.createElement(react_1.default.Fragment, null,
                    react_1.default.createElement("div", { className: "filters-title" },
                        "Filtrar",
                        react_1.default.createElement("div", { className: "clear-filters text-primary", onClick: ClearFilters, "data-testid": "clear-mobile-filters" }, "LIMPAR FILTROS"),
                        react_1.default.createElement("div", { className: "close-btn", onClick: closeFilters },
                            react_1.default.createElement(CloseBtn_1.CloseBtn, null))),
                    react_1.default.createElement("div", { className: "filters-body" },
                        react_1.default.createElement(FiltersComponent, { handleFilters: handleFilters, filters: filters, data: data })),
                    react_1.default.createElement("div", { className: "filters-btn", "data-testid": "btn-mobile-filters" },
                        react_1.default.createElement(Button_1.Button, { onClick: ApplyFilters, type: "button" }, "Filtrar")))),
                clean && react_1.default.createElement(FiltersComponent, { handleFilters: handleFilters, filters: filters })))));
}
//# sourceMappingURL=FiltersContainer.js.map