// (C) 2022-2026 GoodData Corporation
import { DefaultLocale, resolveLocale } from "@gooddata/sdk-ui";
import { chartConfigFromInsight } from "../../components/pluggableVisualizations/chartCodeGenUtils.js";
import { geoConfigForInsightViewComponent, isGeoChart, } from "../../components/pluggableVisualizations/geoChart/geoConfigCodeGenerator.js";
import { isPivotTableNext, pivotTableNextConfigForInsightViewComponent, } from "../../components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.js";
/**
 * @internal
 */
export function configForInsightView(insight, settings) {
    if (isGeoChart(insight) && !settings?.enableNewGeoPushpin) {
        return geoConfigForInsightViewComponent();
    }
    if (isPivotTableNext(insight, settings)) {
        return pivotTableNextConfigForInsightViewComponent();
    }
    return {
        value: chartConfigFromInsight(insight),
        meta: {
            typeImport: {
                importType: "named",
                name: "IChartConfig",
                package: "@gooddata/sdk-ui-charts",
            },
            cardinality: "scalar",
        },
    };
}
export function localeForInsightView(ctx) {
    const val = resolveLocale(ctx?.settings?.locale);
    return {
        value: val === DefaultLocale ? undefined : val,
        meta: {
            cardinality: "scalar",
        },
    };
}
//# sourceMappingURL=insightViewConfig.js.map