import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2026 GoodData Corporation
import { useId } from "react";
import { useIntl } from "react-intl";
import { olpGeneralAccessMessages } from "../../locales.js";
import { bem } from "../@utils/bem.js";
import { UiRadioRow } from "../UiRadioRow/UiRadioRow.js";
const { b } = bem("gd-ui-kit-general-access-radio");
/**
 * Two-row radio used by the OLP share dialog to choose between restricting
 * access to the listed grantees and granting access to every workspace
 * member. Composes `UiRadioRow` for each option.
 *
 * @internal
 */
export function UiGeneralAccessRadio({ value, onChange, disabled, workspaceAccessInherited, workspaceControls, workspaceLevel = "VIEW", dataTestId, }) {
    const intl = useIntl();
    const name = useId();
    return (_jsxs("div", { className: b(), "data-testid": dataTestId, role: "radiogroup", "aria-label": intl.formatMessage(olpGeneralAccessMessages.groupLabel), children: [
            _jsx(UiRadioRow, { name: name, value: "RESTRICTED", checked: value === "RESTRICTED", disabled: disabled || workspaceAccessInherited, title: intl.formatMessage(olpGeneralAccessMessages.restrictedTitle), description: intl.formatMessage(workspaceAccessInherited
                    ? olpGeneralAccessMessages.restrictedDescriptionInherited
                    : olpGeneralAccessMessages.restrictedDescription), onChange: () => onChange("RESTRICTED") }), _jsx(UiRadioRow, { name: name, value: "WORKSPACE", checked: value === "WORKSPACE", disabled: disabled, title: intl.formatMessage(olpGeneralAccessMessages.workspaceTitle), description: intl.formatMessage(workspaceLevel === "SHARE"
                    ? olpGeneralAccessMessages.workspaceDescriptionShare
                    : olpGeneralAccessMessages.workspaceDescription), onChange: () => onChange("WORKSPACE"), trailing: workspaceControls })
        ] }));
}
