/**
 * Neural Command Center — Shared Types
 * 2026-04-06 Claude Code: Sprint 3 SSH_COMMAND 指揮權鏈
 */

export interface AutoRepairStats {
  approved_playbooks: number
  high_quality_playbooks: number
  total_executions: number
  overall_success_rate: number
  auto_repair_eligible: boolean
}

export interface PlaybookItem {
  playbook_id: string
  name: string
  status: string
  tags: string[]
  success_count: number
  failure_count: number
  ai_confidence: number
  approved_by: string | null
  last_used_at: string | null
}

export type UriScheme = 'kubectl://' | 'openclaw://' | 'ansible://'
export type RepairStatus = 'success' | 'failed' | 'pending_approval' | 'running'

export interface RepairHistoryItem {
  id: string
  incident_id: string
  playbook_id: string
  playbook_name: string
  action_type: 'kubectl' | 'ssh_command' | 'manual'
  uri_scheme: UriScheme
  command: string
  status: RepairStatus
  executed_at: string
  duration_ms: number | null
  error: string | null
  rag_confidence: number | null
}

export type NeuralTab = 'preflight' | 'live' | 'stats' | 'approval'

export interface PendingApprovalItem {
  id: string
  action: string
  description: string
  status: string
  risk_level: string
  blast_radius: {
    affected_pods: number
    estimated_downtime: string
    related_services: string[]
    data_impact: string
  }
  dry_run_checks: Array<{ name: string; passed: boolean; message?: string }>
  requested_by: string
  created_at: string
  incident_id?: string | null
}

export interface ActiveIncident {
  incident_id: string
  status: string
  severity: string
  signal_count: number
  affected_services: string[]
  created_at: string
}
