import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import { useCallback } from "react";
import { useIntl } from "react-intl";
import { BackButton, ConfirmDialogBase } from "@gooddata/sdk-ui-kit";
import { useUserGroupDetails } from "./detailsHooks.js";
import { UserGroupDetailsView } from "./UserGroupDetailsView.js";
import { messages } from "../locales.js";
import { extractUserGroupName } from "../utils.js";
export function EditUserGroupDetails({ userGroup, enableBackButton, onSubmit, onCancel, onClose, }) {
    const intl = useIntl();
    const { updatedUserGroup, onChange, isProcessing, isDirty, onSave } = useUserGroupDetails(userGroup, onSubmit, onCancel);
    const backButtonRenderer = useCallback(() => {
        return _jsx(BackButton, { onClick: onCancel, className: "s-user-management-navigate-back" });
    }, [onCancel]);
    return (_jsx(ConfirmDialogBase, { className: "gd-share-dialog gd-share-dialog-add-users s-user-management-edit-user-group", displayCloseButton: true, isPositive: true, isSubmitDisabled: !isDirty || isProcessing, showProgressIndicator: isProcessing, headline: extractUserGroupName(userGroup), cancelButtonText: intl.formatMessage(messages.closeEditMode), submitButtonText: intl.formatMessage(messages.saveEditedDetails), onCancel: onCancel, onSubmit: onSave, onClose: onClose, headerLeftButtonRenderer: enableBackButton ? backButtonRenderer : undefined, children: _jsx(UserGroupDetailsView, { userGroup: updatedUserGroup, mode: "EDIT", onChange: onChange }) }));
}
//# sourceMappingURL=EditUserGroupDetails.js.map