import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { isEmpty } from "lodash-es";
import { FormattedMessage, useIntl } from "react-intl";
import { messages } from "@gooddata/sdk-ui";
import { Button } from "@gooddata/sdk-ui-kit";
import { useAttributeHierarchyDialog } from "./AttributeHierarchyDialogProvider.js";
const HOW_TO_WORK_DOCUMENTATION_LINK = "https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/";
export function AttributeHierarchyDialogFooter() {
    const { formatMessage } = useIntl();
    const { isEditing, isDirty, isLoading, attributes, onSaveAttributeHierarchy, onClose, setDisplayDeleteConfirmation, } = useAttributeHierarchyDialog();
    const isSaveDisabled = isEmpty(attributes) || !isDirty;
    const onDelete = () => {
        setDisplayDeleteConfirmation(true);
    };
    const deleteText = formatMessage(messages["hierarchyDeleteButton"]);
    const cancelText = formatMessage(messages["hierarchyCancelButton"]);
    const saveText = formatMessage(isEditing ? messages["hierarchySaveButton"] : messages["hierarchyCreateButton"]);
    return (_jsxs("div", { className: "gd-dialog-footer", children: [_jsx("div", { className: "attribute-hierarchy-note-message s-attribute-hierarchy-note-message", children: _jsx("div", { className: "gd-message information", children: _jsx(FormattedMessage, { id: messages["hierarchyAttributeNoteMessage"].id, values: {
                            b: (chunks) => _jsx("strong", { children: chunks }),
                            br: () => _jsx("br", {}),
                        }, tagName: "div" }) }) }), _jsxs("div", { className: "attribute-hierarchy-footer-actions-wrapper s-attribute-hierarchy-footer-actions-wrapper", children: [_jsxs("div", { className: "gd-dialog-footer-tip", children: [_jsx("span", { className: "gd-icon-circle-question s-gd-icon-circle-question" }), _jsx("a", { href: HOW_TO_WORK_DOCUMENTATION_LINK, className: "gd-button-link-dimmed", target: "_blank", rel: "noreferrer", children: _jsx(FormattedMessage, { id: messages["hierarchyAttributeHowToWork"].id }) })] }), _jsxs("div", { className: "gd-dialog-footer-actions s-gd-dialog-footer-actions", children: [isEditing ? (_jsx(Button, { className: "gd-button-link-dimmed attribute-hierarchy-delete-button s-attribute-hierarchy-delete-button", value: deleteText, onClick: onDelete, disabled: isLoading })) : null, _jsx(Button, { className: "gd-button-secondary attribute-hierarchy-cancel-button s-attribute-hierarchy-cancel-button", value: cancelText, onClick: onClose, disabled: isLoading }), _jsx(Button, { className: "gd-button-action attribute-hierarchy-save-button s-attribute-hierarchy-save-button", value: saveText, disabled: isSaveDisabled || isLoading, onClick: onSaveAttributeHierarchy })] })] })] }));
}
//# sourceMappingURL=AttributeHierarchyDialogFooter.js.map