'use client' /** * AgentPflichtTable — die geprüften Pflichtangaben als menschliche Tabelle: * Status-Icon + Feldname + tatsächlich gefundener Text. Ersetzt die alte * MC-ID-Liste. * * WICHTIG: zeigt NIE die mc_id (Reverse-Engineering-Schutz der MC-Bibliothek) * — nur das menschliche `label`. Generisch für jeden Agenten verwendbar. */ import React from 'react' import type { McCoverage } from './_agentTypes' const DISP: Record = { ok: { icon: '✓', text: 'vorhanden', color: '#16a34a' }, high: { icon: '✗', text: 'fehlt', color: '#dc2626' }, medium: { icon: '✗', text: 'fehlt', color: '#d97706' }, low: { icon: '✗', text: 'fehlt', color: '#2563eb' }, possibly_applicable: { icon: '?', text: 'zu prüfen', color: '#ca8a04' }, insufficient_evidence: { icon: '?', text: 'unklar', color: '#64748b' }, na: { icon: '–', text: 'nicht anwendbar', color: '#94a3b8' }, skipped: { icon: '–', text: 'nicht geprüft', color: '#cbd5e1' }, } // Reihenfolge: Probleme zuerst, dann erfüllt, dann n/a. const RANK: Record = { high: 0, medium: 1, low: 2, possibly_applicable: 3, insufficient_evidence: 4, ok: 5, na: 6, skipped: 7, } export function AgentPflichtTable({ coverage }: { coverage: McCoverage[] }) { if (!coverage?.length) return null const rows = [...coverage].sort( (a, b) => (RANK[a.status] ?? 9) - (RANK[b.status] ?? 9), ) const count = (s: string) => coverage.filter(c => c.status === s).length const ok = count('ok') const fehlt = count('high') + count('medium') + count('low') const pruefen = count('possibly_applicable') + count('insufficient_evidence') const na = count('na') + count('skipped') return (
Pflichtangaben — {ok} vorhanden {fehlt > 0 && <> · {fehlt} fehlt} {pruefen > 0 && ( <> · {pruefen} zu prüfen )} {na > 0 && <> · {na} n/a}
{rows.map((c, i) => { const d = DISP[c.status] || DISP.skipped return (
{d.icon} {c.label || 'Angabe'} {c.status === 'ok' ? ( {c.found || 'vorhanden'} ) : ( {d.text} )}
) })}
) }