"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = NumberOfAdultsPicker;
const hooks_1 = require("../../../../hooks/index.js");
const react_1 = __importDefault(require("react"));
const react_i18next_1 = require("react-i18next");
const Translation_1 = require("translations/Translation");
const Select_1 = require("../../../generic/Select/Select");
const useSearchScopeHook_1 = require("../../../../hooks/useSearchScopeHook");
const StringHelper_1 = __importDefault(require("../../../../util/StringHelper"));
function NumberOfAdultsPicker(props) {
    var _a, _b, _c, _d, _e;
    const { hotel } = (0, hooks_1.useCurrentHotel)();
    const { getMaxSelectableAdults } = (0, useSearchScopeHook_1.useSearchScopeHook)();
    const maxAdults = getMaxSelectableAdults({ adults: (_a = props.row) === null || _a === void 0 ? void 0 : _a.getAdults(), children: (_b = props.row) === null || _b === void 0 ? void 0 : _b.getChildren(), infants: (_c = props.row) === null || _c === void 0 ? void 0 : _c.getInfants() });
    const { t } = (0, react_i18next_1.useTranslation)();
    const selectedValue = (_e = (_d = props.row) === null || _d === void 0 ? void 0 : _d.getAdults()) !== null && _e !== void 0 ? _e : 1;
    return (react_1.default.createElement(Select_1.Select, { nativeOnMobile: true, options: [...Array(maxAdults)].map((v, value) => {
            value += 1;
            return {
                text: StringHelper_1.default.pluralWithDictAndCount(value, Translation_1.Translation.Step.Date.Adult, t),
                value: value.toString(),
            };
        }), value: selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.toString(), onChange: props.onChange, keyName: "value", labelName: "text", inputLabelColor: props.labelColor }));
}
//# sourceMappingURL=NumberOfAdultsPicker.js.map