import type {
  PromptContentPart,
  ToolFailureKind,
  ToolInputValue,
  ToolResultOutcome,
} from "@best-agent/protocol";

export interface UserConversationMessage {
  role: "user";
  content: string;
  contentParts?: PromptContentPart[];
}

export interface ConversationToolCall {
  input: ToolInputValue;
  /** @deprecated use inputStableDigest. */
  inputDigest?: string;
  inputStableDigest?: string;
  providerToolName?: string;
  toolCallId: string;
  toolName: string;
}

export interface AssistantConversationMessage {
  role: "assistant";
  content: string;
  toolCalls?: ConversationToolCall[];
}

export interface ToolConversationMessage {
  role: "tool";
  content: string;
  errorCode?: string;
  failureKind?: ToolFailureKind;
  outcome: ToolResultOutcome;
  providerToolName?: string;
  toolCallId: string;
  toolName: string;
}

export interface RuntimeConversationMessage {
  role: "runtime";
  content: string;
  code: string;
  severity: "warning" | "error";
}

export type ConversationMessage =
  | AssistantConversationMessage
  | RuntimeConversationMessage
  | ToolConversationMessage
  | UserConversationMessage;
