import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2019-2025 GoodData Corporation
import { memo } from "react";
import { FormattedMessage } from "react-intl";
import { Message } from "@gooddata/sdk-ui-kit";
import { ForecastConfidenceControl } from "./ForecastConfidenceControl.js";
import { messages } from "../../../../locales.js";
import { CheckboxControl } from "../CheckboxControl.js";
import { ConfigSection } from "../ConfigSection.js";
import { InputControl } from "../InputControl.js";
export const ForecastSection = memo(function ForecastSection({ controlsDisabled = false, enabled = false, properties = {}, propertiesMeta = {}, defaultForecastEnabled = false, pushData = () => { }, }) {
    const forecastEnabled = properties?.controls?.["forecast"]?.enabled ?? defaultForecastEnabled;
    const forecastConfidence = properties?.controls?.["forecast"]?.confidence ?? 0.95;
    const forecastPeriod = properties?.controls?.["forecast"]?.period ?? 3;
    const forecastSeasonal = properties?.controls?.["forecast"]?.seasonal ?? false;
    const forecastToggleDisabledByVisualization = !(propertiesMeta?.forecast_enabled ?? true);
    const slicedForecast = propertiesMeta?.slicedForecast ?? false;
    const toggleDisabled = controlsDisabled || forecastToggleDisabledByVisualization || !enabled;
    const forecastControlsDisabled = !forecastEnabled || toggleDisabled;
    const showDisabledMessage = controlsDisabled || forecastToggleDisabledByVisualization || !enabled;
    return (_jsxs(ConfigSection, { id: "forecast_section", valuePath: "forecast.enabled", className: "gd-forecast-section", title: messages["forecastTitle"].id, propertiesMeta: propertiesMeta, properties: properties, canBeToggled: true, toggleDisabled: toggleDisabled, toggledOn: forecastEnabled, pushData: pushData, showDisabledMessage: showDisabledMessage, toggleMessageId: messages["forecastDisabledTooltip"].id, children: [
            _jsx(InputControl, { value: forecastPeriod, valuePath: "forecast.period", labelText: messages["forecastPeriod"].id, placeholder: messages["forecastPeriodPlaceholder"].id, disabled: forecastControlsDisabled, properties: properties, pushData: pushData }), _jsx(ForecastConfidenceControl, { disabled: forecastControlsDisabled, value: forecastConfidence, showDisabledMessage: showDisabledMessage, properties: properties, pushData: pushData }), _jsx(CheckboxControl, { valuePath: "forecast.seasonal", checked: forecastSeasonal, labelText: messages["forecastSeasonal"].id, disabled: forecastControlsDisabled, properties: properties, pushData: pushData }), Boolean(slicedForecast) && (_jsxs(Message, { type: "progress", className: "adi-input-progress gd-slicedForecast-message", children: [
                    _jsx(FormattedMessage, { id: messages["forecastSlicedWarningTitle"].id, tagName: "strong" }), _jsx(FormattedMessage, { id: messages["forecastSlicedWarningDescription"].id, tagName: "div" })
                ] }))] }));
});
//# sourceMappingURL=ForecastSection.js.map