/**
 * Provider-agnostic chat interface.
 *
 * Both `claude-code` (OAuth subprocess) and `openrouter` (HTTP fetch) implement
 * this. The orchestrator in `./index.ts` picks one based on CHAT_PROVIDER + falls
 * back on rate-limits / errors.
 */
export interface ChatTurn {
  role: "user" | "assistant" | "system";
  content: string;
}

export interface ChatRequest {
  system: string;
  messages: ChatTurn[];
  maxTokens?: number;
}

export interface ChatResponse {
  provider: "claude-code" | "openrouter";
  model: string;
  content: string;
  tokensIn?: number;
  tokensOut?: number;
  costUsd?: number;
  durationMs: number;
}

export interface ChatProvider {
  readonly name: "claude-code" | "openrouter";
  readonly isAvailable: () => boolean;
  readonly send: (req: ChatRequest) => Promise<ChatResponse>;
}
