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;
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { forwardRef } from 'react';
import { Button, Content, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';
import { ChatbotDisplayMode } from '../Chatbot';
import ChatbotModal from '../ChatbotModal/ChatbotModal';
export const TermsOfUseBase = (_a) => {
    var { handleModalToggle, isModalOpen, onPrimaryAction, onSecondaryAction, primaryActionBtn = 'Accept', secondaryActionBtn = 'Decline', title = 'Terms of use', image, altText, displayMode = 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 = (_jsx(ChatbotModal, 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: _jsxs("section", { className: `pf-chatbot__terms-of-use--section`, "aria-label": title, tabIndex: -1, ref: innerRef, children: [_jsx(ModalHeader, { className: "pf-chatbot__terms-of-use--modal-header", children: _jsxs("div", { className: "pf-chatbot__terms-of-use--header", children: [!isCompact && image && altText && (_jsx("img", { src: image, className: "pf-chatbot__terms-of-use--image", alt: altText })), _jsx("h1", { className: "pf-chatbot__terms-of-use--title", children: title })] }) }), _jsx(ModalBody, { className: "pf-chatbot__terms-of-use--modal-body", children: _jsx(Content, { children: children }) }), _jsxs(ModalFooter, { className: "pf-chatbot__terms-of-use--footer", children: [_jsx(Button, { isBlock: true, variant: "primary", onClick: handlePrimaryAction, form: "terms-of-use-form", size: "lg", children: primaryActionBtn }, "terms-of-use-modal-primary"), _jsx(Button, { isBlock: true, variant: "secondary", onClick: handleSecondaryAction, size: "lg", children: secondaryActionBtn }, "terms-of-use-modal-secondary")] })] }) })));
    return modal;
};
const TermsOfUse = forwardRef((props, ref) => (_jsx(TermsOfUseBase, Object.assign({ innerRef: ref }, props))));
export default TermsOfUse;
