/** Chat request payload */
export interface IChatRequest {
  message: string
  conversation_id?: string
  sources?: string[]
  skill_name?: string
}

/** Chat response from API */
export interface IChatResponse {
  conversation_id: string
  message: string
  matched_skill?: string
  routing_method?: string
  confidence?: number
  task_id?: string
  status: 'completed' | 'pending'
}

/** Single chat message */
export interface IChatMessage {
  id: string
  role: 'user' | 'assistant'
  content: string
  timestamp: string
  matched_skill?: string
  routing_method?: string
  confidence?: number
  task_id?: string
  status?: 'completed' | 'pending'
}

/** Conversation with messages */
export interface IConversation {
  id: string
  title: string
  messages: IChatMessage[]
  created_at: string
  updated_at: string
}

/** Capability info */
export interface ICapabilityInfo {
  name: string
  display_name: string
  description: string
  icon: string
  enabled: boolean
  skill_count: number
}

/** Capabilities response */
export interface ICapabilitiesResponse {
  capabilities: ICapabilityInfo[]
}

/** WebSocket message types */
export type WsClientMessage = {
  type: 'chat'
  message: string
  sources?: string[]
  conversation_id?: string
}

export type WsServerMessage =
  | { type: 'routing'; skill: string; confidence: number; method: string }
  | { type: 'step'; step: string; detail?: string }
  | { type: 'result'; message: string; conversation_id: string }
  | { type: 'error'; message: string; code?: string }

/** API error */
export interface IApiError {
  status: number
  message: string
  detail?: string
}
