"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.canRenderAsChart = void 0;
const isMetricsOnlyFunnel_1 = require("../../shared/isMetricsOnlyFunnel");
/**
 * Determines if a query can be rendered as a specific chart type
 */
const canRenderAsChart = (chartType, metricQuery) => {
    switch (chartType) {
        case 'table':
            return true; // Table can always render
        case 'bar':
        case 'horizontal':
        case 'line':
        case 'scatter':
            // Charts require at least one dimension and one metric
            return (metricQuery.dimensions.length > 0 &&
                metricQuery.metrics.length > 0);
        case 'pie':
            // Pie charts require at least one dimension and one metric
            return (metricQuery.dimensions.length > 0 &&
                metricQuery.metrics.length > 0);
        case 'funnel':
            // Funnel stages come either from rows (dimension + metric) or
            // from the metric columns of a single-row result (no dimension)
            return ((metricQuery.dimensions.length > 0 &&
                metricQuery.metrics.length > 0) ||
                (0, isMetricsOnlyFunnel_1.isMetricsOnlyFunnel)(metricQuery));
        default:
            return false;
    }
};
exports.canRenderAsChart = canRenderAsChart;
//# sourceMappingURL=canRenderAsChart.js.map