import type MapView from "@arcgis/core/views/MapView.js";
import type SceneView from "@arcgis/core/views/SceneView.js";
import type { DOMContainerAria } from "@arcgis/core/views/DOMContainer.js";
import type { JsxNode } from "@arcgis/lumina";
import type { ChartModel } from "../../model/chart-model/chart-model.js";
import type { PieSlicesSymbols, SelectionData, SeriesSymbolsMap } from "../misc/interfaces.js";
import type { WebChartDataTypes } from "../../spec/data-source.js";
import type { CalculatedMinMaxBoundsPayload, LegendItemVisibility } from "../../spec/events.js";
import type { WebChartLegendPositions } from "../../spec/chart-object-literals.js";
import type { DefaultChartActions } from "../types/index.js";

/** @internal */
export type PanelNumberChangePayload = {
  panelNumber: number;
  modelList: ChartModel[];
};

/** @internal */
export type DataChangeErrorPayload = {
  error: Error;
  model: ChartModel;
};

/** @internal */
export type PopoverChangePayload = {
  open?: boolean;
  element: JsxNode;
};

export type ModelListChangePayload = {
  modelList: ChartModel[];
};

export type DataProcessCompletePayload = {
  chartData: WebChartDataTypes;
  model?: ChartModel;
};

export type AxesMinMaxChangePayload = {
  bounds: CalculatedMinMaxBoundsPayload[];
  model?: ChartModel;
};

export type SeriesColorChangePayload = {
  data: PieSlicesSymbols | SeriesSymbolsMap;
  colorMatchApplied: boolean;
  model?: ChartModel;
};

export type NoRenderPropChangePayload = {
  propName: string;
  value?: DOMContainerAria | MapView | SceneView | WebChartLegendPositions | boolean | number;
  model?: ChartModel;
};

export type LegendItemVisibilityChangePayload = {
  legendItemVisibility: LegendItemVisibility;
  model?: ChartModel;
};

export type SelectionCompletePayload = {
  selectionData: SelectionData;
  model?: ChartModel;
};

export type DefaultActionSelectPayload = {
  actionId: DefaultChartActions;
  actionActive: boolean;
};