import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2023-2026 GoodData Corporation
import { memo } from "react";
import { FormattedMessage } from "react-intl";
import { Bubble, BubbleHoverTrigger, SeparatorLine } from "@gooddata/sdk-ui-kit";
import { messages } from "../../../../locales.js";
import { CheckboxControl } from "../CheckboxControl.js";
import { ConfigSection } from "../ConfigSection.js";
const TOOLTIP_ALIGN_POINTS = [{ align: "cr cl", offset: { x: 5, y: 0 } }];
export function QuestionMarkTooltip(props) {
    return (_jsxs(BubbleHoverTrigger, { children: [_jsx("span", { className: "gd-interactions-section__question-mark gd-icon-circle-question" }), _jsx(Bubble, { alignPoints: TOOLTIP_ALIGN_POINTS, children: _jsx(FormattedMessage, { id: props.tooltipText }) })] }));
}
export const InteractionsSection = memo(function InteractionsSection({ areControlsDisabledGetter, properties, propertiesMeta, pushData, InteractionsDetailRenderer, supportsAlertConfiguration, supportsDrillDownConfiguration, supportsScheduledExportsConfiguration, supportsKeyDriveAnalysis, enableImplicitDrillToUrl, }) {
    const isDrillDownDisabled = properties?.controls?.["disableDrillDown"] ?? false;
    const isDrillIntoURLDisabled = properties?.controls?.["disableDrillIntoURL"] ?? true;
    const isAlertsDisabled = properties?.controls?.["disableAlerts"] ?? false;
    const isScheduledExportsDisabled = properties?.controls?.["disableScheduledExports"] ?? false;
    const isKdaDisabled = properties?.controls?.["disableKeyDriveAnalysis"] ?? false;
    const isSeparatorVisible = supportsDrillDownConfiguration &&
        (supportsAlertConfiguration || supportsScheduledExportsConfiguration);
    return (_jsxs(ConfigSection, { id: "interactions_section", className: "gd-interactions-section", title: messages["interactions"].id, propertiesMeta: propertiesMeta, pushData: pushData, children: [supportsAlertConfiguration ? (_jsxs("div", { className: "gd-interactions-section__control-with-tooltip", children: [_jsx(CheckboxControl, { valuePath: "disableAlerts", labelText: messages["interactionsAlerts"].id, properties: properties, disabled: areControlsDisabledGetter?.("interactions.alerts"), checked: !isAlertsDisabled, pushData: pushData, isValueInverted: true }), _jsx(QuestionMarkTooltip, { tooltipText: messages["interactionsAlertsTooltip"].id })] })) : null, supportsScheduledExportsConfiguration ? (_jsxs("div", { className: "gd-interactions-section__control-with-tooltip", children: [_jsx(CheckboxControl, { valuePath: "disableScheduledExports", labelText: messages["interactionsScheduledExports"].id, properties: properties, disabled: areControlsDisabledGetter?.("interactions.scheduled_exports"), checked: !isScheduledExportsDisabled, pushData: pushData, isValueInverted: true }), _jsx(QuestionMarkTooltip, { tooltipText: messages["interactionsScheduledExportsTooltip"].id })] })) : null, supportsKeyDriveAnalysis ? (_jsxs("div", { className: "gd-interactions-section__control-with-tooltip", children: [_jsx(CheckboxControl, { valuePath: "disableKeyDriveAnalysis", labelText: messages["interactionsKda"].id, properties: properties, disabled: areControlsDisabledGetter?.("interactions.kda"), checked: !isKdaDisabled, pushData: pushData, isValueInverted: true }), _jsx(QuestionMarkTooltip, { tooltipText: messages["interactionsKdaTooltip"].id })] })) : null, isSeparatorVisible ? _jsx(SeparatorLine, { mT: 10, mB: 10 }) : null, supportsDrillDownConfiguration ? (_jsx(CheckboxControl, { valuePath: "disableDrillDown", labelText: messages["interactionsDrillDown"].id, properties: properties, disabled: areControlsDisabledGetter?.("interactions.drill_down"), checked: !isDrillDownDisabled, pushData: pushData, isValueInverted: true })) : null, InteractionsDetailRenderer ? InteractionsDetailRenderer() : null, enableImplicitDrillToUrl ? (_jsx(CheckboxControl, { valuePath: "disableDrillIntoURL", labelText: messages["interactionsDrillIntoURL"].id, properties: properties, disabled: areControlsDisabledGetter?.("interactions.drill_into_url"), checked: !isDrillIntoURLDisabled, pushData: pushData, isValueInverted: true })) : null] }));
});
//# sourceMappingURL=InteractionsSection.js.map