// (C) 2025-2026 GoodData Corporation
import { PluggableGeoPushpinChartNext } from "./PluggableGeoPushpinChartNext.js";
import { getReactEmbeddingCodeGenerator } from "../../../utils/embeddingCodeGenerator/getReactEmbeddingCodeGenerator.js";
import { executionConfigInsightConversion, sdkModelPropMetas, } from "../../../utils/embeddingCodeGenerator/insightToPropsConverter/convenience.js";
import { getInsightToPropsConverter, insightConversion, } from "../../../utils/embeddingCodeGenerator/insightToPropsConverter/convertor.js";
import { BaseChartDescriptor } from "../baseChart/BaseChartDescriptor.js";
import { chartAdditionalFactories } from "../chartCodeGenUtils.js";
import { MAX_VISUALIZATION_HEIGHT, MIDDLE_VISUALIZATION_HEIGHT } from "../constants.js";
import { geoConfigFromInsight } from "./geoConfigBuilder.js";
import { buildGeoChartNextGlobalFilters, buildGeoChartNextLayers } from "./geoEmbeddingLayers.js";
/**
 * @alpha
 */
export class GeoPushpinChartNextDescriptor extends BaseChartDescriptor {
    getFactory() {
        return (params) => new PluggableGeoPushpinChartNext(params);
    }
    getSizeInfo(_insight, layoutDescriptor, settings) {
        return {
            width: {
                default: 6,
                min: 6,
                max: layoutDescriptor.gridColumnsCount,
            },
            height: {
                default: this.getDefaultHeight(settings),
                min: this.getDefaultHeight(settings),
                max: this.getMaxHeight(settings),
            },
        };
    }
    getDefaultHeight(_settings) {
        return MIDDLE_VISUALIZATION_HEIGHT;
    }
    getMaxHeight(_settings) {
        return MAX_VISUALIZATION_HEIGHT;
    }
    geoChartEmbeddingCodeGenerator = getReactEmbeddingCodeGenerator({
        component: {
            importType: "named",
            name: "GeoChart",
            package: "@gooddata/sdk-ui-geo",
        },
        insightToProps: getInsightToPropsConverter({
            type: insightConversion("type", { cardinality: "scalar" }, () => "pushpin"),
            layers: insightConversion("layers", {
                typeImport: {
                    importType: "named",
                    name: "IGeoLayer",
                    package: "@gooddata/sdk-ui-geo",
                },
                cardinality: "array",
            }, (insight) => buildGeoChartNextLayers(insight, "pushpin")),
            filters: insightConversion("filters", sdkModelPropMetas.Filter.Multiple, buildGeoChartNextGlobalFilters),
            config: insightConversion("config", {
                typeImport: {
                    importType: "named",
                    name: "IGeoPushpinChartConfig",
                    package: "@gooddata/sdk-ui-geo",
                },
                cardinality: "scalar",
            }, geoConfigFromInsight),
            execConfig: executionConfigInsightConversion("execConfig"),
        }),
        additionalFactories: chartAdditionalFactories({
            getColorMappingPredicatePackage: "@gooddata/sdk-ui-geo",
        }),
    });
    getEmbeddingCode = (insight, config) => {
        const layers = buildGeoChartNextLayers(insight, "pushpin");
        if (!layers.length) {
            return "";
        }
        return this.geoChartEmbeddingCodeGenerator(insight, config);
    };
    getMeta() {
        return {
            documentationUrl: "https://www.gooddata.com/docs/gooddata-ui/latest/references/visual_components/geo_pushpin_chart",
            supportsExport: true,
            supportsZooming: false,
        };
    }
}
//# sourceMappingURL=GeoPushpinChartNextDescriptor.js.map