import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2024-2026 GoodData Corporation
import { defineMessages, useIntl } from "react-intl";
import { bem } from "../bem.js";
import { DetailsDialog } from "../components/DetailsDialog.js";
const { b, e } = bem("gd-ui-ext-notification-triggers-detail-dialog");
const messages = defineMessages({
    triggersTitle: {
        id: "notifications.panel.triggers.dialog.title",
    },
    newValue: {
        id: "notifications.panel.triggers.dialog.newValue",
    },
    truncatedValues: {
        id: "notifications.panel.triggers.dialog.truncatedValues",
    },
});
/**
 * @internal
 */
export function NotificationTriggersDetailDialog({ notification, onClose, }) {
    const intl = useIntl();
    const values = notification.details.data.alert?.currentValues;
    const hiddenValuesCount = (notification.details.data.alert?.triggeredCount ?? 0) - (values?.length ?? 0);
    return (_jsx(DetailsDialog, { title: intl.formatMessage(messages.triggersTitle), content: _jsxs("div", { className: b(), children: [
                _jsxs("div", { className: e("header"), children: [
                        _jsx("div", { className: e("header-title"), children: notification.details.data.alert.metric }), _jsx("div", { className: e("header-title"), children: intl.formatMessage(messages.newValue) })
                    ] }), _jsxs("div", { className: e("table"), children: [
                        _jsx("div", { className: e("values-labels"), children: values?.map((item, i) => (_jsx("div", { className: e("values-label"), children: item.labelValue }, i))) }), _jsx("div", { className: e("values"), children: values?.map((item, i) => (_jsx("div", { className: e("values-value"), children: item.primaryMetric.formattedValue }, i))) })
                    ] }), hiddenValuesCount > 0 && (_jsx("div", { className: e("values-truncated"), children: intl.formatMessage(messages.truncatedValues, {
                        count: hiddenValuesCount,
                    }) }))] }), onClose: onClose }));
}
//# sourceMappingURL=NotificationTriggersDetailDialog.js.map