/**
 * Agent type definitions for spawning
 */
export type AgentType = "worker" | "reviewer" | "tester";

/**
 * Agent lifecycle states
 */
export type AgentState = "spawning" | "running" | "completed" | "failed" | "killed";

/**
 * Context provided to the agent for task execution
 */
export interface AgentContext {
  /** Git repository URL or path */
  repository: string;
  /** Git branch to work on */
  branch: string;
  /** Work items for the agent to complete */
  workItems: string[];
  /** Optional skills to load */
  skills?: string[];
}

/**
 * Options for spawning an agent
 */
export interface SpawnAgentOptions {
  /** Enable Docker sandbox isolation */
  sandbox?: boolean;
  /** Timeout in milliseconds */
  timeout?: number;
  /** Maximum retry attempts */
  maxRetries?: number;
}

/**
 * Request payload for spawning an agent
 */
export interface SpawnAgentRequest {
  /** Unique task identifier */
  taskId: string;
  /** Optional parent session identifier for subagent lineage */
  parentAgentId?: string;
  /** Type of agent to spawn */
  agentType: AgentType;
  /** Context for task execution */
  context: AgentContext;
  /** Optional configuration */
  options?: SpawnAgentOptions;
}

/**
 * Response from spawning an agent
 */
export interface SpawnAgentResponse {
  /** Unique agent identifier */
  agentId: string;
  /** Current agent state */
  state: AgentState;
  /** Timestamp when agent was spawned */
  spawnedAt: Date;
}

/**
 * Agent session metadata
 */
export interface AgentSession {
  /** Unique agent identifier */
  agentId: string;
  /** Task identifier */
  taskId: string;
  /** Agent type */
  agentType: AgentType;
  /** Current state */
  state: AgentState;
  /** Context */
  context: AgentContext;
  /** Options */
  options?: SpawnAgentOptions;
  /** Spawn timestamp */
  spawnedAt: Date;
  /** Completion timestamp */
  completedAt?: Date;
  /** Error if failed */
  error?: string;
  /** Docker container ID if sandbox is enabled */
  containerId?: string;
}
