import { jsx as _jsx } from "react/jsx-runtime";
import { FormattedMessage, defineMessage } from "react-intl";
import { RECURRENCE_TYPES } from "./constants.js";
const cronTooltipMessage = defineMessage({ id: "recurrence.cron.tooltip" });
function CronExpressionMessage({ messageId, isWhiteLabeled }) {
    return (_jsx(FormattedMessage, { id: messageId, values: {
            a: (chunk) => {
                return isWhiteLabeled ? null : (_jsx("a", { href: "https://www.gooddata.com/docs/cloud/create-dashboards/automation/scheduled-exports/#ScheduleExportsinDashboards-CronExpressions", rel: "noopener noreferrer", target: "_blank", children: chunk }));
            },
        } }));
}
export function CronExpressionSuggestion({ errorId, validationError, recurrenceType, isWhiteLabeled, }) {
    if (recurrenceType !== RECURRENCE_TYPES.CRON) {
        return null;
    }
    return (_jsx("div", { className: "gd-recurrence-form-hint-wrapper", children: validationError ? (_jsx("span", { id: errorId, className: "gd-recurrence-form-cron-error-message", children: _jsx(CronExpressionMessage, { messageId: validationError, isWhiteLabeled: isWhiteLabeled }) })) : (_jsx("span", { className: "gd-recurrence-form-cron-help", children: _jsx(CronExpressionMessage, { messageId: cronTooltipMessage.id, isWhiteLabeled: isWhiteLabeled }) })) }));
}
