"use strict";
exports.__esModule = true;
exports.ContentBuilderTemplate = void 0;
var tslib_1 = require("tslib");
// @ts-nocheck
require("./ContentBuilderTemplate.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var PropsWithAsAttributes_1 = require("../../../utils/types/PropsWithAsAttributes");
var usePropsHandler_1 = require("../../EventInterceptor/usePropsHandler");
var index_1 = require("./index");
var Typography_1 = require("../../Typography");
var Article_1 = require("../../Article/Article");
var CollapseGroup_1 = require("../../CollapseGroup/CollapseGroup");
var Picture_1 = require("../../Picture/Picture");
var Grid_1 = require("../../Grid/Grid");
exports.ContentBuilderTemplate = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a = (0, usePropsHandler_1.usePropsHandler)((0, index_1.cnContentBuilderTemplate)(), props), type = _a.type, title = _a.title, titleTag = _a.titleTag, text = _a.text, questions = _a.questions, picture = _a.picture;
    var typeNumber = type.toString();
    return (react_1["default"].createElement("div", { className: (0, index_1.cnContentBuilderTemplate)({ type: typeNumber }) },
        title && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "xs", weight: "bold", transform: "uppercase", as: titleTag }, title)),
        text && react_1["default"].createElement(Article_1.Article, { content: text }),
        react_1["default"].createElement(Grid_1.Grid, { breakpoints: {
                desktop: { cols: 12, gap: 'xl', yAlign: 'bottom' },
                tablet: { cols: 8 }
            } },
            questions && (react_1["default"].createElement(Grid_1.GridItem, { breakpoints: { desktop: { col: 8 }, tablet: { col: 8 } } },
                react_1["default"].createElement(CollapseGroup_1.CollapseGroup, { hoverEffect: true, items: questions, getItemLabel: function (item) { var _a; return (_a = item.question) !== null && _a !== void 0 ? _a : item.title; }, getItemContent: function (item) {
                        var _a;
                        return (react_1["default"].createElement(Article_1.Article, { content: (_a = item.answer) !== null && _a !== void 0 ? _a : item.text }));
                    } }))),
            picture && (react_1["default"].createElement(Grid_1.GridItem, { breakpoints: {
                    desktop: { col: 2, colStart: 11 },
                    tablet: { col: 8 }
                } },
                react_1["default"].createElement(Picture_1.Picture, { desktop: picture.url, desktopWebp: picture.urlWebp }))))));
});
exports["default"] = exports.ContentBuilderTemplate;
