import type { ChartPluginSignature } from "../../models/index.mjs";
import type { ChartSeriesType, DatasetType } from "../../../../models/seriesType/config.mjs";
import type { ComputedAxis, ScaleName, AxisId, ChartsAxisData, YAxis, XAxis, DefaultedXAxis, DefaultedYAxis, AxisItemIdentifier } from "../../../../models/axis.mjs";
import type { UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.mjs";
import type { ZoomData, ZoomOptions, ZoomSliderPreviewOptions, ZoomSliderShowTooltip } from "./zoom.types.mjs";
import type { UseChartInteractionSignature } from "../useChartInteraction/index.mjs";
import type { ChartsAxisProps } from "../../../../ChartsAxis/index.mjs";
import type { UseChartBrushSignature } from "../useChartBrush/index.mjs";
/**
 * The axes' configuration after computing.
 * An axis in this state already contains a scale function and all the necessary properties to be rendered.
 */
export type ComputedAxisConfig<AxisProps extends ChartsAxisProps> = {
  [axisId: AxisId]: ComputedAxis<ScaleName, any, AxisProps>;
};
export interface UseChartCartesianAxisParameters<S extends ScaleName = ScaleName> {
  /**
   * The configuration of the x-axes.
   * If not provided, a default axis config is used.
   * An array of [[AxisConfig]] objects.
   */
  xAxis?: ReadonlyArray<XAxis<S>>;
  /**
   * The configuration of the y-axes.
   * If not provided, a default axis config is used.
   * An array of [[AxisConfig]] objects.
   */
  yAxis?: ReadonlyArray<YAxis<S>>;
  /**
   * An array of objects that can be used to populate series and axes data using their `dataKey` property.
   */
  dataset?: Readonly<DatasetType>;
  /**
   * The function called for onClick events.
   * The second argument contains information about all line/bar elements at the current mouse position.
   * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
   * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
   */
  onAxisClick?: (event: MouseEvent, data: null | ChartsAxisData) => void;
  /**
   * The function called when the pointer position corresponds to a new axis data item.
   * This update can either be caused by a pointer movement, or an axis update.
   * In case of multiple axes, the function is called if at least one axis is updated.
   * The argument contains the identifier for all axes with a `data` property.
   * @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
   */
  onHighlightedAxisChange?: (axisItems: AxisItemIdentifier[]) => void;
  /**
   * The controlled axis highlight.
   * Identified by the axis id, and data index.
   */
  highlightedAxis?: AxisItemIdentifier[];
  /**
   * The function called when the pointer position corresponds to a new axis data item.
   * This update can either be caused by a pointer movement, or an axis update.
   * In case of multiple axes, the function is called if at least one axis is updated.
   * The argument contains the identifier for all axes with a `data` property.
   * @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
   */
  onTooltipAxisChange?: (axisItems: AxisItemIdentifier[]) => void;
  /**
   * The controlled axis tooltip.
   * Identified by the axis id, and data index.
   */
  tooltipAxis?: AxisItemIdentifier[];
  /**
   * If `true`, the charts will not listen to the mouse move event.
   * It might break interactive features, but will improve performance.
   * @default false
   */
  disableAxisListener?: boolean;
  /**
   * A gap added between axes when multiple axes are rendered on the same side of the chart.
   * @default 0
   */
  axesGap?: number;
}
export type UseChartCartesianAxisDefaultizedParameters<S extends ScaleName = ScaleName> = UseChartCartesianAxisParameters<S> & Required<Pick<UseChartCartesianAxisParameters<S>, 'axesGap'>> & {
  defaultizedXAxis: DefaultedXAxis<S>[];
  defaultizedYAxis: DefaultedYAxis<S>[];
};
export interface DefaultedZoomSliderOptions extends Omit<NonNullable<Required<ZoomOptions['slider']>>, 'showTooltip' | 'preview'> {
  showTooltip: ZoomSliderShowTooltip;
  preview: boolean | ZoomSliderPreviewOptions;
}
export interface DefaultizedZoomOptions extends Required<Omit<ZoomOptions, 'slider'>> {
  axisId: AxisId;
  axisDirection: 'x' | 'y';
  slider: DefaultedZoomSliderOptions;
  reverse: boolean;
}
export interface UseChartCartesianAxisState {
  /**
   * @ignore - state populated by the useChartProZoom plugin
   */
  zoom?: {
    isInteracting: boolean;
    zoomData: readonly ZoomData[];
  };
  cartesianAxis: {
    axesGap: number;
    x: DefaultedXAxis[];
    y: DefaultedYAxis[];
  };
  /**
   * The controlled axis item highlighted.
   */
  controlledCartesianAxisHighlight?: AxisItemIdentifier[];
  /**
   * The controlled axis tooltip.
   */
  controlledCartesianAxisTooltip?: AxisItemIdentifier[];
}
export type ExtremumFilter = (value: {
  x: number | Date | string | null;
  y: number | Date | string | null;
}, dataIndex: number) => boolean;
export type UseChartCartesianAxisSignature<SeriesType extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
  params: UseChartCartesianAxisParameters;
  defaultizedParams: UseChartCartesianAxisDefaultizedParameters;
  state: UseChartCartesianAxisState;
  dependencies: [UseChartSeriesSignature<SeriesType>];
  optionalDependencies: [UseChartInteractionSignature, UseChartBrushSignature];
}>;