import {
  _buildQuantizeScaleFromColorPalette as buildQuantizeScaleFromColorPalette,
  _buildThresholdScaleFromRanges as buildThresholdScaleFromRanges
} from "@dynatrace/strato-components-preview/charts";
import { buildCategoricalScale } from "./build-categorical-scale.js";
import { DEFAULT_RANGE_COLOR } from "../constants.js";
const isThresholdLegend = (legendConfig) => legendConfig.type === "threshold";
const isSequentialLegend = (legendConfig) => legendConfig.type === "sequential";
const isCategoricalLegend = (legendConfig) => legendConfig.type === "categorical";
const buildScaleFromLegendConfig = (mapLegendConfig) => {
  if (isSequentialLegend(mapLegendConfig)) {
    const { min, max, colorPalette } = mapLegendConfig;
    return buildQuantizeScaleFromColorPalette(min, max, colorPalette);
  } else if (isThresholdLegend(mapLegendConfig)) {
    const { ranges } = mapLegendConfig;
    return buildThresholdScaleFromRanges(ranges, DEFAULT_RANGE_COLOR);
  } else if (isCategoricalLegend(mapLegendConfig)) {
    const { categories, colorPalette } = mapLegendConfig;
    return buildCategoricalScale(categories, colorPalette);
  }
};
export {
  buildScaleFromLegendConfig,
  isCategoricalLegend,
  isSequentialLegend,
  isThresholdLegend
};
//# sourceMappingURL=build-scale-from-legend-config.js.map
