/**
 * Command Queue SSE Event Types
 *
 * Type-safe definitions for command queue related SSE events
 */

import type { Task } from './types/task'

/**
 * Event sent when command queue task is updated
 */
export interface CommandQueueTaskUpdatedEvent {
  type: 'task_updated'
  timestamp: number
  data: {
    task: Task
  }
}

/**
 * Connection confirmation event
 */
export interface CommandQueueConnectedEvent {
  type: 'connected'
  timestamp: number
  data?: undefined
}

/**
 * Event sent when action execution completes successfully
 */
export interface CommandQueueExecutionCompletedEvent {
  type: 'execution_completed'
  timestamp: number
  data: {
    taskId: string
    targetExecutionId: string
  }
}

/**
 * Event sent when action execution fails
 */
export interface CommandQueueExecutionFailedEvent {
  type: 'execution_failed'
  timestamp: number
  data: {
    taskId: string
    targetExecutionId?: string
    error: string
  }
}

/**
 * Union of all command queue SSE events
 */
export type CommandQueueSSEEvent =
  | CommandQueueTaskUpdatedEvent
  | CommandQueueConnectedEvent
  | CommandQueueExecutionCompletedEvent
  | CommandQueueExecutionFailedEvent
