import { Requirement as SDKRequirement, RequirementStatus, RiskSeverity } from '@/lib/sdk'

export type DisplayPriority = 'critical' | 'high' | 'medium' | 'low'
export type DisplayStatus = 'compliant' | 'partial' | 'non-compliant' | 'not-applicable'

export interface DisplayRequirement extends SDKRequirement {
  code: string
  source: string
  category: string
  priority: DisplayPriority
  displayStatus: DisplayStatus
  controlsLinked: number
  evidenceCount: number
}

export function mapCriticalityToPriority(criticality: RiskSeverity): DisplayPriority {
  switch (criticality) {
    case 'CRITICAL': return 'critical'
    case 'HIGH': return 'high'
    case 'MEDIUM': return 'medium'
    case 'LOW': return 'low'
    default: return 'medium'
  }
}

export function mapStatusToDisplayStatus(status: RequirementStatus): DisplayStatus {
  switch (status) {
    case 'VERIFIED':
    case 'IMPLEMENTED': return 'compliant'
    case 'IN_PROGRESS': return 'partial'
    case 'NOT_STARTED': return 'non-compliant'
    default: return 'non-compliant'
  }
}

export interface AddRequirementData {
  regulation: string
  article: string
  title: string
  description: string
  criticality: RiskSeverity
}
