export type AgentStatus =
  | "connecting"
  | "error"
  | "idle"
  | "streaming"
  | "submitted";

export type ConversationPart =
  | {
      readonly state: "done" | "streaming";
      readonly text: string;
      readonly type: "text";
    }
  | {
      readonly state: "done" | "streaming";
      readonly text: string;
      readonly type: "reasoning";
    }
  | {
      readonly filename?: string;
      readonly id?: string;
      readonly mediaType: string;
      readonly type: "file";
      readonly url?: string;
    };

export interface ConversationMessage {
  readonly id: string;
  readonly parts: ConversationPart[];
  readonly role: "assistant" | "user";
}

export interface ChatAgentState {
  error?: Error;
  historyReady: boolean;
  messages: ConversationMessage[];
  sendMessage: (
    message: string,
    options?: { readonly images?: readonly File[] }
  ) => Promise<void>;
  status: AgentStatus;
}

export interface ChatComposerProps {
  error?: Error;
  onSend: (message: string) => Promise<void>;
  status: AgentStatus;
}

export interface ChatConversationProps {
  historyReady: boolean;
  messages: ConversationMessage[];
  onSuggestion: (suggestion: string) => void;
  status: AgentStatus;
}

export interface ChatHeaderProps {
  status: AgentStatus;
}

export interface ChatMessageProps {
  message: ConversationMessage;
}

export type AssistantResponseState = "thinking" | "writing";
