"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFunnelChartConfig = void 0;
const savedCharts_1 = require("../../../../../../types/savedCharts");
const isMetricsOnlyFunnel_1 = require("../../../shared/isMetricsOnlyFunnel");
const getFunnelChartConfig = ({ queryTool, metricQuery, }) => {
    const { metrics } = metricQuery;
    const { chartConfig } = queryTool;
    // FunnelChartDataInput.ROW means stages across the metric columns of a
    // single row; COLUMN means one stage per row. The query shape fully
    // determines which applies, so it is derived rather than model-chosen.
    const dataInput = (0, isMetricsOnlyFunnel_1.isMetricsOnlyFunnel)(metricQuery)
        ? savedCharts_1.FunnelChartDataInput.ROW
        : savedCharts_1.FunnelChartDataInput.COLUMN;
    return {
        type: savedCharts_1.ChartType.FUNNEL,
        config: {
            fieldId: (chartConfig?.yAxisMetrics?.[0] || metrics[0]),
            dataInput,
        },
    };
};
exports.getFunnelChartConfig = getFunnelChartConfig;
//# sourceMappingURL=funnel.js.map