"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserSearchSummaryForm = void 0;
const react_1 = __importDefault(require("react"));
const react_i18next_1 = require("react-i18next");
const Translation_1 = require("../../../../translations/Translation");
const BookingWizardContext_1 = require("../../../generic/BookingWizard/BookingWizardContext");
const BookingWizardGuestSelector_1 = require("../../../generic/BookingWizard/BookingWizardGuestSelector/BookingWizardGuestSelector");
const UserSearchSummaryPromocodeInput_1 = require("./UserSearchSummaryPromocodeInput");
const UserSearchSummaryRow_module_scss_1 = __importDefault(require("./UserSearchSummaryRow.module.scss"));
const UserSearchSummaryForm = ({ row, hotel, isSelectedRow, bookingWizardContext, maxAdults, maxChildren, maxInfants, showChildren, setGuest, setGuests, changePromoCode, textColor, }) => {
    var _a, _b, _c;
    const { t } = (0, react_i18next_1.useTranslation)();
    const showInfants = ((_a = hotel === null || hotel === void 0 ? void 0 : hotel.childConfiguration) === null || _a === void 0 ? void 0 : _a.supportInfants) === true;
    const childRange = (_b = hotel === null || hotel === void 0 ? void 0 : hotel.childConfiguration) === null || _b === void 0 ? void 0 : _b.childRange;
    const infantRange = (_c = hotel === null || hotel === void 0 ? void 0 : hotel.childConfiguration) === null || _c === void 0 ? void 0 : _c.infantRange;
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-row__divider'] }),
        react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-row__group'] },
            react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-row__input'] },
                react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-card-item'] },
                    react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-card-label'] }, t(Translation_1.Translation.Misc.Guests)),
                    react_1.default.createElement(BookingWizardContext_1.BookingWizardContext.Provider, { value: bookingWizardContext },
                        react_1.default.createElement(BookingWizardGuestSelector_1.BookingWizardGuestSelector, { defaultValue: {
                                adults: row.getAdults(),
                                children: row.getChildren(),
                                infants: row.getInfants(),
                            }, onChange: setGuest, onEditingChange: setGuests, disableChild: !showChildren, showInfants: showInfants, maxAdults: maxAdults, maxChildren: maxChildren, maxInfants: maxInfants, disableRoom: true, ageRange: { child: childRange, infant: infantRange } }))))),
        react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-row__divider'] }),
        react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-row__group'] },
            react_1.default.createElement("div", { className: UserSearchSummaryRow_module_scss_1.default['user-search-summary-row__input'] },
                react_1.default.createElement(UserSearchSummaryPromocodeInput_1.UserSearchSummaryPromocodeInput, { row: row, onChange: changePromoCode, disabled: !isSelectedRow, promocodeTextColor: textColor, useUpdatedDesign: true })))));
};
exports.UserSearchSummaryForm = UserSearchSummaryForm;
//# sourceMappingURL=UserSearchSummaryForm.js.map