import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2024-2025 GoodData Corporation
import cx from "classnames";
import { useIntl } from "react-intl";
import { getHumanReadablePermissionsTitle } from "./granularPermissionUtils.js";
import { workspaceGranularPermissionMessages } from "./locales.js";
import { usePermissionsDropdownState } from "./usePermissionsDropdownState.js";
import { WorkspaceIcon } from "./WorkspaceIcon.js";
import { RemoveIcon } from "../../RemoveIcon.js";
export function GranularPermissionsWorkspaceItem({ workspace, onDelete, onClick, }) {
    const { isDropdownOpen } = usePermissionsDropdownState();
    const intl = useIntl();
    const itemClassName = cx("s-user-management-workspace-item", "gd-share-dialog-grantee-item", {
        "is-active": isDropdownOpen,
    });
    const subtitle = getHumanReadablePermissionsTitle(workspace.permissions, intl);
    return (_jsxs("div", { className: itemClassName, children: [
            _jsx(RemoveIcon, { tooltipMessage: intl.formatMessage(workspaceGranularPermissionMessages.remove), onClick: () => onDelete(workspace) }), _jsxs("div", { className: "gd-grantee-content", onClick: () => onClick?.(workspace), children: [
                    _jsx("div", { className: "gd-grantee-content-label", children: workspace.title }), _jsx("div", { className: "gd-grantee-content-label gd-grantee-content-email", title: subtitle, children: subtitle })
                ] }), _jsx(WorkspaceIcon, {})
        ] }));
}
//# sourceMappingURL=GranularPermissionsWorkspaceItem.js.map