export interface CandlestickData {
  time: number; // Unix timestamp in seconds
  open: number;
  high: number;
  low: number;
  close: number;
  volume?: number;
}

export interface LineData {
  time: number; // Unix timestamp in seconds
  value: number;
}

export interface VolumeData {
  time: number; // Unix timestamp in seconds
  value: number;
  color?: string;
}

export type ChartType = 'candlestick' | 'line' | 'area' | 'bar';

export type ChartInterval = 
  | '1m' 
  | '5m' 
  | '15m' 
  | '30m' 
  | '1h' 
  | '4h' 
  | '1d' 
  | '1w' 
  | '1M';

export interface ChartConfig {
  symbol: string;
  interval: ChartInterval;
  chartType: ChartType;
  showVolume: boolean;
  indicators: string[];
  theme: 'light' | 'dark';
}

export interface MarketData {
  symbol: string;
  name: string;
  price: number;
  change: number;
  changePercent: number;
  volume: number;
  high: number;
  low: number;
  open: number;
  previousClose: number;
  timestamp: string;
}

export interface ChartIndicator {
  id: string;
  name: string;
  type: 'overlay' | 'separate';
  parameters: Record<string, number>;
  visible: boolean;
}

// TradingView Lightweight Charts specific types
export interface ChartOptions {
  width?: number;
  height?: number;
  layout?: {
    background?: {
      type: 'solid' | 'gradient';
      color?: string;
    };
    textColor?: string;
    fontSize?: number;
  };
  grid?: {
    vertLines?: {
      color?: string;
      style?: number;
      visible?: boolean;
    };
    horzLines?: {
      color?: string;
      style?: number;
      visible?: boolean;
    };
  };
  crosshair?: {
    mode?: number;
    vertLine?: {
      color?: string;
      width?: number;
      style?: number;
      visible?: boolean;
      labelVisible?: boolean;
    };
    horzLine?: {
      color?: string;
      width?: number;
      style?: number;
      visible?: boolean;
      labelVisible?: boolean;
    };
  };
  timeScale?: {
    rightOffset?: number;
    barSpacing?: number;
    fixLeftEdge?: boolean;
    lockVisibleTimeRangeOnResize?: boolean;
    rightBarStaysOnScroll?: boolean;
    borderVisible?: boolean;
    borderColor?: string;
    visible?: boolean;
    timeVisible?: boolean;
    secondsVisible?: boolean;
  };
}