"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/Typography");
var Article_1 = require("../../Article/Article");
var CollapseGroup_1 = require("../../CollapseGroup/CollapseGroup");
var ContentBuilderItem_1 = require("../ContentBuilderItem");
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, items = _a.items, contentBuilderItem = _a.contentBuilderItem, showCounter = _a.showCounter;
    var typeNumber = type.toString();
    var renderItemContent = function (item) {
        if (contentBuilderItem) {
            return react_1["default"].createElement(ContentBuilderItem_1.ContentBuilderItem, (0, tslib_1.__assign)({}, item, contentBuilderItem));
        }
        else {
            return react_1["default"].createElement(Article_1.Article, { content: item.text });
        }
    };
    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 }),
        items && (react_1["default"].createElement(CollapseGroup_1.CollapseGroup, { hoverEffect: true, size: "l", items: items, getItemLabel: function (item) { return item.title; }, getItemContent: renderItemContent, showCounter: showCounter }))));
});
exports["default"] = exports.ContentBuilderTemplate;
