export type WorkerStatus = "queued" | "spawning" | "running" | "done" | "error" | "cancelled"

export type WorkerRole = "department" | "team_lead" | "worker"

export interface WorkerInfo {
  id: string
  index: number
  sessionID?: string
  agent: string
  description: string
  status: WorkerStatus
  role: WorkerRole
  parentID: string | null
  childIDs: string[]
  spawned: number
  completed?: number
  tokens: { input: number; output: number; reasoning: number }
  cost: number
  output?: string
  error?: string
  background: boolean
  progress?: number
  priority: number
}

export interface PoolConfig {
  maxConcurrent: number
  retryOnError: number
  retryDelay: number
  tokenBudgetPerWorker: number
  gridCols: number
  gridRows: number
  priorityDefault: number
  smallModelPreferred: boolean
  defaultAgent: string
}

export const POOL_DEFAULTS: PoolConfig = {
  maxConcurrent: 5,
  retryOnError: 0,
  retryDelay: 1000,
  tokenBudgetPerWorker: 50_000,
  gridCols: 3,
  gridRows: 9,
  priorityDefault: 50,
  smallModelPreferred: true,
  defaultAgent: "code",
}

export interface WorkerSpawnOpts {
  agent?: string
  description: string
  prompt: string
  background?: boolean
  priority?: number
  role?: WorkerRole
  parentID?: string | null
}
