export type RoomStatus = 'pending' | 'thinking' | 'working'
export type RoomType = 'project'
export type RoomMode = 'plan' | 'build'

export interface Room {
  id: string
  name: string
  type: RoomType
  status: RoomStatus
  master: string
  members?: string[]
  activeAgent?: string
  action?: string
  color?: string
  team?: string
  mode?: RoomMode
}

export interface Message {
  id: string | number
  agent: string
  role: 'user' | 'master' | 'member' | 'challenge' | 'artifact' | 'tool_use' | 'task_assign'
  content: string
  streaming?: boolean
  filename?: string
  title?: string
  group_id?: number
  created_at?: string
  part_type?: 'text' | 'document' | 'status'
}

export interface AgentInfo {
  name: string
}

export interface SkillMeta {
  name: string
  description: string
  path: string
}

export interface TodoItem {
  id: string
  agent: string        // 执行者
  task: string         // 任务描述
  status: 'assigned' | 'working' | 'done'
  action?: string      // 当前执行动作描述
}

export type WsEvent =
  | { type: 'agent_message'; agent: string; role: 'master' | 'member' | 'challenge' | 'tool_use'; content: string; streaming: boolean; action?: string }
  | { type: 'room_status'; status: RoomStatus; active_agent?: string; action?: string }
  | { type: 'task_assign'; from: string; to: string; task: string }
  | { type: 'task_done'; agent: string; task: string }
  | { type: 'tasks_update'; content: string }
  | { type: 'workspace_file'; filename: string; content: string }
  | { type: 'mode_change'; mode: RoomMode }
  | { type: 'artifact'; agent: string; filename: string; title?: string }
  | { type: 'schedule_run'; agent: string; content: string }
  | { type: 'token_usage'; agent: string; prompt_tokens: number; completion_tokens: number; total_tokens: number }
  | { type: 'file_read'; agent: string; filename: string }
  | { type: 'file_working'; agent: string; filename: string; title?: string }
  | { type: 'file_done'; agent: string; filename: string; title?: string }
