// (C) 2021-2025 GoodData Corporation
import { BucketNames } from "@gooddata/sdk-ui";
import { geoConfigFromInsight, geoInsightConversion } from "./geoConfigCodeGenerator.js";
import { PluggableGeoPushpinChart } from "./PluggableGeoPushpinChart.js";
import { executionConfigInsightConversion, filtersInsightConversion, getInsightToPropsConverter, getReactEmbeddingCodeGenerator, insightConversion, localeInsightConversion, singleAttributeBucketConversion, singleAttributeOrMeasureBucketConversion, sortsInsightConversion, } from "../../../utils/embeddingCodeGenerator/index.js";
import { BaseChartDescriptor } from "../baseChart/BaseChartDescriptor.js";
import { chartAdditionalFactories } from "../chartCodeGenUtils.js";
import { MAX_VISUALIZATION_HEIGHT, MIDDLE_VISUALIZATION_HEIGHT } from "../constants.js";
export class GeoPushpinChartDescriptor extends BaseChartDescriptor {
    getFactory() {
        return (params) => new PluggableGeoPushpinChart(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;
    }
    getEmbeddingCode = getReactEmbeddingCodeGenerator({
        component: {
            importType: "named",
            name: "GeoPushpinChart",
            package: "@gooddata/sdk-ui-geo",
        },
        insightToProps: getInsightToPropsConverter({
            location: geoInsightConversion("location", BucketNames.LOCATION),
            latitude: geoInsightConversion("latitude", BucketNames.LATITUDE),
            longitude: geoInsightConversion("longitude", BucketNames.LONGITUDE),
            size: singleAttributeOrMeasureBucketConversion("size", BucketNames.SIZE),
            color: singleAttributeOrMeasureBucketConversion("color", BucketNames.COLOR),
            segmentBy: singleAttributeBucketConversion("segmentBy", BucketNames.SEGMENT),
            filters: filtersInsightConversion("filters"),
            sortBy: sortsInsightConversion("sortBy"),
            config: insightConversion("config", {
                typeImport: {
                    importType: "named",
                    name: "IGeoConfig",
                    package: "@gooddata/sdk-ui-geo",
                },
                cardinality: "scalar",
            }, geoConfigFromInsight),
            locale: localeInsightConversion("locale"),
            execConfig: executionConfigInsightConversion("execConfig"),
        }),
        additionalFactories: chartAdditionalFactories({
            getColorMappingPredicatePackage: "@gooddata/sdk-ui-geo",
        }),
    });
    getMeta() {
        return {
            documentationUrl: "https://www.gooddata.com/docs/gooddata-ui/latest/references/visual_components/geo_pushpin_chart",
            supportsExport: true,
            supportsZooming: false,
        };
    }
}
//# sourceMappingURL=GeoPushpinChartDescriptor.js.map