/**
 * 执行记录类型定义
 *
 * @module types/execution
 * @author czj
 * @date 2026-07-09
 */

/** 步骤执行结果 */
export interface StepResult {
  order: number
  name: string
  status: 'passed' | 'failed' | 'skipped'
  duration: number
  screenshot?: string
  log?: string
  error?: string
}

/** 用例执行结果 */
export interface CaseResult {
  id: string
  executionId: string
  caseId: string
  caseName: string
  status: 'pending' | 'running' | 'passed' | 'failed' | 'skipped'
  duration: number
  startTime?: string
  endTime?: string
  retryCount: number
  errorMessage?: string
  stepsResult: StepResult[]
}

/** 执行记录 */
export interface Execution {
  id: string
  name: string
  triggerType: 'manual' | 'scheduled'
  triggerBy: string
  totalCases: number
  passed: number
  failed: number
  skipped: number
  passRate: number
  duration: number
  status: 'pending' | 'running' | 'completed' | 'cancelled' | 'failed'
  startTime?: string
  endTime?: string
  environment: string
  config: Record<string, any>
  createdAt: string
}