import type { ModelTypes } from "./common.js";
import type { SupportedLayer } from "../../interfaces.js";
import type { ChartConfig } from "../../utils/types/index.js";
import type { IFeatureLayer } from "../../spec/rest-js-types.js";
import type { WebChartBarChartSeries, WebChartHeatChartSeries, WebChartLineChartSeries, WebChartRadarChartSeries } from "../../spec/web-chart.js";

/** Parameters for creating a chart model. */
export type ModelParams<T extends ChartConfig> = {
  /** Layer instance associated with the chart. */
  layer?: SupportedLayer;
  /** Layer description to be used when the `layer` property is not set. */
  iLayer?: IFeatureLayer;
  /** Chart config object to be edited. If not provided, a new config will be created using default values. */
  config?: T;
};

/** Type alias for the supported serial chart config. */
export type SerialChartConfig = ChartConfig<typeof ModelTypes.BarChart> | ChartConfig<typeof ModelTypes.ComboBarLineChart> | ChartConfig<typeof ModelTypes.HeatChart> | ChartConfig<typeof ModelTypes.LineChart> | ChartConfig<typeof ModelTypes.RadarChart>;

/** Type alias for the supported serial chart series. */
export type SerialChartSeries = WebChartBarChartSeries | WebChartHeatChartSeries | WebChartLineChartSeries | WebChartRadarChartSeries;