var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import Button from 'src/components/Button';
import Radio from 'src/components/Radio';
import css from '../FilterBar.module.scss';
import { _cx } from 'src/utility/class';
var cx = _cx(css);
var TierLevel = function (_a) {
    var filters = _a.filters, t = _a.t, onFilterApply = _a.onFilterApply, tierPins = _a.tierPins, closeModal = _a.closeModal;
    var tier = filters.tier;
    var _b = __read(useState(tier || ''), 2), tierLevel = _b[0], setTierLevel = _b[1];
    var applyFilter = function () {
        onFilterApply('tier', tierLevel);
        closeModal();
    };
    return (_jsxs("div", { className: cx('form-group'), children: [_jsx("label", { className: "filter-title", children: t.result_tier_label }), _jsxs("div", { className: cx('tier-level-wrap'), children: [_jsx(Radio, { id: "tier-any", label: t.result_tier_any || 'Any', value: "", checked: tierLevel === '', width: "50%", onChange: function () {
                            setTierLevel('');
                        }, icon: "" }, "tier-any"), tierPins.map(function (tier, idx) {
                        return (_jsx(Radio, { id: "tier-".concat(idx), label: tier.label, value: tier.label, checked: tierLevel === tier.segmentCode, width: "50%", onChange: function () {
                                setTierLevel(tier.segmentCode);
                            }, icon: tier.imgUrl }, "tier-".concat(idx)));
                    })] }), _jsx("hr", {}), _jsxs("div", { className: "flex-space-between", children: [_jsx(Button, { type: "submit", styleType: "cancel", onClick: closeModal, children: t.result_sort_button_cancel }), _jsx(Button, { type: "submit", styleType: "normal", onClick: applyFilter, children: t.result_filter_button_apply })] })] }));
};
export default TierLevel;
