/**
 * Checkpoint System types
 *
 * Validation rules, checkpoint definitions, and checkpoint status
 * for the SDK's progress-gate system.
 */

import type { CheckpointType, ReviewerType, ValidationSeverity } from './core'

// =============================================================================
// VALIDATION
// =============================================================================

export interface ValidationRule {
  id: string
  field: string
  condition: 'NOT_EMPTY' | 'MIN_COUNT' | 'MIN_VALUE' | 'CUSTOM' | 'REGEX'
  value?: number | string
  message: string
  severity: ValidationSeverity
}

export interface ValidationError {
  ruleId: string
  field: string
  message: string
  severity: ValidationSeverity
}

// =============================================================================
// CHECKPOINT
// =============================================================================

export interface Checkpoint {
  id: string
  step: string
  name: string
  type: CheckpointType
  validation: ValidationRule[]
  blocksProgress: boolean
  requiresReview: ReviewerType
  autoValidate: boolean
}

export interface CheckpointStatus {
  checkpointId: string
  passed: boolean
  validatedAt: Date | null
  validatedBy: string | null
  errors: ValidationError[]
  warnings: ValidationError[]
  overrideReason?: string
  overriddenBy?: string
  overriddenAt?: Date
}
