declare global {
  interface Window {
    anychart: {
      onDocumentReady: (callback: () => void) => void;
      box: () => BoxChart;
      column: () => ColumnChart;
      data: {
        loadJsonFile: (url: string, callback: (data: any) => void) => void;
      };
    };
  }
}

interface BoxChart {
  [key: string]: any;
  title: (text?: string) => ChartTitle;
  yAxis: () => Axis;
  xAxis: () => Axis;
  yScale: () => Scale;
  background: () => Background;
  container: (element: HTMLElement) => void;
  draw: () => void;
  dispose: () => void;
  box: (data: any[]) => BoxSeries;
}

interface ColumnChart {
  [key: string]: any;
  title: (text?: string) => ChartTitle;
  yAxis: () => Axis;
  xAxis: () => Axis;
  yScale: () => Scale;
  background: () => Background;
  container: (element: HTMLElement) => void;
  draw: () => void;
  dispose: () => void;
  column: (data: any) => ColumnSeries;
  data: (data?: any[]) => ColumnDataSet;
  legend: () => Legend;
}

interface ColumnDataSet {
  mapAs: (fields: { x: string; value: string }, filter?: { series: string }) => any;
}

interface ColumnSeries {
  [key: string]: any;
  name: (name: string) => ColumnSeries;
  fill: (color: string, opacity?: number) => ColumnSeries;
  stroke: (color: string, width?: number) => ColumnSeries;
  tooltip: () => Tooltip;
}

interface BoxSeries {
  [key: string]: any;
  whiskerWidth: (width: string) => BoxSeries;
  fill: (color: string, opacity?: number) => BoxSeries;
  stroke: (color: string, width?: number) => BoxSeries;
  whiskerStroke: (color: string, width?: number) => BoxSeries;
  medianStroke: (color: string, width?: number) => BoxSeries;
  tooltip: () => Tooltip;
}

interface ChartTitle {
  [key: string]: any;
  fontColor: (color: string) => ChartTitle;
  fontSize: (size: number) => ChartTitle;
}

interface Axis {
  [key: string]: any;
  title: (text?: string) => Axis;
  labels: () => AxisLabels;
  staggerMode: (enabled: boolean) => Axis;
}

interface AxisLabels {
  format: (format: string) => AxisLabels;
}

interface Scale {
  [key: string]: any;
  inverted: (inverted: boolean) => Scale;
}

interface Grid {
  [key: string]: any;
  stroke: (color: string, width?: number, dash?: string) => Grid;
  layout: (layout: string) => Grid;
}

interface Background {
  [key: string]: any;
  fill: (color: string) => Background;
}

interface Tooltip {
  [key: string]: any;
  format: (format: string) => Tooltip;
}

interface Legend {
  [key: string]: any;
  enabled: (enabled: boolean) => Legend;
  fontSize: (size: number) => Legend;
  padding: (padding: number[]) => Legend;
}

interface ColumnDataPoint {
  x: string;
  value: number;
  series: string;
}

export {}; 