import type { WebChartDataItem } from "./data-source.js";
import type { WebChartAxis } from "./web-chart.js";

export const OverlayTerms: {
    readonly Mean: "Mean";
    readonly Median: "Median";
    readonly StdDev: "Standard Deviation";
    readonly Normal: "Normal Distribution";
    readonly Trendline: "Trendline";
};

export type OverlayTerms = (typeof OverlayTerms)[keyof typeof OverlayTerms];

/** Represents a subset of the event payload carrying the chart's axes bounds. */
export interface CalculatedMinMaxBoundsPayload {
  isXAxis: boolean;
  isSecondValueAxis?: boolean;
  minimum: WebChartAxis["minimum"];
  maximum: WebChartAxis["maximum"];
}

/** Represents the payload of the event sent when a chart is removed from the chart list. */
export interface ChartDeletePayload {
  chartId: string;
}

/** Represents the payload of the event sent when an item is toggled in the chart's legend (slice or series). */
export interface LegendItemVisibility {
  visible: boolean;
  seriesId?: string;
  overlayType?: OverlayTerms;
  sliceId?: string;
  sliceData?: WebChartDataItem;
}