/**
 * Chart/Widget Data Types
 */

/**
 * Chart data point - dynamic key-value pairs for chart values
 * Example: { name: "January", sales: 100 }
 */
export type ChartDataPoint = { [key: string]: string | number };

/**
 * Chart value array (matches the locally-defined ValueType in chart components)
 */
export type ChartValueArray = ChartDataPoint[];

/**
 * Valid ApexCharts chart types
 */
export type ApexChartType =
  | 'area'
  | 'line'
  | 'bar'
  | 'pie'
  | 'scatter'
  | 'bubble'
  | 'polarArea'
  | 'radar'
  | 'donut'
  | 'radialBar'
  | 'heatmap'
  | 'candlestick'
  | 'boxPlot'
  | 'rangeBar'
  | 'rangeArea'
  | 'treemap';

/**
 * Widget result structure containing chart data
 */
export interface WidgetResult {
  value: ChartValueArray;
  label?: string;
  options?: Record<string, unknown>;
}

/**
 * Chart widget data structure used by SmartWidget components
 */
export interface ChartWidget {
  value: ChartValueArray;
  color_array?: string[];
  currency?: boolean;
  chart_type?: ApexChartType;
  label?: string;
}

/**
 * Props for chart components
 */
export interface ChartComponentProps {
  widget: ChartWidget;
}
