'use client' import React from 'react' import { AI_RISK_CRITERIA, AIUseCaseRiskCriterion } from '@/lib/sdk/dsfa/ai-use-case-types' interface AIRiskCriteriaChecklistProps { criteria: AIUseCaseRiskCriterion[] onChange: (updated: AIUseCaseRiskCriterion[]) => void readonly?: boolean } const SEVERITY_LABELS: Record = { low: 'Niedrig', medium: 'Mittel', high: 'Hoch', } const SEVERITY_COLORS: Record = { low: 'bg-green-100 text-green-700 border-green-200', medium: 'bg-yellow-100 text-yellow-700 border-yellow-200', high: 'bg-red-100 text-red-700 border-red-200', } export function AIRiskCriteriaChecklist({ criteria, onChange, readonly }: AIRiskCriteriaChecklistProps) { const appliedCount = criteria.filter(c => c.applies).length const updateCriterion = (id: string, updates: Partial) => { onChange(criteria.map(c => c.id === id ? { ...c, ...updates } : c)) } return (
{/* Summary Banner */} {appliedCount > 0 && (
= 3 ? 'bg-red-50 border-red-200 text-red-700' : appliedCount >= 2 ? 'bg-orange-50 border-orange-200 text-orange-700' : 'bg-yellow-50 border-yellow-200 text-yellow-700' }`}> {appliedCount} von 6 Risikokriterien erfüllt {appliedCount >= 2 && ' – DSFA ist erforderlich'} {appliedCount >= 4 && ' – behördliche Konsultation prüfen'}
)} {/* Criteria Cards */}
{AI_RISK_CRITERIA.map(critDef => { const criterion = criteria.find(c => c.id === critDef.id) || { id: critDef.id, applies: false, severity: critDef.default_severity, } return (
{/* Checkbox */} updateCriterion(critDef.id, { applies: e.target.checked })} disabled={readonly} className="mt-1 h-4 w-4 rounded border-gray-300 text-purple-600 focus:ring-purple-500" />
{critDef.label} {SEVERITY_LABELS[criterion.severity]} {critDef.gdpr_ref.split(',')[0]}

{critDef.description}

{/* Justification (shown when applies) */} {criterion.applies && (