/**
 * Execution Runner Types
 *
 * Shared types for execution history and run responses.
 * Used by both API (apps/api) and frontend (apps/command-center).
 */

import type { ExecutionStatus } from './sse-executions'

// ============================================================================
// PAGINATION
// ============================================================================

export interface PaginationMetadata {
  total: number
  limit: number
  offset: number
  hasMore: boolean
}

// ============================================================================
// EXECUTION METRICS
// ============================================================================

export interface ExecutionMetrics {
  tokenCount?: number
  stepCount?: number
  toolCallCount?: number
}

// ============================================================================
// EXECUTION HISTORY TYPES
// ============================================================================

export interface ExecutionSummary {
  id: string
  resourceId: string
  resourceName: string
  status: ExecutionStatus
  startedAt: string
  completedAt?: string
  durationMs?: number
  metrics?: ExecutionMetrics
  input?: unknown
  output?: unknown
  error?: { message: string }
}

export interface ExecutionListResponse {
  executions: ExecutionSummary[]
  pagination: PaginationMetadata
}

// ============================================================================
// RUN RESOURCE TYPES
// ============================================================================

export interface RunResourceResponse {
  executionId: string
  status: ExecutionStatus
}
