'use client' /** * ValidationReport - Strukturierte Anzeige von Validierungsergebnissen * * Errors (Scope-Violations) in Rot * Warnings (Inkonsistenzen) in Amber * Suggestions in Blau */ import { DOCUMENT_TYPE_LABELS } from '@/lib/sdk/compliance-scope-types' import type { ValidationResult, ValidationFinding } from '@/lib/sdk/drafting-engine/types' interface ValidationReportProps { result: ValidationResult onClose: () => void /** Compact mode for inline display in widget */ compact?: boolean } const SEVERITY_CONFIG = { error: { bg: 'bg-red-50', border: 'border-red-200', text: 'text-red-700', icon: 'M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z', label: 'Fehler', dotColor: 'bg-red-500', }, warning: { bg: 'bg-amber-50', border: 'border-amber-200', text: 'text-amber-700', icon: 'M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z', label: 'Warnungen', dotColor: 'bg-amber-500', }, suggestion: { bg: 'bg-blue-50', border: 'border-blue-200', text: 'text-blue-700', icon: 'M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z', label: 'Vorschlaege', dotColor: 'bg-blue-500', }, } function FindingCard({ finding, compact }: { finding: ValidationFinding; compact?: boolean }) { const config = SEVERITY_CONFIG[finding.severity] const docLabel = DOCUMENT_TYPE_LABELS[finding.documentType]?.split(' (')[0] || finding.documentType if (compact) { return (

{finding.title}

{finding.description}

) } return (

{finding.title}

{docLabel}

{finding.description}

{finding.crossReferenceType && (

Cross-Referenz: {DOCUMENT_TYPE_LABELS[finding.crossReferenceType]?.split(' (')[0] || finding.crossReferenceType}

)} {finding.legalReference && (

{finding.legalReference}

)} {finding.suggestion && (

{finding.suggestion}

)}
) } export function ValidationReport({ result, onClose, compact }: ValidationReportProps) { const totalFindings = result.errors.length + result.warnings.length + result.suggestions.length if (compact) { return (
{result.passed ? 'Validierung bestanden' : 'Validierung fehlgeschlagen'} ({totalFindings} {totalFindings === 1 ? 'Fund' : 'Funde'})
{result.errors.map((f) => )} {result.warnings.map((f) => )} {result.suggestions.map((f) => )}
) } return (
{/* Summary Header */}

{result.passed ? 'Validierung bestanden' : 'Validierung fehlgeschlagen'}

Level {result.scopeLevel} | {new Date(result.timestamp).toLocaleString('de-DE')}

{/* Stats */}
{result.errors.length > 0 && (
{result.errors.length}
)} {result.warnings.length > 0 && (
{result.warnings.length}
)} {result.suggestions.length > 0 && (
{result.suggestions.length}
)}
{/* Errors */} {result.errors.length > 0 && (

Fehler ({result.errors.length})

{result.errors.map((f) => )}
)} {/* Warnings */} {result.warnings.length > 0 && (

Warnungen ({result.warnings.length})

{result.warnings.map((f) => )}
)} {/* Suggestions */} {result.suggestions.length > 0 && (

Vorschlaege ({result.suggestions.length})

{result.suggestions.map((f) => )}
)}
) }