/**
 * UI adapter types.
 *
 * These are kept as lightweight interfaces for components that render data
 * without depending directly on the generated proto message types.
 * Pages and hooks now work with the proto-generated types from src/gen/*_pb.ts
 * but child components may still accept these plain interfaces for flexibility.
 */

/** Position in a trading account */
export interface Position {
  symbol: string;
  quantity: number;
  averagePrice: number;
  marketValue: number;
  unrealizedPnl: number;
  side: 'long' | 'short';
}

/** Order submitted to the trading engine */
export interface Order {
  orderId: string;
  symbol: string;
  side: 'buy' | 'sell';
  orderType: 'market' | 'limit' | 'stop';
  quantity: number;
  price?: number;
  status: 'pending' | 'open' | 'partially_filled' | 'filled' | 'cancelled' | 'rejected';
  filledQuantity: number;
  createdAt: string;
}

/** ML model prediction (UI-facing) */
export interface MlPrediction {
  model: string;
  symbol: string;
  signal: 'buy' | 'sell' | 'hold';
  confidence: number;
  predicted_return: number;
  timestamp: string;
}

/** Training job status (UI-facing) */
export interface TrainingJob {
  jobId: string;
  modelType: string;
  status: 'queued' | 'running' | 'completed' | 'failed' | 'stopped';
  progress: number;
  epoch: number;
  totalEpochs: number;
  loss: number;
  startedAt: string;
}

/** Performance metrics (UI-facing) */
export interface PerformanceMetrics {
  totalPnl: number;
  dailyPnl: number;
  winRate: number;
  totalTrades: number;
  sharpeRatio: number;
  sortinoRatio: number;
  maxDrawdown: number;
}
