"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (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 () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoomDetailsBedsBlock = RoomDetailsBedsBlock;
const hooks_1 = require("../../../../hooks/index.js");
const react_1 = __importDefault(require("react"));
const react_i18next_1 = require("react-i18next");
const Icon_1 = __importStar(require("../../../generic/Icon/Icon"));
const Text_1 = require("../../../generic/Text");
const Translation_1 = require("../../../../translations/Translation");
const Color_1 = require("../../../../util/Color");
function RoomDetailsBedsBlock(props) {
    var _a, _b, _c, _d, _e, _f, _g;
    const { hotel } = (0, hooks_1.useCurrentHotel)();
    const { t } = (0, react_i18next_1.useTranslation)();
    const extraRoomData = (_a = hotel === null || hotel === void 0 ? void 0 : hotel.rooms) === null || _a === void 0 ? void 0 : _a[(_b = props.room) === null || _b === void 0 ? void 0 : _b.code]; // From server side
    const adminRoomSize = extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.roomSize;
    const overrideRoomSize = (_e = (_c = hotel === null || hotel === void 0 ? void 0 : hotel.overwrites) === null || _c === void 0 ? void 0 : _c[(_d = props.room) === null || _d === void 0 ? void 0 : _d.code]) === null || _e === void 0 ? void 0 : _e.RoomDimensions; // From client side
    const roomSize = overrideRoomSize !== null && overrideRoomSize !== void 0 ? overrideRoomSize : (adminRoomSize ? `${adminRoomSize} m²` : undefined);
    const petFriendly = !!(extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.petFriendly);
    const textColor = (_f = props.textColor) !== null && _f !== void 0 ? _f : Color_1.Color.DarkGrey;
    let bedType = `${(extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.bedQuantity) > 0 ? extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.bedQuantity : ''} ${extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.bedType}`;
    if ((_g = extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.bedTypeOverride) === null || _g === void 0 ? void 0 : _g.trim()) {
        bedType = extraRoomData.bedTypeOverride;
    }
    return (react_1.default.createElement("ul", { className: "u-inline-flex u-flex-gap u-flex-wrap u-marg-bottom rs-room-details-beds-block" },
        react_1.default.createElement("li", { className: "u-flex align-items-center" },
            react_1.default.createElement(Icon_1.default, { icon: Icon_1.IconType.People, size: "24px", color: Color_1.Color.Navy }),
            react_1.default.createElement("div", { className: "u-pad-left--light" },
                react_1.default.createElement(Text_1.Text, { type: Text_1.TextType.Small, inline: true, color: textColor }, t(Translation_1.Translation.Step.Room.Sleeps, {
                    maxOccupancy: extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.maxOccupancy,
                })))),
        (extraRoomData === null || extraRoomData === void 0 ? void 0 : extraRoomData.showBedType) !== false && (react_1.default.createElement("li", { className: "u-flex align-items-center" },
            react_1.default.createElement(Icon_1.default, { icon: Icon_1.IconType.Bed, size: "24px", color: Color_1.Color.Navy }),
            react_1.default.createElement("div", { className: "u-pad-left--light" },
                react_1.default.createElement(Text_1.Text, { type: Text_1.TextType.Small, inline: true, color: textColor }, bedType)))),
        !!roomSize && (react_1.default.createElement("li", { className: "u-flex align-items-center" },
            react_1.default.createElement(Icon_1.default, { icon: Icon_1.IconType.RoomSize, size: "24px", color: Color_1.Color.Navy }),
            react_1.default.createElement("div", { className: "u-pad-left--light" },
                react_1.default.createElement(Text_1.Text, { type: Text_1.TextType.Small, inline: true, color: textColor }, roomSize)))),
        petFriendly && (react_1.default.createElement("li", { className: "u-flex align-items-center" },
            react_1.default.createElement(Icon_1.default, { icon: Icon_1.IconType.PetFriendly, size: "24px", color: Color_1.Color.Navy }),
            react_1.default.createElement("div", { className: "u-pad-left--light" },
                react_1.default.createElement(Text_1.Text, { type: Text_1.TextType.Small, inline: true, color: textColor }, t(Translation_1.Translation.Step.Room.PetFriendly)))))));
}
//# sourceMappingURL=RoomDetailsBedsBlock.js.map