/**
 * Types for Test Dashboard
 */

export interface ServiceTestInfo {
  service: string
  display_name: string
  port?: number
  language: string
  total_tests: number
  passed_tests: number
  failed_tests: number
  skipped_tests: number
  pass_rate: number
  coverage_percent?: number
  last_run: string
  status: string
}

export interface TestRegistryStats {
  total_tests: number
  total_passed: number
  total_failed: number
  total_skipped: number
  overall_pass_rate: number
  average_coverage: number
  services_count: number
  by_category: Record<string, number>
  by_framework: Record<string, number>
}

export interface TestRun {
  id: string
  service: string
  started_at: string
  total_tests: number
  passed_tests: number
  failed_tests: number
  duration_seconds: number
  status: string
}

export interface CoverageData {
  service: string
  display_name: string
  coverage_percent: number
  language: string
}

export type TabType = 'overview' | 'unit' | 'bqas' | 'history' | 'backlog' | 'guide'

export interface Toast {
  id: number
  type: 'success' | 'error' | 'loading' | 'info'
  message: string
}

export interface FailedTest {
  id: string
  name: string
  service: string
  file_path: string
  error_message: string
  error_type: string
  suggestion: string
  run_id: string
  last_failed: string
  status: string
}

export type BacklogPriority = 'critical' | 'high' | 'medium' | 'low'
export type BacklogStatus = 'open' | 'in_progress' | 'fixed' | 'wont_fix' | 'flaky'

export interface BacklogItem {
  id: number
  test_name: string
  service: string
  test_file?: string
  error_message?: string
  error_type?: string
  fix_suggestion?: string
  priority: BacklogPriority
  status: BacklogStatus
  failure_count: number
  last_failed_at: string
}

export interface TrendDataPoint {
  date: string
  passed: number
  failed: number
  total: number
}

export interface ServiceProgress {
  current_file: string
  files_done: number
  files_total: number
  passed: number
  failed: number
  status: string
}
