/**
 * Type definitions for Recharts payloads
 * Provides type-safe alternatives to `any` in chart components
 */

import type { ReactNode } from 'react';

/**
 * Generic chart payload item structure
 */
export interface ChartPayloadItem<T = unknown> {
  value?: number | string;
  name?: string;
  dataKey?: string;
  color?: string;
  fill?: string;
  payload?: T;
  [key: string]: unknown;
}

/**
 * Tooltip content props from Recharts
 */
export interface TooltipProps<T = unknown> {
  active?: boolean;
  payload?: ChartPayloadItem<T>[];
  label?: string | number;
  labelFormatter?: (value: unknown, payload: ChartPayloadItem<T>[]) => ReactNode;
  formatter?: (
    value: number | string,
    name: string,
    item: ChartPayloadItem<T>,
    index: number,
    payload: unknown
  ) => ReactNode;
  className?: string;
  indicator?: 'line' | 'dot' | 'dashed';
  hideLabel?: boolean;
  hideIndicator?: boolean;
  color?: string;
  nameKey?: string;
  labelKey?: string;
  labelClassName?: string;
}

/**
 * Legend content props from Recharts
 */
export interface LegendProps<T = unknown> {
  payload?: ChartPayloadItem<T>[];
  className?: string;
  hideIcon?: boolean;
  nameKey?: string;
  verticalAlign?: 'top' | 'bottom';
}
