export interface Message {
  id: string;
  conversation_id: string;
  role: "user" | "assistant";
  content: string;
  content_type: "text";
  reasoning_content?: string | null;
  tool_calls?: ToolCallRecord[];
  created_at: string;
}

export interface ToolCallRecord {
  id: string;
  name: string;
  arguments: Record<string, unknown>;
  output?: Record<string, unknown> | null;
  error?: string | null;
  status: string;
  elapsed_ms?: number | null;
}

export interface Conversation {
  id: string;
  title: string;
  session_id: string;
}

export type Phase = "idle" | "think" | "answer" | "act" | "summarize" | "completed";

export interface ToolCallState {
  toolCallId: string;
  toolName: string;
  arguments: string;
  output?: string;
  error?: string | null;
}

export interface StreamingState {
  phase: Phase;
  thinkText: string;
  answerText: string;
  toolCalls: ToolCallState[];
}

/** Empty streaming state used for resetting. */
export const EMPTY_STREAM: StreamingState = {
  phase: "idle",
  thinkText: "",
  answerText: "",
  toolCalls: [],
};
