import type { EndpointIndex, PrefillData } from '@/lib/api-docs/agent/types'
import type { CardActions } from '../cards'

export interface ToolInvocation {
  toolCallId: string
  toolName: string
  args: Record<string, unknown>
  result?: unknown
  state: 'pending' | 'result' | 'error'
}

export interface MessageImage {
  image: string // base64 data URL
}

export interface ChatMessageProps {
  role: 'user' | 'assistant' | 'system'
  content: string
  messageId?: string
  images?: MessageImage[]
  toolInvocations?: ToolInvocation[]
  isStreaming?: boolean
  onDeleteMessage?: (messageId: string) => void
  onNavigate?: (endpointId: string) => void
  onNavigateToDocPage?: (slug: string) => void
  onOpenFile?: (path: string) => void
  cardActions?: CardActions
}

export interface UserMessageProps {
  content: string
  images?: MessageImage[]
  cardActions?: CardActions
}

export interface AssistantMessageProps {
  content: string
  messageId?: string
  toolInvocations?: ToolInvocation[]
  isStreaming?: boolean
  onDeleteMessage?: (messageId: string) => void
  onNavigate?: (endpointId: string) => void
  onNavigateToDocPage?: (slug: string) => void
  onOpenFile?: (path: string) => void
}

export interface ToolCallDisplayProps {
  tool: ToolInvocation
  onNavigate?: (endpointId: string) => void
  onNavigateToDocPage?: (slug: string) => void
  onOpenFile?: (path: string) => void
}

export interface AssistantActionBarProps {
  content: string
  messageId?: string
  onDeleteMessage?: (messageId: string) => void
}

// Re-export types for convenience
export type { EndpointIndex, PrefillData, CardActions }
