"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TermsOfUseBase = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const react_core_1 = require("@patternfly/react-core");
const Chatbot_1 = require("../Chatbot");
const ChatbotModal_1 = __importDefault(require("../ChatbotModal/ChatbotModal"));
const TermsOfUseBase = (_a) => {
    var { handleModalToggle, isModalOpen, onPrimaryAction, onSecondaryAction, primaryActionBtn = 'Accept', secondaryActionBtn = 'Decline', title = 'Terms of use', image, altText, displayMode = Chatbot_1.ChatbotDisplayMode.default, className, children, innerRef, ouiaId = 'TermsOfUse', isCompact } = _a, props = __rest(_a, ["handleModalToggle", "isModalOpen", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "image", "altText", "displayMode", "className", "children", "innerRef", "ouiaId", "isCompact"]);
    const handlePrimaryAction = (_event) => {
        handleModalToggle(_event);
        onPrimaryAction && onPrimaryAction(_event);
    };
    const handleSecondaryAction = (_event) => {
        onSecondaryAction(_event);
    };
    const modal = ((0, jsx_runtime_1.jsx)(ChatbotModal_1.default, Object.assign({ isOpen: isModalOpen, ouiaId: ouiaId, "aria-labelledby": "terms-of-use-title", "aria-describedby": "terms-of-use-modal", className: `pf-chatbot__terms-of-use-modal pf-chatbot__terms-of-use-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className ? className : ''}`, displayMode: displayMode }, props, { children: (0, jsx_runtime_1.jsxs)("section", { className: `pf-chatbot__terms-of-use--section`, "aria-label": title, tabIndex: -1, ref: innerRef, children: [(0, jsx_runtime_1.jsx)(react_core_1.ModalHeader, { className: "pf-chatbot__terms-of-use--modal-header", children: (0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__terms-of-use--header", children: [!isCompact && image && altText && ((0, jsx_runtime_1.jsx)("img", { src: image, className: "pf-chatbot__terms-of-use--image", alt: altText })), (0, jsx_runtime_1.jsx)("h1", { className: "pf-chatbot__terms-of-use--title", children: title })] }) }), (0, jsx_runtime_1.jsx)(react_core_1.ModalBody, { className: "pf-chatbot__terms-of-use--modal-body", children: (0, jsx_runtime_1.jsx)(react_core_1.Content, { children: children }) }), (0, jsx_runtime_1.jsxs)(react_core_1.ModalFooter, { className: "pf-chatbot__terms-of-use--footer", children: [(0, jsx_runtime_1.jsx)(react_core_1.Button, { isBlock: true, variant: "primary", onClick: handlePrimaryAction, form: "terms-of-use-form", size: "lg", children: primaryActionBtn }, "terms-of-use-modal-primary"), (0, jsx_runtime_1.jsx)(react_core_1.Button, { isBlock: true, variant: "secondary", onClick: handleSecondaryAction, size: "lg", children: secondaryActionBtn }, "terms-of-use-modal-secondary")] })] }) })));
    return modal;
};
exports.TermsOfUseBase = TermsOfUseBase;
const TermsOfUse = (0, react_1.forwardRef)((props, ref) => ((0, jsx_runtime_1.jsx)(exports.TermsOfUseBase, Object.assign({ innerRef: ref }, props))));
exports.default = TermsOfUse;
