import type { WebChartDataTypes } from "../../spec/data-source.js";
import type { WebChartQuery } from "../../spec/web-chart.js";
import type { DataWarningKeywords } from "../chart-config/validator/interfaces.js";
import type { ChartSubType } from "../misc/interfaces.js";

/** @internal */
export interface DataMinMax {
  minY: number;
  maxY: number;
  minX?: number;
  maxX?: number;
}

/** @internal */
export interface DataInfo {
  valid: boolean;
  invalidType?: DataWarningKeywords;
  count?: number;
  data?: WebChartDataTypes;
  queryConfig?: WebChartQuery;
}

/** @internal */
export const BoxPlotYFieldKeys: {
    Min: string;
    FirstQuartile: string;
    Median: string;
    ThirdQuartile: string;
    Max: string;
    IQR: string;
    Average: string;
    StandardDeviation: string;
    Outlier: string;
};

/** @internal */
export type BoxPlotYFieldKeys = (typeof BoxPlotYFieldKeys)[keyof typeof BoxPlotYFieldKeys];

/** @internal */
export interface BoxPlotYValueProps {
  key: BoxPlotYFieldKeys;
  y?: string;
  chartSubType?: ChartSubType;
  splitBy?: string;
  splitByValue?: number | string | null;
  showOutliers?: boolean;
  standardizeValues?: boolean;
}

/** @internal */
export interface DataUpdateDetails {
  common?: {
      layerChanged?: boolean;
      queryChanged?: boolean;
      xOrYChanged?: boolean;
      numberOfSeriesChanged?: boolean;
      configFiltersChanged?: boolean;
      filterBySelectionChanged?: boolean;
      dataForFilterBySelectionChanged?: boolean;
      binTemporalDataChanged?: boolean;
      timeBinningChanged?: boolean;
      timeIntervalUnitChanged?: boolean;
      newTimeBinningWillBeCalculated?: boolean;
      valueFormatChangeRequiresNewData?: boolean;
  };
  histogram?: { dataPropsChanged?: boolean; };
  gauge?: { valueConversionChanged?: boolean; };
  boxPlot?: { showMeanChanged?: boolean; };
  heatChart?: {
      binningChanged?: boolean;
      hideEmptyRowsAndColumnsChanged?: boolean;
      includeLeapDay?: boolean;
  };
  scatterPlot?: { tooltipFieldsChanged?: boolean; };
}