/**
 * SystemInfoSection Configurations
 *
 * Pre-defined configurations for each admin module.
 * Extracted from SystemInfoSection.tsx for better maintainability.
 */

import type { SystemInfoConfig } from './types'

export const SYSTEM_INFO_CONFIGS: Record<string, SystemInfoConfig> = {
  // Dashboard
  dashboard: {
    title: 'Dashboard System-Info',
    description: 'Zentrale Uebersicht aller BreakPilot-Module und deren Status.',
    version: '2.0',
    architecture: {
      layers: [
        { title: 'Frontend (Next.js 15)', components: ['Dashboard UI', 'Chart.js', 'Realtime Updates'], color: '#3b82f6' },
        { title: 'API Gateway', components: ['Next.js API Routes', 'Auth Middleware', 'Rate Limiting'], color: '#8b5cf6' },
        { title: 'Microservices', components: ['Consent Service', 'Klausur Service', 'School Service'], color: '#10b981' },
        { title: 'Datenbanken', components: ['PostgreSQL', 'Qdrant', 'Valkey (Redis)'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Service Health Monitoring', status: 'active', description: 'Echtzeit-Status aller Microservices' },
      { name: 'Metriken-Aggregation', status: 'active', description: 'Zusammenfassung wichtiger KPIs' },
      { name: 'Alerting System', status: 'planned', description: 'Benachrichtigungen bei Problemen' },
      { name: 'Custom Dashboards', status: 'planned', description: 'Benutzerdefinierte Dashboard-Layouts' },
    ],
    roadmap: [
      { phase: 'Phase 1: Monitoring (Q1)', priority: 'high', items: ['Prometheus Integration', 'Grafana Dashboards', 'Service Health Checks', 'Error Rate Tracking'] },
      { phase: 'Phase 2: Alerting (Q2)', priority: 'medium', items: ['Slack/Teams Integration', 'E-Mail Alerts', 'Eskalations-Regeln', 'On-Call Rotation'] },
      { phase: 'Phase 3: Analytics (Q3)', priority: 'low', items: ['Usage Analytics', 'Cost Tracking', 'Trend-Analysen', 'Kapazitaetsplanung'] },
    ],
    technicalDetails: [
      { component: 'Frontend', technology: 'Next.js', version: '15.x', description: 'React Server Components' },
      { component: 'Styling', technology: 'Tailwind CSS', version: '3.x', description: 'Utility-first CSS' },
      { component: 'State', technology: 'React Hooks', version: '19.x', description: 'Lokaler State' },
      { component: 'Charts', technology: 'Chart.js', version: '4.x', description: 'Datenvisualisierung' },
    ],
  },

  // GPU Infrastruktur
  gpu: {
    title: 'GPU Infrastruktur System-Info',
    description: 'vast.ai GPU-Management fuer KI-Workloads und Training.',
    version: '1.5',
    privacyNotes: [
      'GPU-Workloads werden isoliert in Docker-Containern ausgefuehrt',
      'Keine persistente Speicherung von Trainingsdaten auf GPU-Instanzen',
      'SSH-Keys werden regelmaessig rotiert',
      'Audit-Log fuer alle GPU-Operationen',
    ],
    architecture: {
      layers: [
        { title: 'Admin UI', components: ['GPU Dashboard', 'Instance Manager', 'Cost Calculator'], color: '#3b82f6' },
        { title: 'vast.ai API', components: ['Instance API', 'Billing API', 'SSH Management'], color: '#8b5cf6' },
        { title: 'GPU Instances', components: ['RTX 4090', 'A100', 'H100'], color: '#10b981' },
        { title: 'Workloads', components: ['Model Training', 'Inference', 'Fine-Tuning'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Instance Management', status: 'active', description: 'Start/Stop/Destroy von GPU-Instanzen' },
      { name: 'SSH Key Management', status: 'active', description: 'Automatische SSH-Key Rotation' },
      { name: 'Cost Tracking', status: 'active', description: 'Echtzeit-Kostenüberwachung' },
      { name: 'Auto-Scaling', status: 'planned', description: 'Automatische Skalierung bei Last' },
      { name: 'Spot Instance Management', status: 'planned', description: 'Kostenoptimierung durch Spot-Instances' },
    ],
    roadmap: [
      { phase: 'Phase 1: Automation (Q1)', priority: 'high', items: ['Auto-Start bei Bedarf', 'Auto-Stop bei Inaktivitaet', 'Scheduled Instances', 'Budget Alerts'] },
      { phase: 'Phase 2: Multi-Cloud (Q2)', priority: 'medium', items: ['Lambda Labs Integration', 'RunPod Integration', 'Cloud-uebergreifende Orchestrierung', 'Preisvergleich'] },
      { phase: 'Phase 3: ML Ops (Q3)', priority: 'medium', items: ['Model Registry', 'Experiment Tracking', 'A/B Testing', 'Model Versioning'] },
    ],
    technicalDetails: [
      { component: 'API', technology: 'vast.ai REST API', version: 'v1', description: 'GPU-Marktplatz' },
      { component: 'SSH', technology: 'OpenSSH', version: '9.x', description: 'Sichere Verbindung' },
      { component: 'Container', technology: 'Docker', version: '24.x', description: 'Workload-Isolation' },
      { component: 'ML Framework', technology: 'PyTorch', version: '2.x', description: 'Model Training' },
    ],
    auditInfo: [
      {
        category: 'Sicherheit & Zugriffskontrolle',
        items: [
          { label: 'Authentifizierung', value: 'API-Key + SSH-Key', status: 'ok' },
          { label: 'Verschluesselung', value: 'TLS 1.3', status: 'ok' },
          { label: 'Key Rotation', value: 'Alle 30 Tage', status: 'ok' },
          { label: 'Audit-Log', value: 'Aktiviert', status: 'ok' },
        ],
      },
      {
        category: 'Kosten & Ressourcen',
        items: [
          { label: 'Budget-Limit', value: 'Konfigurierbar', status: 'ok' },
          { label: 'Auto-Shutdown', value: '30 Min Inaktivitaet', status: 'ok' },
          { label: 'Spot-Instances', value: 'Geplant', status: 'warning' },
          { label: 'Multi-Cloud', value: 'Geplant', status: 'warning' },
        ],
      },
      {
        category: 'Compliance',
        items: [
          { label: 'Daten-Residenz', value: 'EU/US waehlbar', status: 'ok' },
          { label: 'DSGVO-Konformitaet', value: 'Ja', status: 'ok' },
          { label: 'SOC 2 Type II', value: 'vast.ai zertifiziert', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>GPU Infrastructure Management</h2>

<h3>1. Uebersicht</h3>
<p>Das GPU-Infrastruktur-Modul ermoeglicht die Verwaltung von Cloud-GPU-Ressourcen ueber vast.ai fuer KI-Workloads wie Model Training, Fine-Tuning und Inference.</p>

<h3>2. Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────┐
│                      Admin Dashboard                         │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐ │
│  │ Start/Stop  │  │   Status    │  │   Cost Tracking     │ │
│  └──────┬──────┘  └──────┬──────┘  └──────────┬──────────┘ │
└─────────┼───────────────┼─────────────────────┼─────────────┘
          │               │                     │
          v               v                     v
┌─────────────────────────────────────────────────────────────┐
│                      Backend API                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  /infra/vast/*  -  vast.ai Proxy mit Auth           │   │
│  └─────────────────────────────────────────────────────┘   │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           v
┌─────────────────────────────────────────────────────────────┐
│                      vast.ai Cloud                           │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐    │
│  │ RTX 4090 │  │   A100   │  │   H100   │  │ RTX 3090 │    │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘    │
└─────────────────────────────────────────────────────────────┘
</pre>

<h3>3. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/infra/vast/status</td><td>GET</td><td>Aktueller Status der GPU-Instanz</td></tr>
  <tr><td>/infra/vast/power/on</td><td>POST</td><td>GPU-Instanz starten</td></tr>
  <tr><td>/infra/vast/power/off</td><td>POST</td><td>GPU-Instanz stoppen</td></tr>
  <tr><td>/infra/vast/audit</td><td>GET</td><td>Audit-Log der letzten Aktionen</td></tr>
</table>

<h3>4. Sicherheitskonzept</h3>
<ul>
  <li><strong>Authentifizierung:</strong> API-Key basiert, keine Benutzer-Credentials auf GPU</li>
  <li><strong>SSH-Zugriff:</strong> Key-basiert, automatische Rotation alle 30 Tage</li>
  <li><strong>Netzwerk:</strong> Isolierte VPC, nur definierte Ports offen</li>
  <li><strong>Datenpersistenz:</strong> Ephemeral Storage, keine persistenten Volumes</li>
</ul>

<h3>5. Kostenmanagement</h3>
<table>
  <tr><th>GPU</th><th>Preis/Stunde</th><th>VRAM</th><th>Use Case</th></tr>
  <tr><td>RTX 4090</td><td>~$0.40</td><td>24 GB</td><td>Training, Inference</td></tr>
  <tr><td>A100</td><td>~$1.50</td><td>80 GB</td><td>Large Model Training</td></tr>
  <tr><td>H100</td><td>~$3.00</td><td>80 GB</td><td>Enterprise Training</td></tr>
</table>

<h3>6. Auto-Shutdown Policy</h3>
<p>GPU-Instanzen werden automatisch nach 30 Minuten Inaktivitaet gestoppt, um Kosten zu sparen. Bei jedem LLM-Request wird die Aktivitaet aufgezeichnet.</p>

<h3>7. Audit-relevante Informationen</h3>
<ul>
  <li>Alle Start/Stop-Aktionen werden mit Timestamp und User-ID geloggt</li>
  <li>Kostenabrechnung erfolgt minutengenau</li>
  <li>SSH-Key Rotation wird dokumentiert</li>
  <li>Fehlgeschlagene Operationen werden mit Error-Details gespeichert</li>
</ul>

<h3>8. Notfallprozeduren</h3>
<ol>
  <li><strong>Bei Kostenüberschreitung:</strong> Automatischer Stop aller Instanzen</li>
  <li><strong>Bei API-Ausfall:</strong> Fallback auf manuelles vast.ai Dashboard</li>
  <li><strong>Bei Sicherheitsvorfall:</strong> Sofortiges Destroy aller Instanzen</li>
</ol>
`,
  },

  // Consent Verwaltung
  consent: {
    title: 'Consent Management System-Info',
    description: 'DSGVO-konforme Verwaltung von Einwilligungen und rechtlichen Dokumenten.',
    version: '3.0',
    privacyNotes: [
      'Alle Consent-Daten werden verschluesselt gespeichert',
      'Audit-Trail fuer alle Aenderungen',
      'Automatische Datenlöschung nach Widerruf',
      'DSGVO Art. 7 konforme Einwilligungsverwaltung',
    ],
    architecture: {
      layers: [
        { title: 'Frontend', components: ['Consent Banner', 'Praeferenz-Center', 'Admin UI'], color: '#3b82f6' },
        { title: 'Consent Service (Go)', components: ['Consent API', 'Version Control', 'Audit Logger'], color: '#00ADD8' },
        { title: 'Backend (Python)', components: ['GDPR Export', 'Analytics', 'Reporting'], color: '#3776AB' },
        { title: 'PostgreSQL', components: ['Consents', 'Documents', 'Audit Logs'], color: '#336791' },
      ],
    },
    features: [
      { name: 'Dokumenten-Versionierung', status: 'active', description: 'Vollstaendige Historie aller Versionen' },
      { name: 'Multi-Mandanten', status: 'active', description: 'Tenant-isolierte Consent-Verwaltung' },
      { name: 'Approval Workflow', status: 'active', description: 'DSB-Freigabe fuer neue Versionen' },
      { name: 'A/B Testing', status: 'planned', description: 'Consent-Rate Optimierung' },
      { name: 'Analytics Dashboard', status: 'planned', description: 'Consent-Metriken und Trends' },
    ],
    roadmap: [
      { phase: 'Phase 1: Compliance (Q1)', priority: 'high', items: ['TCF 2.2 Integration', 'IAB GPP Support', 'Cookie Scanning', 'Compliance Reports'] },
      { phase: 'Phase 2: UX (Q2)', priority: 'medium', items: ['Banner A/B Testing', 'Conversion Tracking', 'Dark Pattern Detection', 'Accessibility (WCAG)'] },
      { phase: 'Phase 3: Integration (Q3)', priority: 'low', items: ['Google Consent Mode v2', 'Meta CAPI Integration', 'CRM Sync', 'Marketing Automation'] },
    ],
    technicalDetails: [
      { component: 'Backend', technology: 'Go + Gin', version: '1.21+', description: 'High-Performance API' },
      { component: 'Database', technology: 'PostgreSQL', version: '16', description: 'ACID-konform' },
      { component: 'Cache', technology: 'Valkey', version: '8.x', description: 'Redis-kompatibel' },
      { component: 'Encryption', technology: 'AES-256', description: 'At-rest Verschluesselung' },
    ],
    auditInfo: [
      {
        category: 'DSGVO-Compliance',
        items: [
          { label: 'Art. 7 Einwilligung', value: 'Implementiert', status: 'ok' },
          { label: 'Art. 13/14 Informationspflichten', value: 'Implementiert', status: 'ok' },
          { label: 'Art. 17 Recht auf Loeschung', value: 'Implementiert', status: 'ok' },
          { label: 'Art. 20 Datenportabilitaet', value: 'Implementiert', status: 'ok' },
        ],
      },
      {
        category: 'Technische Sicherheit',
        items: [
          { label: 'Verschluesselung', value: 'AES-256 at rest', status: 'ok' },
          { label: 'TLS', value: '1.3', status: 'ok' },
          { label: 'Audit-Log', value: 'Lueckenlos', status: 'ok' },
          { label: 'Backup', value: 'Taeglich, 30 Tage', status: 'ok' },
        ],
      },
      {
        category: 'Dokumenten-Status',
        items: [
          { label: 'AGB', value: 'v2.1 - Aktiv', status: 'ok' },
          { label: 'Datenschutz', value: 'v3.0 - Aktiv', status: 'ok' },
          { label: 'Cookie-Policy', value: 'v1.5 - Aktiv', status: 'ok' },
          { label: 'Impressum', value: 'v1.0 - Aktiv', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Consent Management System</h2>

<h3>1. Uebersicht</h3>
<p>Das Consent Management System (CMS) verwaltet alle rechtlichen Einwilligungen fuer die BreakPilot-Plattform gemaess DSGVO Art. 6 und Art. 7.</p>

<h3>2. Dokumenttypen</h3>
<table>
  <tr><th>Typ</th><th>Beschreibung</th><th>Pflicht</th></tr>
  <tr><td>terms</td><td>Allgemeine Geschaeftsbedingungen</td><td>Ja</td></tr>
  <tr><td>privacy</td><td>Datenschutzerklaerung</td><td>Ja</td></tr>
  <tr><td>cookies</td><td>Cookie-Richtlinie</td><td>Ja</td></tr>
  <tr><td>community</td><td>Community Guidelines</td><td>Nein</td></tr>
  <tr><td>imprint</td><td>Impressum</td><td>Nein</td></tr>
</table>

<h3>3. Versions-Workflow</h3>
<pre>
    ┌──────────┐    ┌──────────┐    ┌───────────┐    ┌───────────┐
    │  draft   │ -> │  review  │ -> │  approved │ -> │ published │
    └──────────┘    └────┬─────┘    └───────────┘    └───────────┘
                         │
                         v
                    ┌──────────┐
                    │ rejected │ -> zurueck zu draft
                    └──────────┘
</pre>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/consent/documents</td><td>GET</td><td>Alle Dokumente listen</td></tr>
  <tr><td>/api/consent/documents/{type}/latest</td><td>GET</td><td>Aktuelle Version</td></tr>
  <tr><td>/api/consent/check/{type}</td><td>GET</td><td>Consent-Status pruefen</td></tr>
  <tr><td>/api/consent/grant</td><td>POST</td><td>Consent erteilen</td></tr>
  <tr><td>/api/consent/revoke</td><td>POST</td><td>Consent widerrufen</td></tr>
</table>

<h3>5. Cookie-Kategorien</h3>
<table>
  <tr><th>Kategorie</th><th>Beschreibung</th><th>Default</th></tr>
  <tr><td>essential</td><td>Technisch notwendig</td><td>Immer aktiv</td></tr>
  <tr><td>functional</td><td>Erweiterte Funktionen</td><td>Opt-in</td></tr>
  <tr><td>analytics</td><td>Nutzungsanalyse</td><td>Opt-in</td></tr>
  <tr><td>marketing</td><td>Werbung & Tracking</td><td>Opt-in</td></tr>
</table>

<h3>6. Audit-Trail</h3>
<p>Alle Consent-Aenderungen werden mit folgenden Daten protokolliert:</p>
<ul>
  <li>Timestamp (ISO 8601)</li>
  <li>User-ID (pseudonymisiert)</li>
  <li>Aktion (grant/revoke/update)</li>
  <li>Dokumenttyp und Version</li>
  <li>IP-Adresse (anonymisiert nach 30 Tagen)</li>
  <li>User-Agent</li>
</ul>

<h3>7. DSGVO-Rechte</h3>
<table>
  <tr><th>Artikel</th><th>Recht</th><th>Status</th></tr>
  <tr><td>Art. 7</td><td>Widerruf der Einwilligung</td><td>✓ Implementiert</td></tr>
  <tr><td>Art. 15</td><td>Auskunftsrecht</td><td>✓ Implementiert</td></tr>
  <tr><td>Art. 16</td><td>Recht auf Berichtigung</td><td>✓ Implementiert</td></tr>
  <tr><td>Art. 17</td><td>Recht auf Loeschung</td><td>✓ Implementiert</td></tr>
  <tr><td>Art. 20</td><td>Datenportabilitaet</td><td>✓ Implementiert</td></tr>
</table>

<h3>8. Compliance-Pruefungen</h3>
<ol>
  <li>Woechentlich: Automatischer Consent-Rate Report</li>
  <li>Monatlich: Dokumenten-Review durch DSB</li>
  <li>Quartalsweise: Compliance-Audit</li>
  <li>Jaehrlich: Externer Datenschutz-Audit</li>
</ol>

<h3>9. Notfallprozeduren</h3>
<ul>
  <li><strong>Bei Datenpanne:</strong> Sofortige Benachrichtigung DSB, ggf. Aufsichtsbehoerde (72h)</li>
  <li><strong>Bei Systemausfall:</strong> Fallback auf statische Consent-Seite</li>
  <li><strong>Bei rechtlicher Aenderung:</strong> Dokumenten-Update mit Re-Consent Kampagne</li>
</ul>
`,
  },

  // DSR (Datenschutzanfragen)
  dsr: {
    title: 'DSR Management System-Info',
    description: 'Bearbeitung von DSGVO-Betroffenenrechten (Art. 15-22).',
    version: '2.0',
    privacyNotes: [
      'Automatische Fristenueberwachung (30 Tage)',
      'Identitaetsverifizierung vor Datenauskunft',
      'Verschluesselte Datenexporte',
      'Protokollierung aller Bearbeitungsschritte',
    ],
    architecture: {
      layers: [
        { title: 'Request Portal', components: ['Antragsformular', 'Status-Tracking', 'Upload'], color: '#3b82f6' },
        { title: 'Processing Engine', components: ['Workflow Engine', 'Data Collector', 'Export Generator'], color: '#8b5cf6' },
        { title: 'Data Sources', components: ['PostgreSQL', 'MinIO', 'External APIs'], color: '#10b981' },
        { title: 'Notification', components: ['E-Mail', 'Audit Log', 'Reports'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Art. 15 Auskunft', status: 'active', description: 'Automatisierter Datenexport' },
      { name: 'Art. 17 Löschung', status: 'active', description: 'Kaskadierte Datenlöschung' },
      { name: 'Art. 20 Portabilitaet', status: 'active', description: 'JSON/CSV Export' },
      { name: 'Art. 16 Berichtigung', status: 'active', description: 'Datenkorrektur-Workflow' },
      { name: 'KI-Assistenz', status: 'planned', description: 'Automatische Kategorisierung' },
    ],
    roadmap: [
      { phase: 'Phase 1: Automation (Q1)', priority: 'high', items: ['Automatische Datensammlung', 'Template-basierte Antworten', 'Fristen-Alerts', 'Batch-Verarbeitung'] },
      { phase: 'Phase 2: Self-Service (Q2)', priority: 'medium', items: ['Nutzer-Portal', 'Echtzeit-Status', 'Sofort-Download', 'Identitaets-Verifizierung'] },
      { phase: 'Phase 3: Analytics (Q3)', priority: 'low', items: ['DSR-Metriken', 'Trend-Analyse', 'Compliance-Scoring', 'Benchmarking'] },
    ],
    technicalDetails: [
      { component: 'Workflow', technology: 'State Machine', description: 'Definierte Bearbeitungsstatus' },
      { component: 'Export', technology: 'JSON/CSV/PDF', description: 'Maschinenlesbare Formate' },
      { component: 'Encryption', technology: 'AES-256-GCM', description: 'Export-Verschluesselung' },
      { component: 'Verification', technology: 'TOTP/E-Mail', description: 'Zwei-Faktor' },
    ],
    auditInfo: [
      {
        category: 'DSGVO-Rechte Implementation',
        items: [
          { label: 'Art. 15 Auskunft', value: 'Automatisiert', status: 'ok' },
          { label: 'Art. 16 Berichtigung', value: 'Workflow', status: 'ok' },
          { label: 'Art. 17 Loeschung', value: 'Kaskadiert', status: 'ok' },
          { label: 'Art. 20 Portabilitaet', value: 'JSON/CSV', status: 'ok' },
          { label: 'Art. 21 Widerspruch', value: 'Implementiert', status: 'ok' },
        ],
      },
      {
        category: 'Fristen & SLAs',
        items: [
          { label: 'Bearbeitungsfrist', value: '30 Tage', status: 'ok' },
          { label: 'Fristverlängerung', value: '+60 Tage moeglich', status: 'ok' },
          { label: 'Automatische Erinnerung', value: '7 Tage vor Ablauf', status: 'ok' },
          { label: 'Eskalation', value: 'Nach 25 Tagen', status: 'ok' },
        ],
      },
      {
        category: 'Sicherheit',
        items: [
          { label: 'Identitaetspruefung', value: 'Zweistufig', status: 'ok' },
          { label: 'Export-Verschluesselung', value: 'AES-256-GCM', status: 'ok' },
          { label: 'Zugriffskontrolle', value: 'RBAC', status: 'ok' },
          { label: 'Audit-Log', value: 'Lueckenlos', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Datenschutzanfragen (DSR) Management</h2>

<h3>1. Uebersicht</h3>
<p>Das DSR-Modul verarbeitet alle Betroffenenrechte-Anfragen gemaess DSGVO Art. 15-22. Es automatisiert den Prozess von der Anfrage bis zur Erfuellung und stellt die Einhaltung der gesetzlichen Fristen sicher.</p>

<h3>2. Unterstuetzte Anfragetypen</h3>
<table>
  <tr><th>Artikel</th><th>Recht</th><th>Automatisierung</th><th>SLA</th></tr>
  <tr><td>Art. 15</td><td>Auskunft</td><td>Vollautomatisch</td><td>30 Tage</td></tr>
  <tr><td>Art. 16</td><td>Berichtigung</td><td>Workflow</td><td>30 Tage</td></tr>
  <tr><td>Art. 17</td><td>Loeschung</td><td>Kaskadiert</td><td>30 Tage</td></tr>
  <tr><td>Art. 18</td><td>Einschraenkung</td><td>Workflow</td><td>30 Tage</td></tr>
  <tr><td>Art. 20</td><td>Portabilitaet</td><td>Vollautomatisch</td><td>30 Tage</td></tr>
  <tr><td>Art. 21</td><td>Widerspruch</td><td>Workflow</td><td>30 Tage</td></tr>
</table>

<h3>3. Workflow-Architektur</h3>
<pre>
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Anfrage   │ --> │ Verifizierung│ --> │ Bearbeitung │ --> │  Erfuellung │
│   eingang   │     │  Identitaet  │     │   (Auto/Man)│     │   & Export  │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘
      │                    │                   │                   │
      v                    v                   v                   v
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  Ticket     │     │   E-Mail    │     │ Datensammlung│    │   Audit     │
│  erstellt   │     │   OTP Code  │     │ aus Systemen │     │   Log       │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘
</pre>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/dsr/requests</td><td>GET</td><td>Alle Anfragen listen</td></tr>
  <tr><td>/api/dsr/requests</td><td>POST</td><td>Neue Anfrage erstellen</td></tr>
  <tr><td>/api/dsr/requests/{id}</td><td>GET</td><td>Anfrage-Details</td></tr>
  <tr><td>/api/dsr/requests/{id}/verify</td><td>POST</td><td>Identitaet verifizieren</td></tr>
  <tr><td>/api/dsr/requests/{id}/process</td><td>POST</td><td>Bearbeitung starten</td></tr>
  <tr><td>/api/dsr/requests/{id}/export</td><td>GET</td><td>Datenexport herunterladen</td></tr>
</table>

<h3>5. Datensammlung</h3>
<p>Bei einer Auskunftsanfrage werden Daten aus folgenden Quellen gesammelt:</p>
<ul>
  <li><strong>PostgreSQL:</strong> Stammdaten, Consents, Aktivitaetslog</li>
  <li><strong>MinIO:</strong> Hochgeladene Dokumente, Profilbilder</li>
  <li><strong>Qdrant:</strong> Embeddings-Metadaten (ohne Vektoren)</li>
  <li><strong>Audit-Log:</strong> Alle Systemaktivitaeten</li>
</ul>

<h3>6. Export-Formate</h3>
<table>
  <tr><th>Format</th><th>Inhalt</th><th>Use Case</th></tr>
  <tr><td>JSON</td><td>Strukturierte Daten</td><td>Maschinenlesbar, Portabilitaet</td></tr>
  <tr><td>CSV</td><td>Tabellarische Daten</td><td>Excel-kompatibel</td></tr>
  <tr><td>PDF</td><td>Formatierter Report</td><td>Menschenlesbar</td></tr>
  <tr><td>ZIP</td><td>Alle Formate + Dateien</td><td>Vollstaendiger Export</td></tr>
</table>

<h3>7. Identitaetsverifizierung</h3>
<p>Zweistufige Verifizierung zum Schutz vor unbefugten Anfragen:</p>
<ol>
  <li><strong>Stufe 1:</strong> E-Mail-Verifizierung mit OTP-Code (6-stellig, 15 Min gueltig)</li>
  <li><strong>Stufe 2:</strong> Bei sensiblen Daten: Ausweiskopie oder Video-Ident</li>
</ol>

<h3>8. Loeschprozess (Art. 17)</h3>
<pre>
Loeschanfrage
     │
     v
┌────────────────────────────────────────────────────────────┐
│                    Pruefung Ausnahmen                       │
│  - Rechtliche Aufbewahrungspflichten?                      │
│  - Laufende Vertraege?                                     │
│  - Berechtigtes Interesse?                                 │
└────────────────────────────────────────────────────────────┘
     │
     ├── Ausnahme greift --> Teilloeschung + Begruendung
     │
     v
┌────────────────────────────────────────────────────────────┐
│                   Kaskadierte Loeschung                     │
│  1. Anwendungsdaten (PostgreSQL)                           │
│  2. Dateien (MinIO)                                        │
│  3. Embeddings (Qdrant)                                    │
│  4. Backups (nach Retention-Policy)                        │
└────────────────────────────────────────────────────────────┘
</pre>

<h3>9. Audit-Trail</h3>
<p>Jede DSR-Anfrage wird vollstaendig protokolliert:</p>
<ul>
  <li>Eingang der Anfrage mit Timestamp</li>
  <li>Verifizierungsschritte</li>
  <li>Bearbeitende Person(en)</li>
  <li>Gesammelte Datenquellen</li>
  <li>Erfuellung oder Ablehnung mit Begruendung</li>
  <li>Export-Download mit Hash</li>
</ul>

<h3>10. Metriken & KPIs</h3>
<table>
  <tr><th>Metrik</th><th>Ziel</th><th>Aktuell</th></tr>
  <tr><td>Durchschnittliche Bearbeitungszeit</td><td>&lt; 14 Tage</td><td>Tracking aktiv</td></tr>
  <tr><td>Fristenueberschreitung</td><td>0%</td><td>Alerting aktiv</td></tr>
  <tr><td>Automatisierungsgrad</td><td>&gt; 80%</td><td>Art. 15/20</td></tr>
  <tr><td>Identitaetspruefung-Erfolgsrate</td><td>&gt; 95%</td><td>Tracking aktiv</td></tr>
</table>
`,
  },

  // LLM Vergleich
  llmCompare: {
    title: 'LLM Vergleich System-Info',
    description: 'Vergleich und Benchmarking verschiedener KI-Provider und Modelle.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Vergleichs-UI', components: ['Provider-Auswahl', 'Prompt-Editor', 'Ergebnis-Vergleich'], color: '#3b82f6' },
        { title: 'Provider Adapters', components: ['OpenAI', 'Anthropic', 'Google', 'Local'], color: '#8b5cf6' },
        { title: 'Evaluation Engine', components: ['Latenz-Messung', 'Qualitaets-Scoring', 'Cost Calculator'], color: '#10b981' },
        { title: 'Logging', components: ['Request Logs', 'Token Tracking', 'Error Logs'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Multi-Provider Vergleich', status: 'active', description: 'Parallele Anfragen an mehrere LLMs' },
      { name: 'Latenz-Tracking', status: 'active', description: 'Echtzeit-Performance-Messung' },
      { name: 'Kosten-Kalkulation', status: 'active', description: 'Token-basierte Kostenberechnung' },
      { name: 'Qualitaets-Bewertung', status: 'planned', description: 'Automatisches Scoring der Antworten' },
      { name: 'A/B Testing', status: 'planned', description: 'Statistische Signifikanz-Tests' },
    ],
    roadmap: [
      { phase: 'Phase 1: Provider (Q1)', priority: 'high', items: ['Mistral Integration', 'Llama 3 Integration', 'Gemini Pro Integration', 'Rate Limiting'] },
      { phase: 'Phase 2: Evaluation (Q2)', priority: 'high', items: ['Automatisches Scoring', 'Benchmark-Suite', 'Domain-spezifische Tests', 'Halluzinations-Erkennung'] },
      { phase: 'Phase 3: Optimierung (Q3)', priority: 'medium', items: ['Prompt-Optimierung', 'Modell-Routing', 'Fallback-Strategien', 'Caching'] },
    ],
    technicalDetails: [
      { component: 'OpenAI', technology: 'GPT-4o / o1', description: 'Haupt-Provider' },
      { component: 'Anthropic', technology: 'Claude 3.5', description: 'Alternative' },
      { component: 'Google', technology: 'Gemini 2.0', description: 'Multimodal' },
      { component: 'Local', technology: 'Ollama', description: 'Self-hosted' },
    ],
    auditInfo: [
      {
        category: 'Provider-Status',
        items: [
          { label: 'OpenAI', value: 'Aktiv', status: 'ok' },
          { label: 'Anthropic', value: 'Aktiv', status: 'ok' },
          { label: 'Google Gemini', value: 'Aktiv', status: 'ok' },
          { label: 'Ollama (Local)', value: 'Verfuegbar', status: 'ok' },
        ],
      },
      {
        category: 'Kosten & Limits',
        items: [
          { label: 'Monatliches Budget', value: 'Konfigurierbar', status: 'ok' },
          { label: 'Rate Limiting', value: 'Pro Provider', status: 'ok' },
          { label: 'Token Tracking', value: 'Aktiviert', status: 'ok' },
          { label: 'Cost Alerts', value: 'E-Mail', status: 'ok' },
        ],
      },
      {
        category: 'Datenschutz',
        items: [
          { label: 'Prompt-Logging', value: 'Optional', status: 'ok' },
          { label: 'PII Detection', value: 'Geplant', status: 'warning' },
          { label: 'Data Residency', value: 'EU verfuegbar', status: 'ok' },
          { label: 'Audit-Log', value: 'Aktiviert', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>LLM Provider Vergleich & Benchmarking</h2>

<h3>1. Uebersicht</h3>
<p>Das LLM-Vergleichsmodul ermoeglicht den direkten Vergleich verschiedener KI-Provider hinsichtlich Qualitaet, Latenz und Kosten. Es dient der Auswahl des optimalen Modells fuer spezifische Use Cases.</p>

<h3>2. Unterstuetzte Provider</h3>
<table>
  <tr><th>Provider</th><th>Modelle</th><th>Staerken</th><th>Preisbereich</th></tr>
  <tr><td>OpenAI</td><td>GPT-4o, GPT-4o-mini, o1</td><td>Allrounder, Coding</td><td>$0.15-15/1M Token</td></tr>
  <tr><td>Anthropic</td><td>Claude 3.5 Sonnet/Haiku</td><td>Lange Kontexte, Safety</td><td>$0.25-15/1M Token</td></tr>
  <tr><td>Google</td><td>Gemini 2.0 Flash/Pro</td><td>Multimodal, Speed</td><td>$0.075-5/1M Token</td></tr>
  <tr><td>Ollama</td><td>Llama 3, Mistral, Phi</td><td>Lokal, Datenschutz</td><td>Nur Hardware-Kosten</td></tr>
</table>

<h3>3. Vergleichs-Architektur</h3>
<pre>
┌────────────────────────────────────────────────────────────────┐
│                        Frontend UI                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────┐ │
│  │ Prompt Input │  │ Provider Sel │  │ Results Comparison   │ │
│  └──────────────┘  └──────────────┘  └──────────────────────┘ │
└────────────────────────────────────────────────────────────────┘
                              │
                              v
┌────────────────────────────────────────────────────────────────┐
│                    Backend Orchestrator                         │
│  ┌──────────────────────────────────────────────────────────┐ │
│  │  Parallel Request Handler  |  Response Aggregator        │ │
│  └──────────────────────────────────────────────────────────┘ │
└────────────────────────────────────────────────────────────────┘
          │              │              │              │
          v              v              v              v
     ┌─────────┐   ┌─────────┐   ┌─────────┐   ┌─────────┐
     │ OpenAI  │   │Anthropic│   │ Google  │   │ Ollama  │
     └─────────┘   └─────────┘   └─────────┘   └─────────┘
</pre>

<h3>4. Metriken</h3>
<table>
  <tr><th>Metrik</th><th>Beschreibung</th><th>Messung</th></tr>
  <tr><td>TTFB</td><td>Time to First Byte</td><td>Millisekunden</td></tr>
  <tr><td>Total Latency</td><td>Gesamtantwortzeit</td><td>Millisekunden</td></tr>
  <tr><td>Tokens/Sekunde</td><td>Generierungsgeschwindigkeit</td><td>Output Tokens/s</td></tr>
  <tr><td>Kosten</td><td>Gesamtkosten</td><td>USD</td></tr>
  <tr><td>Qualitaet</td><td>Manuelle/Auto Bewertung</td><td>1-5 Sterne</td></tr>
</table>

<h3>5. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/llm/compare</td><td>POST</td><td>Parallelen Vergleich starten</td></tr>
  <tr><td>/api/llm/providers</td><td>GET</td><td>Verfuegbare Provider listen</td></tr>
  <tr><td>/api/llm/stats</td><td>GET</td><td>Nutzungsstatistiken</td></tr>
  <tr><td>/api/llm/benchmark</td><td>POST</td><td>Benchmark-Suite ausfuehren</td></tr>
</table>

<h3>6. Benchmark-Suite</h3>
<p>Vordefinierte Tests fuer verschiedene Use Cases:</p>
<ul>
  <li><strong>Summarization:</strong> Textzusammenfassung verschiedener Laengen</li>
  <li><strong>QA:</strong> Frage-Antwort auf Dokumenten</li>
  <li><strong>Coding:</strong> Code-Generierung und -Erklaerung</li>
  <li><strong>Classification:</strong> Textkategorisierung</li>
  <li><strong>Translation:</strong> Mehrsprachige Uebersetzung</li>
</ul>

<h3>7. Kostenmanagement</h3>
<pre>
Budgetkontrolle
     │
     ├── Monatliches Limit pro Provider
     ├── Echtzeit-Kostentracking
     ├── Alerts bei 80%/90%/100%
     └── Auto-Fallback bei Limit
</pre>

<h3>8. Datenschutz-Konfiguration</h3>
<table>
  <tr><th>Einstellung</th><th>Optionen</th><th>Default</th></tr>
  <tr><td>Prompt-Logging</td><td>Ein/Aus/Anonymisiert</td><td>Anonymisiert</td></tr>
  <tr><td>Response-Speicherung</td><td>Ein/Aus/24h</td><td>24h</td></tr>
  <tr><td>Metriken-Retention</td><td>30/90/365 Tage</td><td>90 Tage</td></tr>
  <tr><td>PII-Filter</td><td>Ein/Aus</td><td>Ein (geplant)</td></tr>
</table>

<h3>9. Fehlerbehandlung</h3>
<ul>
  <li><strong>Timeout:</strong> 30 Sekunden default, konfigurierbar</li>
  <li><strong>Rate Limit:</strong> Automatisches Retry mit Backoff</li>
  <li><strong>Provider Down:</strong> Skip und Warnung</li>
  <li><strong>API Error:</strong> Fehlerdetails in Response</li>
</ul>

<h3>10. Best Practices</h3>
<ol>
  <li>Immer mindestens 3 Provider fuer aussagekraeftigen Vergleich</li>
  <li>Benchmark-Suite fuer reproduzierbare Ergebnisse nutzen</li>
  <li>Kosten und Qualitaet gemeinsam bewerten</li>
  <li>Lokale Modelle fuer sensible Daten bevorzugen</li>
</ol>
`,
  },

  // Security
  security: {
    title: 'Security System-Info',
    description: 'DevSecOps Dashboard mit Vulnerability Scanning und Compliance Checks.',
    version: '2.0',
    privacyNotes: [
      'Automatische CVE-Pruefung aller Dependencies',
      'OWASP Top 10 Compliance',
      'Container Security Scanning',
      'Secret Detection in Code',
    ],
    architecture: {
      layers: [
        { title: 'Security Dashboard', components: ['Vulnerability Overview', 'Compliance Status', 'Alerts'], color: '#ef4444' },
        { title: 'Scanners', components: ['Trivy', 'Semgrep', 'Gitleaks', 'OWASP ZAP'], color: '#8b5cf6' },
        { title: 'CI/CD Integration', components: ['GitHub Actions', 'Pre-commit Hooks', 'PR Checks'], color: '#10b981' },
        { title: 'Reporting', components: ['SARIF', 'SBOM', 'Audit Reports'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Vulnerability Scanning', status: 'active', description: 'Automatische CVE-Pruefung' },
      { name: 'SBOM Generation', status: 'active', description: 'Software Bill of Materials' },
      { name: 'Secret Detection', status: 'active', description: 'Gitleaks Integration' },
      { name: 'DAST Scanning', status: 'planned', description: 'Dynamic Application Security Testing' },
      { name: 'Penetration Testing', status: 'planned', description: 'Automatisierte Pen-Tests' },
    ],
    roadmap: [
      { phase: 'Phase 1: SAST (Q1)', priority: 'high', items: ['Semgrep Rules', 'CodeQL Integration', 'Custom Rules', 'False Positive Management'] },
      { phase: 'Phase 2: Runtime (Q2)', priority: 'high', items: ['Runtime Protection', 'WAF Integration', 'Anomaly Detection', 'Incident Response'] },
      { phase: 'Phase 3: Compliance (Q3)', priority: 'medium', items: ['SOC 2 Readiness', 'ISO 27001 Mapping', 'GDPR Technical Measures', 'Audit Automation'] },
    ],
    technicalDetails: [
      { component: 'Container Scan', technology: 'Trivy', version: '0.50+', description: 'Image Vulnerabilities' },
      { component: 'SAST', technology: 'Semgrep', version: '1.x', description: 'Code Analysis' },
      { component: 'Secrets', technology: 'Gitleaks', version: '8.x', description: 'Secret Detection' },
      { component: 'SBOM', technology: 'CycloneDX', version: '1.5', description: 'Dependency List' },
    ],
    auditInfo: [
      {
        category: 'Vulnerability Status',
        items: [
          { label: 'Kritische CVEs', value: '0', status: 'ok' },
          { label: 'Hohe CVEs', value: '0', status: 'ok' },
          { label: 'Mittlere CVEs', value: 'Tracking', status: 'warning' },
          { label: 'Letzte Pruefung', value: 'Taeglich', status: 'ok' },
        ],
      },
      {
        category: 'Compliance',
        items: [
          { label: 'OWASP Top 10', value: 'Geprueft', status: 'ok' },
          { label: 'Secret Detection', value: 'Aktiv', status: 'ok' },
          { label: 'Container Hardening', value: 'Umgesetzt', status: 'ok' },
          { label: 'Dependency Updates', value: 'Woechentlich', status: 'ok' },
        ],
      },
      {
        category: 'Monitoring',
        items: [
          { label: 'Echtzeit-Alerts', value: 'Aktiviert', status: 'ok' },
          { label: 'SIEM Integration', value: 'Geplant', status: 'warning' },
          { label: 'Penetration Tests', value: 'Quartalsweise', status: 'ok' },
          { label: 'Bug Bounty', value: 'In Planung', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Security & DevSecOps Dashboard</h2>

<h3>1. Uebersicht</h3>
<p>Das Security-Modul integriert Sicherheitspruefungen in den gesamten Entwicklungs- und Deployment-Prozess (DevSecOps). Es kombiniert statische Analyse, Container-Scanning und Laufzeitschutz.</p>

<h3>2. Security-Tools</h3>
<table>
  <tr><th>Tool</th><th>Kategorie</th><th>Funktion</th><th>Integration</th></tr>
  <tr><td>Trivy</td><td>Container</td><td>Image Vulnerability Scanning</td><td>CI/CD</td></tr>
  <tr><td>Semgrep</td><td>SAST</td><td>Code Pattern Matching</td><td>Pre-commit, CI</td></tr>
  <tr><td>Gitleaks</td><td>Secrets</td><td>Credential Detection</td><td>Pre-commit, CI</td></tr>
  <tr><td>OWASP ZAP</td><td>DAST</td><td>Web App Scanning</td><td>Staging</td></tr>
</table>

<h3>3. Scanning-Pipeline</h3>
<pre>
┌─────────────────────────────────────────────────────────────────────┐
│                        Development Phase                             │
├─────────────────────────────────────────────────────────────────────┤
│  Pre-commit Hooks                                                    │
│  ├── Gitleaks (Secrets)                                             │
│  ├── Semgrep (Quick Rules)                                          │
│  └── Formatting/Linting                                             │
└─────────────────────────────────────────────────────────────────────┘
                                 │
                                 v
┌─────────────────────────────────────────────────────────────────────┐
│                           CI Pipeline                                │
├─────────────────────────────────────────────────────────────────────┤
│  ├── Full SAST Scan (Semgrep)                                       │
│  ├── Dependency Check (npm audit, go vuln)                          │
│  ├── Container Scan (Trivy)                                         │
│  ├── SBOM Generation (Syft)                                         │
│  └── License Compliance                                             │
└─────────────────────────────────────────────────────────────────────┘
                                 │
                                 v
┌─────────────────────────────────────────────────────────────────────┐
│                          Staging/Prod                                │
├─────────────────────────────────────────────────────────────────────┤
│  ├── DAST Scan (OWASP ZAP)                                          │
│  ├── Runtime Protection                                              │
│  └── Anomaly Detection                                               │
└─────────────────────────────────────────────────────────────────────┘
</pre>

<h3>4. OWASP Top 10 Abdeckung</h3>
<table>
  <tr><th>#</th><th>Risiko</th><th>Massnahme</th><th>Status</th></tr>
  <tr><td>A01</td><td>Broken Access Control</td><td>RBAC, JWT Validation</td><td>✓</td></tr>
  <tr><td>A02</td><td>Cryptographic Failures</td><td>TLS 1.3, AES-256</td><td>✓</td></tr>
  <tr><td>A03</td><td>Injection</td><td>Parameterized Queries, Input Validation</td><td>✓</td></tr>
  <tr><td>A04</td><td>Insecure Design</td><td>Threat Modeling, Code Review</td><td>✓</td></tr>
  <tr><td>A05</td><td>Security Misconfiguration</td><td>Hardened Defaults, IaC Scanning</td><td>✓</td></tr>
  <tr><td>A06</td><td>Vulnerable Components</td><td>Dependency Scanning, SBOM</td><td>✓</td></tr>
  <tr><td>A07</td><td>Auth Failures</td><td>MFA, Session Management</td><td>✓</td></tr>
  <tr><td>A08</td><td>Software Integrity</td><td>Signed Commits, SBOM</td><td>✓</td></tr>
  <tr><td>A09</td><td>Logging Failures</td><td>Structured Logging, Audit Trail</td><td>✓</td></tr>
  <tr><td>A10</td><td>SSRF</td><td>URL Validation, Network Policies</td><td>✓</td></tr>
</table>

<h3>5. Vulnerability Management</h3>
<pre>
CVE Discovered
      │
      v
┌───────────────────┐
│ Severity Rating   │
│ Critical/High/Med │
└─────────┬─────────┘
          │
    ┌─────┴─────┐
    │ Critical? │
    └─────┬─────┘
      Yes │ No
      │   └──> Backlog mit Frist
      v
┌───────────────────┐
│ Immediate Action  │
│ - Block Deploy    │
│ - Notify Team     │
│ - Hotfix Branch   │
└───────────────────┘
</pre>

<h3>6. Secret Management</h3>
<ul>
  <li><strong>Speicherung:</strong> Doppler/Vault fuer Secrets</li>
  <li><strong>Rotation:</strong> Automatisch alle 90 Tage</li>
  <li><strong>Detection:</strong> Gitleaks in Pre-commit und CI</li>
  <li><strong>Notfall:</strong> Sofortige Rotation bei Leak</li>
</ul>

<h3>7. Container Security</h3>
<table>
  <tr><th>Massnahme</th><th>Implementation</th></tr>
  <tr><td>Base Images</td><td>Alpine/Distroless, regelmaessig aktualisiert</td></tr>
  <tr><td>Non-root User</td><td>Alle Container als non-root</td></tr>
  <tr><td>Read-only FS</td><td>Wo moeglich aktiviert</td></tr>
  <tr><td>Resource Limits</td><td>CPU/Memory Limits gesetzt</td></tr>
  <tr><td>Network Policies</td><td>Kubernetes NetworkPolicy</td></tr>
</table>

<h3>8. Incident Response</h3>
<ol>
  <li><strong>Detection:</strong> Automatische Alerts, Monitoring</li>
  <li><strong>Triage:</strong> Schweregrad-Bewertung, Scope</li>
  <li><strong>Containment:</strong> Isolation, Zugriffssperre</li>
  <li><strong>Eradication:</strong> Ursachenbehandlung</li>
  <li><strong>Recovery:</strong> Wiederherstellung, Monitoring</li>
  <li><strong>Lessons Learned:</strong> Post-Mortem, Verbesserungen</li>
</ol>

<h3>9. Compliance-Reports</h3>
<p>Automatisch generierte Reports:</p>
<ul>
  <li>Woechentlich: Vulnerability Summary</li>
  <li>Monatlich: Compliance Status, SBOM</li>
  <li>Quartalsweise: Penetration Test Results</li>
  <li>Jaehrlich: Security Audit Report</li>
</ul>

<h3>10. Metriken</h3>
<table>
  <tr><th>Metrik</th><th>Ziel</th><th>Messung</th></tr>
  <tr><td>Mean Time to Remediate (Critical)</td><td>&lt; 24h</td><td>Automatisch</td></tr>
  <tr><td>Mean Time to Remediate (High)</td><td>&lt; 7 Tage</td><td>Automatisch</td></tr>
  <tr><td>Scan Coverage</td><td>100%</td><td>CI Pipeline</td></tr>
  <tr><td>False Positive Rate</td><td>&lt; 10%</td><td>Review</td></tr>
</table>
`,
  },

  // Middleware
  middleware: {
    title: 'Middleware System-Info',
    description: 'Middleware-Stack mit Test-Wizard fuer Integration Tests.',
    version: '1.5',
    architecture: {
      layers: [
        { title: 'Test Wizard UI', components: ['Test Runner', 'Result Viewer', 'Coverage Report'], color: '#3b82f6' },
        { title: 'API Gateway', components: ['Traefik', 'Rate Limiter', 'Auth Proxy'], color: '#8b5cf6' },
        { title: 'Services', components: ['Consent', 'Klausur', 'School', 'Backend'], color: '#10b981' },
        { title: 'Infrastructure', components: ['PostgreSQL', 'Valkey', 'MinIO', 'Qdrant'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Integration Tests', status: 'active', description: 'End-to-End API Tests' },
      { name: 'Health Checks', status: 'active', description: 'Service-Status Pruefung' },
      { name: 'Test Wizard', status: 'active', description: 'Interaktive Test-Suite' },
      { name: 'Load Testing', status: 'planned', description: 'Performance-Tests' },
      { name: 'Chaos Engineering', status: 'planned', description: 'Resilienz-Tests' },
    ],
    roadmap: [
      { phase: 'Phase 1: Testing (Q1)', priority: 'high', items: ['API Test Suite', 'Database Tests', 'Auth Flow Tests', 'Error Handling Tests'] },
      { phase: 'Phase 2: Performance (Q2)', priority: 'medium', items: ['k6 Load Tests', 'Latency Benchmarks', 'Throughput Tests', 'Memory Profiling'] },
      { phase: 'Phase 3: Resilience (Q3)', priority: 'low', items: ['Chaos Monkey', 'Failover Tests', 'Circuit Breaker', 'Graceful Degradation'] },
    ],
    technicalDetails: [
      { component: 'API Gateway', technology: 'Traefik', version: '3.x', description: 'Reverse Proxy' },
      { component: 'Cache', technology: 'Valkey', version: '8.x', description: 'In-Memory Store' },
      { component: 'Storage', technology: 'MinIO', version: 'Latest', description: 'S3-kompatibel' },
      { component: 'Vector DB', technology: 'Qdrant', version: '1.12+', description: 'Similarity Search' },
    ],
    auditInfo: [
      {
        category: 'Service Health',
        items: [
          { label: 'API Gateway (Traefik)', value: 'Online', status: 'ok' },
          { label: 'PostgreSQL', value: 'Online', status: 'ok' },
          { label: 'Valkey (Cache)', value: 'Online', status: 'ok' },
          { label: 'Qdrant', value: 'Online', status: 'ok' },
        ],
      },
      {
        category: 'Test Coverage',
        items: [
          { label: 'Integration Tests', value: 'Aktiv', status: 'ok' },
          { label: 'Auth Flow Tests', value: 'Implementiert', status: 'ok' },
          { label: 'Load Tests', value: 'Geplant', status: 'warning' },
          { label: 'Chaos Tests', value: 'Geplant', status: 'warning' },
        ],
      },
      {
        category: 'Performance',
        items: [
          { label: 'Avg. Response Time', value: '< 100ms', status: 'ok' },
          { label: 'Uptime (30 Tage)', value: '> 99.9%', status: 'ok' },
          { label: 'Error Rate', value: '< 0.1%', status: 'ok' },
          { label: 'Cache Hit Ratio', value: '> 90%', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Middleware & Integration Testing</h2>

<h3>1. Uebersicht</h3>
<p>Das Middleware-Modul verwaltet den gesamten Service-Stack und bietet einen Test-Wizard fuer Integration Tests. Es stellt sicher, dass alle Services korrekt miteinander kommunizieren.</p>

<h3>2. Service-Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────────┐
│                          Traefik Gateway                             │
│  ├── TLS Termination                                                │
│  ├── Rate Limiting                                                  │
│  ├── Request Routing                                                │
│  └── Health Checks                                                  │
└────────────────────────────────┬────────────────────────────────────┘
                                 │
          ┌──────────────────────┼──────────────────────┐
          │                      │                      │
          v                      v                      v
┌─────────────────┐   ┌─────────────────┐   ┌─────────────────┐
│  Website (3000) │   │  Backend (8000) │   │ Consent (8081)  │
│    Next.js      │   │    FastAPI      │   │      Gin        │
└────────┬────────┘   └────────┬────────┘   └────────┬────────┘
         │                     │                     │
         └──────────────────┬──┴─────────────────────┘
                            │
          ┌─────────────────┼─────────────────┐
          │                 │                 │
          v                 v                 v
┌─────────────────┐  ┌────────────┐  ┌─────────────────┐
│   PostgreSQL    │  │   Valkey   │  │     Qdrant      │
│     (5432)      │  │   (6379)   │  │     (6333)      │
└─────────────────┘  └────────────┘  └─────────────────┘
</pre>

<h3>3. Test-Wizard Funktionen</h3>
<table>
  <tr><th>Test-Kategorie</th><th>Beschreibung</th><th>Status</th></tr>
  <tr><td>Health Checks</td><td>Service-Erreichbarkeit</td><td>Automatisch</td></tr>
  <tr><td>Auth Flow</td><td>Login, Token-Refresh, Logout</td><td>Implementiert</td></tr>
  <tr><td>Consent CRUD</td><td>Dokumente erstellen, lesen, aktualisieren</td><td>Implementiert</td></tr>
  <tr><td>Database</td><td>Connection Pool, Query Performance</td><td>Implementiert</td></tr>
  <tr><td>Cache</td><td>Set/Get, Invalidierung</td><td>Implementiert</td></tr>
  <tr><td>Vector Search</td><td>Embedding, Similarity Search</td><td>Implementiert</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/middleware/health</td><td>GET</td><td>Alle Service Health Checks</td></tr>
  <tr><td>/api/middleware/tests</td><td>GET</td><td>Verfuegbare Test-Suites</td></tr>
  <tr><td>/api/middleware/tests/run</td><td>POST</td><td>Test-Suite ausfuehren</td></tr>
  <tr><td>/api/middleware/metrics</td><td>GET</td><td>Performance-Metriken</td></tr>
</table>

<h3>5. Health Check Format</h3>
<pre>
{
  "status": "healthy",
  "timestamp": "2025-01-14T10:00:00Z",
  "services": {
    "postgres": {
      "status": "up",
      "latency_ms": 2,
      "details": {"connections": 10, "max": 100}
    },
    "valkey": {
      "status": "up",
      "latency_ms": 1,
      "details": {"memory_used": "50MB"}
    },
    "qdrant": {
      "status": "up",
      "latency_ms": 5,
      "details": {"collections": 3}
    }
  }
}
</pre>

<h3>6. Test-Ausfuehrung</h3>
<pre>
Test Request
     │
     v
┌───────────────────────────────────────┐
│         Test Runner Engine            │
├───────────────────────────────────────┤
│  1. Setup (Fixtures, Test Data)       │
│  2. Execute (Sequential/Parallel)     │
│  3. Assert (Expected vs Actual)       │
│  4. Cleanup (Remove Test Data)        │
│  5. Report (Results, Timings)         │
└───────────────────────────────────────┘
     │
     v
┌───────────────────────────────────────┐
│           Test Report                  │
│  ├── Total: 25, Passed: 24, Failed: 1 │
│  ├── Duration: 5.2s                   │
│  └── Details per Test Case            │
└───────────────────────────────────────┘
</pre>

<h3>7. Rate Limiting</h3>
<table>
  <tr><th>Endpoint-Typ</th><th>Limit</th><th>Window</th></tr>
  <tr><td>Public API</td><td>100 req</td><td>1 Minute</td></tr>
  <tr><td>Authenticated API</td><td>1000 req</td><td>1 Minute</td></tr>
  <tr><td>Admin API</td><td>5000 req</td><td>1 Minute</td></tr>
  <tr><td>File Upload</td><td>10 req</td><td>1 Minute</td></tr>
</table>

<h3>8. Caching-Strategie</h3>
<ul>
  <li><strong>Session Cache:</strong> 15 Min TTL, User-Tokens</li>
  <li><strong>API Response Cache:</strong> 5 Min TTL, GET-Requests</li>
  <li><strong>Config Cache:</strong> 1 Stunde TTL, System-Konfiguration</li>
  <li><strong>Invalidierung:</strong> Event-basiert bei Datenänderung</li>
</ul>

<h3>9. Monitoring & Alerts</h3>
<table>
  <tr><th>Alert</th><th>Schwelle</th><th>Aktion</th></tr>
  <tr><td>Service Down</td><td>3 failed checks</td><td>PagerDuty, Slack</td></tr>
  <tr><td>High Latency</td><td>> 500ms avg</td><td>Slack</td></tr>
  <tr><td>High Error Rate</td><td>> 1%</td><td>Slack</td></tr>
  <tr><td>DB Connections High</td><td>> 80%</td><td>E-Mail</td></tr>
</table>

<h3>10. Troubleshooting</h3>
<pre>
Problem: Service nicht erreichbar
├── Check: Docker Container Status
├── Check: Port-Mapping
├── Check: Network (docker network ls)
└── Check: Logs (docker logs service-name)

Problem: Hohe Latenz
├── Check: Database Query Performance
├── Check: Cache Hit Ratio
├── Check: CPU/Memory Usage
└── Check: Network Latency
</pre>
`,
  },

  // Communication (Matrix/Jitsi/Jibri/Transcription)
  communication: {
    title: 'Communication System-Info',
    description: 'Matrix Homeserver, Jitsi Videokonferenz, Jibri Recording und KI-Transkription.',
    version: '2.0',
    architecture: {
      layers: [
        { title: 'Frontend', components: ['BreakPilot Meet', 'Recording UI', 'Transcript Viewer'], color: '#3b82f6' },
        { title: 'Videokonferenz', components: ['Jitsi Meet', 'Videobridge', 'Jicofo', 'Prosody'], color: '#17a2b8' },
        { title: 'Recording', components: ['Jibri', 'Xvfb', 'FFmpeg', 'MinIO Upload'], color: '#28a745' },
        { title: 'Transkription', components: ['faster-whisper', 'pyannote.audio', 'RQ Worker'], color: '#6f42c1' },
        { title: 'Matrix Chat', components: ['Synapse', 'Federation', 'Media Store'], color: '#0DBD8B' },
        { title: 'Infrastructure', components: ['PostgreSQL', 'Valkey', 'MinIO', 'TURN'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Jitsi Videokonferenz', status: 'active', description: 'WebRTC-basierte Videokonferenzen' },
      { name: 'Matrix Chat', status: 'active', description: 'E2EE Messaging mit Synapse' },
      { name: 'Jibri Recording', status: 'active', description: 'Meeting-Aufzeichnung mit Consent' },
      { name: 'KI-Transkription', status: 'active', description: 'Whisper + Speaker Diarization' },
      { name: 'KI Meeting-Protokolle', status: 'active', description: 'LLM-generierte Zusammenfassungen mit Action Items' },
      { name: 'Untertitel Export', status: 'active', description: 'WebVTT und SRT Export' },
      { name: 'PDF Export', status: 'active', description: 'Protokolle als PDF exportieren' },
    ],
    roadmap: [
      { phase: 'Phase 1: Recording (Abgeschlossen)', priority: 'high', items: ['Jibri Integration', 'MinIO Storage', 'Consent Management', 'Webhook Pipeline'] },
      { phase: 'Phase 2: Transkription (Abgeschlossen)', priority: 'high', items: ['Whisper large-v3', 'Speaker Diarization', 'VTT/SRT Export', 'Segment-Suche'] },
      { phase: 'Phase 3: Protokolle (Abgeschlossen)', priority: 'high', items: ['LLM Gateway Integration', 'Action Items', 'Zusammenfassungen', 'MD/HTML/PDF Export'] },
      { phase: 'Phase 4: Erweiterte KI (Q2)', priority: 'medium', items: ['Sprecher-Namensverknuepfung', 'Themen-Clustering', 'Sentiment-Analyse', 'Automatische Agenda'] },
    ],
    technicalDetails: [
      { component: 'Video', technology: 'Jitsi Meet', version: 'stable-9823', description: 'WebRTC Konferenz' },
      { component: 'Recording', technology: 'Jibri', version: 'stable-9823', description: 'Meeting Recording' },
      { component: 'Transkription', technology: 'faster-whisper', version: '1.0+', description: 'GPU-optimiert (MIT)' },
      { component: 'Diarization', technology: 'pyannote.audio', version: '3.x', description: 'Speaker ID (MIT)' },
      { component: 'Meeting Minutes', technology: 'LLM Gateway', version: '1.0', description: 'Ollama/Llama 3.1' },
      { component: 'Queue', technology: 'RQ/Valkey', version: '1.x', description: 'Task Processing' },
      { component: 'Storage', technology: 'MinIO', version: 'latest', description: 'S3-kompatibel' },
      { component: 'Chat', technology: 'Matrix Synapse', version: '1.x', description: 'E2EE Homeserver' },
      { component: 'TURN', technology: 'Coturn', version: '4.x', description: 'NAT Traversal' },
    ],
    auditInfo: [
      {
        category: 'Jitsi Videokonferenz',
        items: [
          { label: 'Videobridge', value: 'Online', status: 'ok' },
          { label: 'Max. Teilnehmer', value: '100', status: 'ok' },
          { label: 'E2E Encryption', value: 'Verfuegbar', status: 'ok' },
          { label: 'TURN Server', value: 'Aktiv', status: 'ok' },
        ],
      },
      {
        category: 'Jibri Recording',
        items: [
          { label: 'Recording Service', value: 'Aktiv', status: 'ok' },
          { label: 'Consent-Pflicht', value: 'Aktiviert', status: 'ok' },
          { label: 'Storage', value: 'MinIO (Self-hosted)', status: 'ok' },
          { label: 'Retention', value: '365 Tage', status: 'ok' },
        ],
      },
      {
        category: 'KI-Transkription',
        items: [
          { label: 'Whisper Modell', value: 'large-v3 (lokal)', status: 'ok' },
          { label: 'Speaker Diarization', value: 'pyannote (lokal)', status: 'ok' },
          { label: 'Datenverarbeitung', value: '100% On-Premise', status: 'ok' },
          { label: 'Export-Formate', value: 'VTT, SRT, JSON', status: 'ok' },
        ],
      },
      {
        category: 'KI Meeting-Protokolle',
        items: [
          { label: 'LLM Backend', value: 'Ollama (lokal)', status: 'ok' },
          { label: 'Modell', value: 'Llama 3.1 8B/70B', status: 'ok' },
          { label: 'Verarbeitung', value: '100% On-Premise', status: 'ok' },
          { label: 'Export-Formate', value: 'MD, HTML, PDF', status: 'ok' },
        ],
      },
      {
        category: 'Matrix Homeserver',
        items: [
          { label: 'Server Status', value: 'Online', status: 'ok' },
          { label: 'Federation', value: 'Aktiviert', status: 'ok' },
          { label: 'E2E Encryption', value: 'Standard', status: 'ok' },
          { label: 'Media Retention', value: '90 Tage', status: 'ok' },
        ],
      },
      {
        category: 'DSGVO-Compliance',
        items: [
          { label: 'Daten-Residenz', value: 'EU (Self-hosted)', status: 'ok' },
          { label: 'Consent-Management', value: 'Implementiert', status: 'ok' },
          { label: 'Audit-Logging', value: 'Aktiviert', status: 'ok' },
          { label: 'Loeschrecht (Art. 17)', value: 'Implementiert', status: 'ok' },
        ],
      },
      {
        category: 'Open Source Lizenzen',
        items: [
          { label: 'Jitsi/Jibri', value: 'Apache-2.0', status: 'ok' },
          { label: 'faster-whisper', value: 'MIT', status: 'ok' },
          { label: 'pyannote.audio', value: 'MIT', status: 'ok' },
          { label: 'Matrix Synapse', value: 'AGPL-3.0', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>BreakPilot Communication Platform</h2>
<p><strong>Version:</strong> 2.0.0 | <strong>Stand:</strong> Januar 2026 | <strong>Autor:</strong> BreakPilot Development Team</p>

<h2>Audit-Relevante Informationen</h2>
<p>Dieses Dokument dient als technische Dokumentation fuer das Kommunikationssystem der BreakPilot Plattform. Es ist fuer Audits durch Bildungstraeger und Datenschutzbeauftragte konzipiert.</p>

<h3>Ziel des Kommunikationssystems</h3>
<p>Das System ermoeglicht sichere Videokonferenzen und Messaging fuer Bildungseinrichtungen mit:</p>
<ul>
  <li><strong>Jitsi Meet:</strong> DSGVO-konforme Videokonferenzen ohne Drittanbieter</li>
  <li><strong>Jibri Recording:</strong> Meeting-Aufzeichnung mit expliziter Einwilligung</li>
  <li><strong>KI-Transkription:</strong> Automatische Verschriftlichung mit Sprechererkennung</li>
  <li><strong>KI Meeting-Protokolle:</strong> Automatische Zusammenfassungen, Action Items, Entscheidungen</li>
  <li><strong>Matrix Chat:</strong> Ende-zu-Ende verschluesselte Nachrichten</li>
</ul>

<h3>Datenschutz-Compliance</h3>
<ul>
  <li><strong>100% Self-Hosted:</strong> Alle Dienste laufen auf eigenen Servern in der EU</li>
  <li><strong>Keine Cloud-Abhaengigkeit:</strong> Keine Daten verlassen die Infrastruktur</li>
  <li><strong>Consent-Management:</strong> Aufzeichnung nur mit expliziter Zustimmung aller Teilnehmer</li>
  <li><strong>Audit-Logging:</strong> Vollstaendige Nachvollziehbarkeit aller Zugriffe</li>
  <li><strong>Open Source:</strong> Alle Komponenten sind quelloffen und auditierbar</li>
</ul>

<hr/>

<h2>1. Systemarchitektur</h2>

<h3>Gesamtarchitektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────────────────┐
│                            BreakPilot Meet Frontend                          │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐    │
│  │ Lobby/Rooms  │  │  Jitsi UI    │  │  Recording   │  │ Transcript   │    │
│  │              │  │              │  │   Consent    │  │   Viewer     │    │
│  └──────────────┘  └──────────────┘  └──────────────┘  └──────────────┘    │
└─────────────────────────────────┬───────────────────────────────────────────┘
                                  │
                                  v
┌─────────────────────────────────────────────────────────────────────────────┐
│                              Jitsi Meet Stack                                │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────┐                 │
│  │    Jicofo      │  │   Videobridge  │  │    Prosody     │                 │
│  │ (Orchestrator) │  │    (WebRTC)    │  │     (XMPP)     │                 │
│  └───────┬────────┘  └───────┬────────┘  └───────┬────────┘                 │
│          └───────────────────┼───────────────────┘                          │
│                              │                                               │
│  ┌────────────────────────────v────────────────────────────┐                │
│  │                      Jibri                               │                │
│  │  ┌──────────┐  ┌──────────┐  ┌──────────┐              │                │
│  │  │   Xvfb   │  │ Chromium │  │  FFmpeg  │              │                │
│  │  │ (Display)│  │ (Capture)│  │ (Encode) │              │                │
│  │  └──────────┘  └──────────┘  └──────────┘              │                │
│  │                      │                                  │                │
│  │               finalize.sh (Upload)                      │                │
│  └──────────────────────┬──────────────────────────────────┘                │
└─────────────────────────┼───────────────────────────────────────────────────┘
                          │
                          v
┌─────────────────────────────────────────────────────────────────────────────┐
│                           Storage & Processing                               │
│                                                                              │
│  ┌────────────────┐              ┌────────────────────────────────────┐     │
│  │     MinIO      │              │     Transcription Worker           │     │
│  │  ┌──────────┐  │   Webhook    │  ┌────────────┐  ┌────────────┐   │     │
│  │  │recordings│  │─────────────>│  │faster-     │  │pyannote.   │   │     │
│  │  │  /video  │  │              │  │whisper     │  │audio       │   │     │
│  │  │  /audio  │  │              │  │(large-v3)  │  │(diarize)   │   │     │
│  │  │  /vtt    │  │              │  └─────┬──────┘  └─────┬──────┘   │     │
│  │  └──────────┘  │              │        └───────┬───────┘          │     │
│  └────────────────┘              │                v                   │     │
│                                  │        ┌────────────┐              │     │
│                                  │        │  Aligner   │              │     │
│                                  │        │  + Export  │              │     │
│                                  │        └────────────┘              │     │
│                                  └────────────────────────────────────┘     │
│                                                                              │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────┐                 │
│  │   PostgreSQL   │  │     Valkey     │  │    Coturn      │                 │
│  │   (Metadata)   │  │  (Task Queue)  │  │  (TURN/STUN)   │                 │
│  └────────────────┘  └────────────────┘  └────────────────┘                 │
└─────────────────────────────────────────────────────────────────────────────┘
</pre>

<h3>Datenfluss bei Aufzeichnung</h3>
<pre>
1. Meeting-Host aktiviert Recording
           │
           v
2. Consent-Abfrage an alle Teilnehmer
           │
           ├── Alle stimmen zu ──────────────────────────────>│
           │                                                   │
           └── Mindestens einer lehnt ab ──> Recording nicht   │
                                             moeglich          │
                                                               v
3. Jibri verbindet sich als unsichtbarer Teilnehmer
           │
           v
4. Xvfb + Chromium + FFmpeg nehmen Meeting auf
           │
           v
5. Meeting endet ──> finalize.sh wird ausgefuehrt
           │
           ├── Video (MP4) wird zu MinIO hochgeladen
           │
           ├── Audio (WAV 16kHz) wird extrahiert
           │
           └── Backend-Webhook wird aufgerufen
                       │
                       v
6. Transcription Job wird in Valkey Queue gestellt
           │
           v
7. Worker verarbeitet Audio:
   ├── faster-whisper: Spracherkennung
   ├── pyannote.audio: Sprechererkennung
   └── Aligner: Text + Sprecher zusammenfuehren
           │
           v
8. Export: VTT, SRT, JSON werden generiert
           │
           v
9. Ergebnisse in MinIO + Datenbank gespeichert
</pre>

<hr/>

<h2>2. Jibri Recording Service</h2>

<h3>Technische Details</h3>
<table>
  <tr><th>Komponente</th><th>Technologie</th><th>Beschreibung</th></tr>
  <tr><td>Base Image</td><td>jitsi/jibri:stable-9823</td><td>Offizielles Jitsi Recording Image</td></tr>
  <tr><td>Display</td><td>Xvfb</td><td>Virtual Framebuffer (kein echter Monitor noetig)</td></tr>
  <tr><td>Browser</td><td>Chromium</td><td>Tritt Meeting bei und rendert Video</td></tr>
  <tr><td>Encoding</td><td>FFmpeg</td><td>MP4 (H.264/AAC) + WAV Audio-Extraktion</td></tr>
  <tr><td>Upload</td><td>MinIO Client (mc)</td><td>S3-kompatibler Upload</td></tr>
</table>

<h3>X11/Xvfb Konfiguration</h3>
<p>Jibri benoetigt einen X11-Display. In Docker wird dies mit Xvfb (Virtual Framebuffer) realisiert:</p>
<pre>
# Konfiguration
DISPLAY=:0
RESOLUTION=1920x1080x24

# Start-Sequenz
1. Xvfb :0 -screen 0 1920x1080x24 startet
2. Chromium verbindet sich zum virtuellen Display
3. FFmpeg captured den Display-Inhalt
4. Video wird als MP4 gespeichert
</pre>

<h3>Finalize Script (Post-Recording)</h3>
<p>Nach Beendigung einer Aufzeichnung wird automatisch finalize.sh ausgefuehrt:</p>
<ol>
  <li>Video (MP4) zu MinIO hochladen</li>
  <li>Audio (WAV 16kHz mono) fuer Transkription extrahieren</li>
  <li>Audio zu MinIO hochladen</li>
  <li>Backend-Webhook mit Metadaten aufrufen</li>
  <li>Lokale Dateien aufraeumen</li>
</ol>

<hr/>

<h2>3. KI-Transkription</h2>

<h3>Whisper Modell (faster-whisper)</h3>
<table>
  <tr><th>Eigenschaft</th><th>Wert</th><th>Bedeutung</th></tr>
  <tr><td>Modell</td><td>large-v3</td><td>Hoechste Genauigkeit</td></tr>
  <tr><td>Lizenz</td><td>MIT</td><td>Kommerziell nutzbar</td></tr>
  <tr><td>Verarbeitung</td><td>100% lokal</td><td>Keine Cloud-Abhaengigkeit</td></tr>
  <tr><td>Sprachen</td><td>99+ (inkl. Deutsch)</td><td>Automatische Erkennung</td></tr>
  <tr><td>VRAM</td><td>~10GB (GPU)</td><td>CPU-Fallback verfuegbar</td></tr>
</table>

<h3>Speaker Diarization (pyannote.audio)</h3>
<p>Erkennt und unterscheidet verschiedene Sprecher im Audio:</p>
<table>
  <tr><th>Feature</th><th>Beschreibung</th></tr>
  <tr><td>Speaker Detection</td><td>Automatische Erkennung der Anzahl Sprecher</td></tr>
  <tr><td>Speaker ID</td><td>Konsistente Zuweisung (SPEAKER_00, SPEAKER_01, ...)</td></tr>
  <tr><td>Overlap Handling</td><td>Erkennung ueberlappender Sprache</td></tr>
  <tr><td>Lizenz</td><td>MIT (kommerziell nutzbar)</td></tr>
</table>

<h3>Verarbeitungsgeschwindigkeit</h3>
<table>
  <tr><th>Hardware</th><th>Geschwindigkeit</th><th>1h Audio</th></tr>
  <tr><td>GPU (CUDA)</td><td>~10x Echtzeit</td><td>~6 Minuten</td></tr>
  <tr><td>CPU (int8)</td><td>~0.5x Echtzeit</td><td>~2 Stunden</td></tr>
</table>

<h3>Export-Formate</h3>
<table>
  <tr><th>Format</th><th>Verwendung</th><th>Beispiel</th></tr>
  <tr><td>WebVTT (.vtt)</td><td>Browser-Untertitel</td><td>00:00:01.500 --> 00:00:03.200<br/>Guten Tag, willkommen zum Meeting.</td></tr>
  <tr><td>SRT (.srt)</td><td>Video-Player</td><td>1<br/>00:00:01,500 --> 00:00:03,200<br/>Guten Tag, willkommen zum Meeting.</td></tr>
  <tr><td>JSON</td><td>Programmatisch</td><td>Segmente mit Zeitstempel, Text, Sprecher, Konfidenz</td></tr>
</table>

<hr/>

<h2>4. DSGVO-Konformitaet</h2>

<h3>Rechtsgrundlage (Art. 6 DSGVO)</h3>
<table>
  <tr><th>Verarbeitung</th><th>Rechtsgrundlage</th><th>Umsetzung</th></tr>
  <tr><td>Videokonferenz</td><td>Art. 6(1)(b) - Vertragserfuellung</td><td>Notwendig fuer Unterricht</td></tr>
  <tr><td>Recording</td><td>Art. 6(1)(a) - Einwilligung</td><td>Explizite Zustimmung aller Teilnehmer</td></tr>
  <tr><td>Transkription</td><td>Art. 6(1)(a) - Einwilligung</td><td>Abgeleitet von Recording-Consent</td></tr>
  <tr><td>Protokolle</td><td>Art. 6(1)(a) - Einwilligung</td><td>Opt-in fuer KI-Zusammenfassung</td></tr>
</table>

<h3>Consent-Management</h3>
<pre>
Recording-Anfrage
       │
       v
┌─────────────────────────────────────┐
│  Consent-Dialog an alle Teilnehmer  │
│                                     │
│  "Die Aufzeichnung dieses Meetings  │
│   wurde angefragt. Stimmen Sie zu?" │
│                                     │
│  [ Zustimmen ]    [ Ablehnen ]      │
└─────────────────┬───────────────────┘
                  │
    ┌─────────────┴─────────────┐
    │                           │
    v                           v
Alle stimmen zu           Mind. 1 lehnt ab
    │                           │
    v                           v
Recording startet         Recording wird
                          nicht gestartet
</pre>

<h3>Audit-Logging (Art. 30 DSGVO)</h3>
<p>Alle Zugriffe auf Aufzeichnungen werden protokolliert:</p>
<table>
  <tr><th>Aktion</th><th>Protokollierte Daten</th></tr>
  <tr><td>Recording erstellt</td><td>Zeitpunkt, Meeting-ID, Ersteller</td></tr>
  <tr><td>Recording angesehen</td><td>Zeitpunkt, Nutzer-ID, IP (anonymisiert)</td></tr>
  <tr><td>Transkription abgerufen</td><td>Zeitpunkt, Nutzer-ID, Format</td></tr>
  <tr><td>Recording geloescht</td><td>Zeitpunkt, Nutzer-ID, Grund</td></tr>
</table>

<h3>Loeschrecht (Art. 17 DSGVO)</h3>
<ul>
  <li><strong>Automatische Loeschung:</strong> Nach 365 Tagen (konfigurierbar)</li>
  <li><strong>Manuelle Loeschung:</strong> Jederzeit durch Ersteller oder Admin</li>
  <li><strong>Soft-Delete:</strong> Audit-Trail bleibt erhalten (ohne Inhalt)</li>
  <li><strong>Loeschanfrage:</strong> Wird innerhalb von 30 Tagen bearbeitet</li>
</ul>

<h3>Technische Datenschutz-Massnahmen</h3>
<table>
  <tr><th>Massnahme</th><th>Umsetzung</th><th>Wirkung</th></tr>
  <tr><td>Verschluesselung at-rest</td><td>MinIO Server-Side Encryption</td><td>Schutz gespeicherter Daten</td></tr>
  <tr><td>Verschluesselung in-transit</td><td>TLS 1.3</td><td>Schutz bei Uebertragung</td></tr>
  <tr><td>Zugangskontrolle</td><td>RBAC (Role-Based Access)</td><td>Nur autorisierter Zugriff</td></tr>
  <tr><td>Anonymisierte Speaker-IDs</td><td>SPEAKER_00, SPEAKER_01</td><td>Keine Namensverknuepfung</td></tr>
  <tr><td>Lokale KI-Verarbeitung</td><td>On-Premise Whisper/pyannote</td><td>Kein Datenabfluss</td></tr>
</table>

<hr/>

<h2>5. API Endpoints</h2>

<h3>Recordings API</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/recordings</td><td>GET</td><td>Recordings auflisten (paginiert)</td></tr>
  <tr><td>/api/recordings/{id}</td><td>GET</td><td>Recording Details abrufen</td></tr>
  <tr><td>/api/recordings/{id}</td><td>DELETE</td><td>Recording loeschen (DSGVO Art. 17)</td></tr>
  <tr><td>/api/recordings/webhook</td><td>POST</td><td>Jibri Upload Callback</td></tr>
  <tr><td>/api/recordings/{id}/transcribe</td><td>POST</td><td>Transkription starten</td></tr>
  <tr><td>/api/recordings/{id}/transcription</td><td>GET</td><td>Transkriptions-Status</td></tr>
  <tr><td>/api/recordings/{id}/transcription/text</td><td>GET</td><td>Volltext abrufen</td></tr>
  <tr><td>/api/recordings/{id}/transcription/vtt</td><td>GET</td><td>WebVTT herunterladen</td></tr>
  <tr><td>/api/recordings/{id}/transcription/srt</td><td>GET</td><td>SRT herunterladen</td></tr>
</table>

<h3>Meeting Consent API</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/meeting-consent/{meeting_id}</td><td>GET</td><td>Consent-Status abfragen</td></tr>
  <tr><td>/api/meeting-consent/request</td><td>POST</td><td>Recording-Consent anfordern</td></tr>
  <tr><td>/api/meeting-consent/{meeting_id}/participant</td><td>POST</td><td>Teilnehmer-Consent abgeben</td></tr>
  <tr><td>/api/meeting-consent/{meeting_id}/withdraw</td><td>POST</td><td>Consent zurueckziehen</td></tr>
</table>

<hr/>

<h2>6. Datenbank-Schema</h2>

<h3>Recordings Tabelle</h3>
<pre>
recordings (
    id UUID PRIMARY KEY,
    meeting_id VARCHAR(255) NOT NULL,
    title VARCHAR(500),
    storage_path VARCHAR(1000),      -- MinIO Pfad
    audio_path VARCHAR(1000),        -- Audio fuer Transkription
    duration_seconds INTEGER,
    participant_count INTEGER,
    status VARCHAR(50),              -- uploaded, processing, ready, failed
    created_by UUID,
    recorded_at TIMESTAMP,
    retention_days INTEGER DEFAULT 365,
    deleted_at TIMESTAMP             -- Soft-Delete
)
</pre>

<h3>Transcriptions Tabelle</h3>
<pre>
transcriptions (
    id UUID PRIMARY KEY,
    recording_id UUID REFERENCES recordings(id),
    language VARCHAR(10) DEFAULT 'de',
    model VARCHAR(100) DEFAULT 'large-v3',
    status VARCHAR(50),              -- pending, processing, completed, failed
    full_text TEXT,
    vtt_path VARCHAR(1000),
    srt_path VARCHAR(1000),
    confidence_score FLOAT,
    word_count INTEGER,
    processing_duration_seconds INTEGER,
    created_at TIMESTAMP
)
</pre>

<h3>Consent Tabelle</h3>
<pre>
meeting_recording_consents (
    id UUID PRIMARY KEY,
    meeting_id VARCHAR(255) NOT NULL,
    user_id UUID REFERENCES users(id),
    consent_type VARCHAR(50),        -- opt_in, announced
    all_participants_consented BOOLEAN,
    consented_at TIMESTAMP,
    withdrawn_at TIMESTAMP
)
</pre>

<h3>Audit Log</h3>
<pre>
recording_audit_log (
    id UUID PRIMARY KEY,
    recording_id UUID,
    user_id UUID,
    action VARCHAR(100),             -- created, viewed, deleted, exported
    ip_address_hash VARCHAR(64),     -- SHA-256 fuer Anonymisierung
    created_at TIMESTAMP
)
</pre>

<hr/>

<h2>7. Open Source Lizenzen (SBOM)</h2>

<h3>Jitsi Stack</h3>
<table>
  <tr><th>Komponente</th><th>Lizenz</th><th>Kommerziell</th><th>Quelle</th></tr>
  <tr><td>Jitsi Meet</td><td>Apache-2.0</td><td>Ja</td><td>github.com/jitsi/jitsi-meet</td></tr>
  <tr><td>Jibri</td><td>Apache-2.0</td><td>Ja</td><td>github.com/jitsi/jibri</td></tr>
  <tr><td>Jicofo</td><td>Apache-2.0</td><td>Ja</td><td>github.com/jitsi/jicofo</td></tr>
  <tr><td>Videobridge</td><td>Apache-2.0</td><td>Ja</td><td>github.com/jitsi/jitsi-videobridge</td></tr>
</table>

<h3>Transkription</h3>
<table>
  <tr><th>Komponente</th><th>Lizenz</th><th>Kommerziell</th><th>Quelle</th></tr>
  <tr><td>faster-whisper</td><td>MIT</td><td>Ja</td><td>github.com/SYSTRAN/faster-whisper</td></tr>
  <tr><td>pyannote.audio</td><td>MIT</td><td>Ja</td><td>github.com/pyannote/pyannote-audio</td></tr>
  <tr><td>FFmpeg</td><td>LGPL/GPL</td><td>Ja*</td><td>ffmpeg.org (*dynamisch gelinkt)</td></tr>
  <tr><td>RQ</td><td>BSD-2-Clause</td><td>Ja</td><td>github.com/rq/rq</td></tr>
</table>

<h3>Infrastruktur</h3>
<table>
  <tr><th>Komponente</th><th>Lizenz</th><th>Kommerziell</th><th>Quelle</th></tr>
  <tr><td>MinIO</td><td>AGPL-3.0</td><td>Ja</td><td>github.com/minio/minio</td></tr>
  <tr><td>PostgreSQL</td><td>PostgreSQL</td><td>Ja</td><td>postgresql.org</td></tr>
  <tr><td>Valkey</td><td>BSD-3-Clause</td><td>Ja</td><td>github.com/valkey-io/valkey</td></tr>
  <tr><td>Coturn</td><td>BSD-3-Clause</td><td>Ja</td><td>github.com/coturn/coturn</td></tr>
</table>

<hr/>

<h2>8. KI-Protokoll Generator (Geplant)</h2>

<h3>Meetily Integration</h3>
<p>Fuer automatische Meeting-Protokolle ist die Integration von Meetily geplant:</p>
<table>
  <tr><th>Feature</th><th>Beschreibung</th></tr>
  <tr><td>Zusammenfassung</td><td>KI-generierte Kurzfassung des Meetings</td></tr>
  <tr><td>Action Items</td><td>Automatisch erkannte Aufgaben</td></tr>
  <tr><td>Themen-Gliederung</td><td>Strukturierte Themenuebersicht</td></tr>
  <tr><td>Entscheidungen</td><td>Dokumentierte Beschluesse</td></tr>
</table>

<h3>Technologie-Stack</h3>
<ul>
  <li><strong>Meetily:</strong> Open Source (github.com/Zackriya-Solutions/meeting-minutes)</li>
  <li><strong>Verarbeitung:</strong> 100% lokal mit Ollama LLMs</li>
  <li><strong>Modelle:</strong> Llama 3, Mistral, oder Claude (optional)</li>
  <li><strong>Export:</strong> Markdown, PDF, Word</li>
</ul>

<hr/>

<h2>9. Betrieb & Monitoring</h2>

<h3>Health Checks</h3>
<table>
  <tr><th>Service</th><th>Endpoint</th><th>Erwartung</th></tr>
  <tr><td>Jitsi Videobridge</td><td>/about/health</td><td>200 OK</td></tr>
  <tr><td>Jibri</td><td>/jibri/api/v1.0/health</td><td>IDLE/BUSY</td></tr>
  <tr><td>MinIO</td><td>/minio/health/live</td><td>200 OK</td></tr>
  <tr><td>Transcription Worker</td><td>RQ Queue Status</td><td>Workers > 0</td></tr>
</table>

<h3>Backup-Strategie</h3>
<pre>
Backup-Komponenten:
├── PostgreSQL: Taeglich, 30 Tage Retention
├── MinIO Recordings: Woechentlich, 365 Tage Retention
├── Konfiguration: Git-versioniert
└── Secrets: Extern verschluesselt gespeichert
</pre>

<h3>Notfallprozeduren</h3>
<ol>
  <li><strong>Jibri Recording fehlgeschlagen:</strong> Logs pruefen, Xvfb neu starten</li>
  <li><strong>Transkription haengt:</strong> Worker-Queue leeren, Worker neu starten</li>
  <li><strong>Storage voll:</strong> Alte Recordings gemaess Retention loeschen</li>
  <li><strong>Datenpanne:</strong> Betroffene Recordings isolieren, DSB informieren</li>
</ol>

<hr/>

<h2>10. Kontakt & Support</h2>
<ul>
  <li><strong>Technischer Support:</strong> support@breakpilot.de</li>
  <li><strong>Datenschutzbeauftragter:</strong> dsb@breakpilot.de</li>
  <li><strong>Dokumentation:</strong> docs.breakpilot.de</li>
  <li><strong>GitHub:</strong> github.com/breakpilot</li>
</ul>
`,
  },

  // Mail/Unified Inbox
  mail: {
    title: 'Unified Inbox System-Info',
    description: 'E-Mail-Management mit KI-Analyse und Automatisierung.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Inbox UI', components: ['Mail List', 'Compose', 'AI Summary'], color: '#3b82f6' },
        { title: 'Mail Service', components: ['IMAP Sync', 'SMTP Send', 'Parser'], color: '#8b5cf6' },
        { title: 'AI Pipeline', components: ['Classification', 'Summarization', 'Response Draft'], color: '#10b981' },
        { title: 'Storage', components: ['PostgreSQL', 'MinIO (Attachments)', 'Vector DB'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Multi-Account Support', status: 'active', description: 'Mehrere E-Mail-Konten' },
      { name: 'KI-Zusammenfassung', status: 'planned', description: 'Automatische E-Mail-Zusammenfassung' },
      { name: 'Smart Categorization', status: 'planned', description: 'KI-basierte Kategorisierung' },
      { name: 'Response Suggestions', status: 'planned', description: 'Antwort-Vorschlaege' },
    ],
    roadmap: [
      { phase: 'Phase 1: Core (Q1)', priority: 'high', items: ['IMAP/SMTP Integration', 'Multi-Account', 'Search', 'Attachments'] },
      { phase: 'Phase 2: AI (Q2)', priority: 'high', items: ['E-Mail Classification', 'Priority Detection', 'Sentiment Analysis', 'Spam Detection'] },
      { phase: 'Phase 3: Automation (Q3)', priority: 'medium', items: ['Auto-Responses', 'Rules Engine', 'Workflow Triggers', 'CRM Integration'] },
    ],
    technicalDetails: [
      { component: 'IMAP', technology: 'imaplib/imapclient', description: 'E-Mail Empfang' },
      { component: 'SMTP', technology: 'smtplib', description: 'E-Mail Versand' },
      { component: 'AI', technology: 'OpenAI GPT-4', description: 'Text Analysis' },
      { component: 'Search', technology: 'PostgreSQL FTS', description: 'Volltextsuche' },
    ],
    auditInfo: [
      {
        category: 'E-Mail Konten',
        items: [
          { label: 'Konfigurierte Konten', value: 'Variabel', status: 'ok' },
          { label: 'IMAP Sync', value: 'Aktiviert', status: 'ok' },
          { label: 'SMTP Versand', value: 'Aktiviert', status: 'ok' },
          { label: 'OAuth2 Support', value: 'Google, Microsoft', status: 'ok' },
        ],
      },
      {
        category: 'Sicherheit',
        items: [
          { label: 'Verschluesselung', value: 'TLS Required', status: 'ok' },
          { label: 'Credential Storage', value: 'Encrypted', status: 'ok' },
          { label: 'Spam-Filter', value: 'SpamAssassin', status: 'ok' },
          { label: 'Virus-Scan', value: 'ClamAV', status: 'ok' },
        ],
      },
      {
        category: 'KI-Features',
        items: [
          { label: 'Kategorisierung', value: 'Geplant', status: 'warning' },
          { label: 'Zusammenfassung', value: 'Geplant', status: 'warning' },
          { label: 'Antwort-Vorschlaege', value: 'Geplant', status: 'warning' },
          { label: 'Sentiment Analysis', value: 'Geplant', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Unified Inbox - E-Mail Management</h2>

<h3>1. Uebersicht</h3>
<p>Der Unified Inbox aggregiert E-Mails aus mehreren Konten in einer zentralen Oberflaeche. Geplant ist die Integration von KI-Features fuer automatische Kategorisierung und Zusammenfassung.</p>

<h3>2. Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────────┐
│                         Unified Inbox UI                             │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────────┐  │
│  │   Inbox      │  │   Compose    │  │   AI Summary (planned)   │  │
│  └──────────────┘  └──────────────┘  └──────────────────────────┘  │
└─────────────────────────────┬───────────────────────────────────────┘
                              │
                              v
┌─────────────────────────────────────────────────────────────────────┐
│                        Mail Service                                  │
│  ┌────────────┐  ┌────────────┐  ┌────────────┐  ┌────────────┐    │
│  │ IMAP Sync  │  │ SMTP Send  │  │  Parser    │  │ AI Pipeline│    │
│  └────────────┘  └────────────┘  └────────────┘  └────────────┘    │
└─────────────────────────────┬───────────────────────────────────────┘
                              │
          ┌───────────────────┴───────────────────┐
          │                                       │
          v                                       v
┌─────────────────────────┐         ┌─────────────────────────┐
│    External Mail        │         │    Internal Storage     │
│  ├── Gmail              │         │  ├── PostgreSQL         │
│  ├── Outlook            │         │  ├── MinIO (Attachments)│
│  └── Custom IMAP        │         │  └── Qdrant (Embeddings)│
└─────────────────────────┘         └─────────────────────────┘
</pre>

<h3>3. Unterstuetzte Provider</h3>
<table>
  <tr><th>Provider</th><th>Auth-Methode</th><th>Features</th></tr>
  <tr><td>Gmail</td><td>OAuth2</td><td>Labels, Push-Sync</td></tr>
  <tr><td>Outlook/365</td><td>OAuth2</td><td>Folders, Categories</td></tr>
  <tr><td>Custom IMAP</td><td>User/Pass</td><td>Standard IMAP</td></tr>
  <tr><td>Exchange</td><td>OAuth2/EWS</td><td>Geplant</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/mail/accounts</td><td>GET</td><td>Konfigurierte Konten</td></tr>
  <tr><td>/api/mail/accounts</td><td>POST</td><td>Konto hinzufuegen</td></tr>
  <tr><td>/api/mail/messages</td><td>GET</td><td>E-Mails abrufen</td></tr>
  <tr><td>/api/mail/messages</td><td>POST</td><td>E-Mail senden</td></tr>
  <tr><td>/api/mail/messages/{id}</td><td>GET</td><td>E-Mail-Details</td></tr>
  <tr><td>/api/mail/sync</td><td>POST</td><td>Manueller Sync</td></tr>
</table>

<h3>5. Sync-Strategie</h3>
<pre>
Initial Sync
     │
     v
┌───────────────────────────────────────┐
│  1. Fetch Folder Structure            │
│  2. Sync Last 30 Days                 │
│  3. Index Messages                    │
│  4. Generate Embeddings (optional)    │
└─────────────────┬─────────────────────┘
                  │
                  v
Incremental Sync (alle 5 Min)
     │
     v
┌───────────────────────────────────────┐
│  1. Check for new Messages (IDLE)     │
│  2. Fetch new Messages                │
│  3. Update Index                      │
│  4. Process AI Pipeline               │
└───────────────────────────────────────┘
</pre>

<h3>6. KI-Pipeline (Geplant)</h3>
<table>
  <tr><th>Feature</th><th>Modell</th><th>Beschreibung</th></tr>
  <tr><td>Kategorisierung</td><td>Fine-tuned Classifier</td><td>Inbox, Support, Newsletter, etc.</td></tr>
  <tr><td>Prioritaet</td><td>Sentiment + Rules</td><td>Hoch, Mittel, Niedrig</td></tr>
  <tr><td>Zusammenfassung</td><td>GPT-4o-mini</td><td>Kurzfassung langer E-Mails</td></tr>
  <tr><td>Antwort-Draft</td><td>GPT-4o</td><td>Vorgeschlagene Antworten</td></tr>
</table>

<h3>7. Sicherheit</h3>
<ul>
  <li><strong>Credentials:</strong> AES-256 verschluesselt in DB</li>
  <li><strong>OAuth Tokens:</strong> Refresh Token rotiert</li>
  <li><strong>Transport:</strong> TLS 1.2+ required</li>
  <li><strong>Attachments:</strong> Virus-Scan vor Speicherung</li>
  <li><strong>Spam:</strong> SpamAssassin Score-basiert</li>
</ul>

<h3>8. Datenschutz</h3>
<table>
  <tr><th>Aspekt</th><th>Massnahme</th></tr>
  <tr><td>E-Mail-Inhalte</td><td>Lokal gespeichert, nicht an Dritte</td></tr>
  <tr><td>KI-Verarbeitung</td><td>Opt-in, PII-Filterung</td></tr>
  <tr><td>Retention</td><td>Spiegelt Provider-Einstellung</td></tr>
  <tr><td>Loeschung</td><td>Sync mit Provider</td></tr>
</table>

<h3>9. Suche</h3>
<pre>
Suchanfrage
     │
     ├── Volltext (PostgreSQL FTS)
     │   └── Subject, Body, Sender
     │
     ├── Semantisch (Qdrant - geplant)
     │   └── Bedeutungsbasierte Suche
     │
     └── Filter
         ├── Datum
         ├── Konto
         ├── Folder
         └── Has Attachment
</pre>

<h3>10. Troubleshooting</h3>
<table>
  <tr><th>Problem</th><th>Ursache</th><th>Loesung</th></tr>
  <tr><td>Sync fehlgeschlagen</td><td>Credentials abgelaufen</td><td>Re-Auth via OAuth</td></tr>
  <tr><td>E-Mails fehlen</td><td>Folder nicht subscribed</td><td>Folder-Auswahl pruefen</td></tr>
  <tr><td>Versand fehlgeschlagen</td><td>SMTP-Limit erreicht</td><td>Provider-Limits beachten</td></tr>
  <tr><td>Langsamer Sync</td><td>Grosse Mailbox</td><td>Incremental Sync nutzen</td></tr>
</table>
`,
  },

  // SBOM
  sbom: {
    title: 'SBOM System-Info',
    description: 'Software Bill of Materials fuer Compliance und Security.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'SBOM Dashboard', components: ['Dependency Tree', 'License Overview', 'CVE Alerts'], color: '#3b82f6' },
        { title: 'Generators', components: ['Syft', 'Trivy', 'CycloneDX'], color: '#8b5cf6' },
        { title: 'Analysis', components: ['License Checker', 'CVE Matcher', 'Outdated Detector'], color: '#10b981' },
        { title: 'Reports', components: ['JSON', 'SPDX', 'CycloneDX'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Dependency Scanning', status: 'active', description: 'Automatische Erkennung' },
      { name: 'License Compliance', status: 'active', description: 'Lizenz-Pruefung' },
      { name: 'CVE Matching', status: 'active', description: 'Schwachstellen-Erkennung' },
      { name: 'Automatic Updates', status: 'planned', description: 'Dependabot-artige Updates' },
    ],
    roadmap: [
      { phase: 'Phase 1: Generation (Q1)', priority: 'high', items: ['Multi-Format Export', 'CI/CD Integration', 'Container SBOM', 'Runtime SBOM'] },
      { phase: 'Phase 2: Analysis (Q2)', priority: 'medium', items: ['License Risk Scoring', 'Transitive Dependencies', 'Version Comparison', 'Diff Reports'] },
      { phase: 'Phase 3: Governance (Q3)', priority: 'low', items: ['Policy Engine', 'Approval Workflow', 'Audit Trail', 'Supplier Management'] },
    ],
    technicalDetails: [
      { component: 'Generator', technology: 'Syft', version: '1.x', description: 'SBOM Creation' },
      { component: 'Format', technology: 'CycloneDX', version: '1.5', description: 'Standard Format' },
      { component: 'CVE DB', technology: 'NVD/OSV', description: 'Vulnerability Data' },
      { component: 'License DB', technology: 'SPDX', description: 'License Identifiers' },
    ],
    auditInfo: [
      {
        category: 'SBOM Status',
        items: [
          { label: 'Letzte Generierung', value: 'CI/CD', status: 'ok' },
          { label: 'Format', value: 'CycloneDX 1.5', status: 'ok' },
          { label: 'Komponenten', value: 'Alle erfasst', status: 'ok' },
          { label: 'Transitive Deps', value: 'Inkludiert', status: 'ok' },
        ],
      },
      {
        category: 'Vulnerability Status',
        items: [
          { label: 'Kritische CVEs', value: '0', status: 'ok' },
          { label: 'Hohe CVEs', value: '0', status: 'ok' },
          { label: 'Outdated Packages', value: 'Tracking', status: 'warning' },
          { label: 'EOL Dependencies', value: '0', status: 'ok' },
        ],
      },
      {
        category: 'License Compliance',
        items: [
          { label: 'Erlaubte Lizenzen', value: 'MIT, Apache, BSD', status: 'ok' },
          { label: 'Copyleft (GPL)', value: '0', status: 'ok' },
          { label: 'Unbekannte Lizenzen', value: '0', status: 'ok' },
          { label: 'Kommerzielle', value: 'Review erforderlich', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Software Bill of Materials (SBOM)</h2>

<h3>1. Uebersicht</h3>
<p>Das SBOM-Modul generiert und analysiert die vollstaendige Komponentenliste aller Software-Abhaengigkeiten. Es dient der Compliance, Sicherheit und Supply-Chain-Transparenz.</p>

<h3>2. SBOM-Generierung</h3>
<pre>
Source Code
     │
     v
┌───────────────────────────────────────────────────────────────┐
│                     SBOM Generators                           │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐   │
│  │    Syft     │  │   Trivy     │  │  Native Tooling     │   │
│  │  (Primary)  │  │ (Validation)│  │ (npm, go mod, pip)  │   │
│  └──────┬──────┘  └──────┬──────┘  └──────────┬──────────┘   │
└─────────┼────────────────┼────────────────────┼───────────────┘
          │                │                    │
          └────────────────┴────────────────────┘
                           │
                           v
                  ┌────────────────┐
                  │   CycloneDX    │
                  │    Format      │
                  └────────────────┘
</pre>

<h3>3. Erfasste Komponenten</h3>
<table>
  <tr><th>Typ</th><th>Quelle</th><th>Beispiele</th></tr>
  <tr><td>npm packages</td><td>package-lock.json</td><td>react, next, tailwindcss</td></tr>
  <tr><td>Go modules</td><td>go.sum</td><td>gin, gorm, jwt-go</td></tr>
  <tr><td>Python packages</td><td>requirements.txt</td><td>fastapi, pydantic, httpx</td></tr>
  <tr><td>Container Images</td><td>Dockerfile</td><td>node:20-alpine, postgres:16</td></tr>
  <tr><td>OS Packages</td><td>apk, apt</td><td>openssl, libpq</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/sbom/generate</td><td>POST</td><td>SBOM neu generieren</td></tr>
  <tr><td>/api/sbom/latest</td><td>GET</td><td>Aktuelles SBOM</td></tr>
  <tr><td>/api/sbom/vulnerabilities</td><td>GET</td><td>CVE-Liste</td></tr>
  <tr><td>/api/sbom/licenses</td><td>GET</td><td>Lizenz-Uebersicht</td></tr>
  <tr><td>/api/sbom/diff</td><td>GET</td><td>Vergleich mit vorheriger Version</td></tr>
</table>

<h3>5. Vulnerability Scanning</h3>
<pre>
SBOM
  │
  v
┌────────────────────────────────────────┐
│         Vulnerability Databases        │
│  ├── NVD (National Vulnerability DB)  │
│  ├── OSV (Open Source Vulnerabilities)│
│  ├── GitHub Advisory Database         │
│  └── Vendor-specific (npm, Go, PyPI)  │
└──────────────────┬─────────────────────┘
                   │
                   v
┌────────────────────────────────────────┐
│          CVE Matching Engine           │
│  ├── Version Range Checking            │
│  ├── CVSS Scoring                      │
│  └── Exploitability Assessment         │
└──────────────────┬─────────────────────┘
                   │
                   v
┌────────────────────────────────────────┐
│           Alert & Report               │
│  ├── Kritisch: Sofort-Benachrichtigung│
│  ├── Hoch: Tages-Report               │
│  └── Mittel/Niedrig: Wochen-Report    │
└────────────────────────────────────────┘
</pre>

<h3>6. License Compliance</h3>
<table>
  <tr><th>Kategorie</th><th>Lizenzen</th><th>Status</th></tr>
  <tr><td>Permissive (erlaubt)</td><td>MIT, Apache 2.0, BSD, ISC</td><td>✓ OK</td></tr>
  <tr><td>Weak Copyleft</td><td>LGPL, MPL</td><td>⚠ Review</td></tr>
  <tr><td>Strong Copyleft</td><td>GPL, AGPL</td><td>✗ Nicht erlaubt</td></tr>
  <tr><td>Proprietaer</td><td>Commercial</td><td>⚠ Genehmigung</td></tr>
</table>

<h3>7. CI/CD Integration</h3>
<pre>
CI Pipeline
     │
     ├── Build Stage
     │   └── SBOM generieren
     │
     ├── Security Stage
     │   ├── CVE Scan
     │   └── License Check
     │
     ├── Gate
     │   ├── Critical CVE → Block
     │   ├── GPL License → Block
     │   └── High CVE → Warning
     │
     └── Publish Stage
         └── SBOM archivieren
</pre>

<h3>8. SBOM Format (CycloneDX)</h3>
<pre>
{
  "bomFormat": "CycloneDX",
  "specVersion": "1.5",
  "version": 1,
  "metadata": {
    "timestamp": "2025-01-14T10:00:00Z",
    "component": {
      "name": "breakpilot-pwa",
      "version": "1.0.0"
    }
  },
  "components": [
    {
      "type": "library",
      "name": "react",
      "version": "19.0.0",
      "purl": "pkg:npm/react@19.0.0",
      "licenses": [{"id": "MIT"}],
      "hashes": [{"alg": "SHA-256", "content": "..."}]
    }
  ]
}
</pre>

<h3>9. Diff-Report</h3>
<table>
  <tr><th>Aenderung</th><th>Details</th><th>Risiko</th></tr>
  <tr><td>Neu hinzugefuegt</td><td>Package + Version</td><td>License/CVE Check</td></tr>
  <tr><td>Aktualisiert</td><td>Alte → Neue Version</td><td>Breaking Changes</td></tr>
  <tr><td>Entfernt</td><td>Package entfernt</td><td>Dependency Check</td></tr>
  <tr><td>CVE behoben</td><td>CVE-ID</td><td>Positiv</td></tr>
</table>

<h3>10. Aufbewahrung & Compliance</h3>
<ul>
  <li><strong>Retention:</strong> 5 Jahre (Compliance)</li>
  <li><strong>Format:</strong> JSON + PDF Report</li>
  <li><strong>Signierung:</strong> Digital signiert</li>
  <li><strong>Audit:</strong> Jederzeit abrufbar</li>
</ul>
`,
  },

  // Brandbook
  brandbook: {
    title: 'Brandbook System-Info',
    description: 'Corporate Design Guidelines und Style Guide.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Style Guide UI', components: ['Colors', 'Typography', 'Components'], color: '#3b82f6' },
        { title: 'Design Tokens', components: ['CSS Variables', 'Tailwind Config', 'Figma Tokens'], color: '#8b5cf6' },
        { title: 'Assets', components: ['Logo', 'Icons', 'Illustrations'], color: '#10b981' },
        { title: 'Documentation', components: ['Usage Guidelines', 'Examples', 'Do/Donts'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Farb-Palette', status: 'active', description: 'Primaer- und Sekundaerfarben' },
      { name: 'Typografie', status: 'active', description: 'Schriftarten und -groessen' },
      { name: 'Komponenten-Bibliothek', status: 'active', description: 'UI-Komponenten-Dokumentation' },
      { name: 'Figma Sync', status: 'planned', description: 'Design Token Synchronisation' },
    ],
    roadmap: [
      { phase: 'Phase 1: Foundation (Q1)', priority: 'high', items: ['Design Tokens', 'Color System', 'Typography Scale', 'Spacing System'] },
      { phase: 'Phase 2: Components (Q2)', priority: 'medium', items: ['Button Variants', 'Form Elements', 'Cards', 'Navigation'] },
      { phase: 'Phase 3: Templates (Q3)', priority: 'low', items: ['Page Templates', 'E-Mail Templates', 'Print Templates', 'Social Media'] },
    ],
    technicalDetails: [
      { component: 'CSS', technology: 'Tailwind CSS', version: '3.x', description: 'Utility Classes' },
      { component: 'Icons', technology: 'Heroicons', version: '2.x', description: 'SVG Icons' },
      { component: 'Fonts', technology: 'Inter/System', description: 'Web Fonts' },
      { component: 'Design', technology: 'Figma', description: 'Design Source' },
    ],
    auditInfo: [
      {
        category: 'Design System Status',
        items: [
          { label: 'Farbpalette', value: 'Definiert', status: 'ok' },
          { label: 'Typografie', value: 'Definiert', status: 'ok' },
          { label: 'Komponenten', value: '15+ Komponenten', status: 'ok' },
          { label: 'Figma Sync', value: 'Geplant', status: 'warning' },
        ],
      },
      {
        category: 'Dokumentation',
        items: [
          { label: 'Usage Guidelines', value: 'Vorhanden', status: 'ok' },
          { label: 'Code Examples', value: 'Vorhanden', status: 'ok' },
          { label: 'Do/Donts', value: 'Vorhanden', status: 'ok' },
          { label: 'Accessibility', value: 'WCAG 2.1 AA', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Brandbook & Design System</h2>

<h3>1. Uebersicht</h3>
<p>Das Brandbook definiert alle visuellen Elemente der BreakPilot-Marke. Es dient als zentrale Referenz fuer konsistentes Design ueber alle Produkte und Plattformen.</p>

<h3>2. Farbpalette</h3>
<table>
  <tr><th>Name</th><th>Hex</th><th>Verwendung</th></tr>
  <tr><td>Primary</td><td>#3B82F6</td><td>Buttons, Links, Akzente</td></tr>
  <tr><td>Primary Dark</td><td>#1E40AF</td><td>Hover States</td></tr>
  <tr><td>Secondary</td><td>#8B5CF6</td><td>Sekundaere Aktionen</td></tr>
  <tr><td>Success</td><td>#10B981</td><td>Erfolg, Bestaetigung</td></tr>
  <tr><td>Warning</td><td>#F59E0B</td><td>Warnungen</td></tr>
  <tr><td>Error</td><td>#EF4444</td><td>Fehler, Loeschung</td></tr>
  <tr><td>Slate 900</td><td>#0F172A</td><td>Text, Headings</td></tr>
  <tr><td>Slate 500</td><td>#64748B</td><td>Sekundaerer Text</td></tr>
</table>

<h3>3. Typografie</h3>
<pre>
Font Family: Inter (System Fallback)

Scale:
├── Display:  2.25rem (36px) / Bold
├── H1:       1.875rem (30px) / Semibold
├── H2:       1.5rem (24px) / Semibold
├── H3:       1.25rem (20px) / Medium
├── Body:     1rem (16px) / Regular
├── Small:    0.875rem (14px) / Regular
└── Caption:  0.75rem (12px) / Regular
</pre>

<h3>4. Spacing System</h3>
<table>
  <tr><th>Token</th><th>Wert</th><th>Verwendung</th></tr>
  <tr><td>space-1</td><td>4px</td><td>Inline-Elemente</td></tr>
  <tr><td>space-2</td><td>8px</td><td>Eng verwandte Elemente</td></tr>
  <tr><td>space-3</td><td>12px</td><td>Standard-Gap</td></tr>
  <tr><td>space-4</td><td>16px</td><td>Sections</td></tr>
  <tr><td>space-6</td><td>24px</td><td>Grosse Sections</td></tr>
  <tr><td>space-8</td><td>32px</td><td>Page Sections</td></tr>
</table>

<h3>5. Komponenten-Bibliothek</h3>
<pre>
Components/
├── Buttons/
│   ├── Primary Button
│   ├── Secondary Button
│   ├── Ghost Button
│   └── Icon Button
├── Forms/
│   ├── Input
│   ├── Select
│   ├── Checkbox
│   └── Radio
├── Feedback/
│   ├── Alert
│   ├── Toast
│   └── Badge
├── Layout/
│   ├── Card
│   ├── Modal
│   └── Sidebar
└── Navigation/
    ├── Tabs
    ├── Breadcrumb
    └── Pagination
</pre>

<h3>6. Icon-System</h3>
<ul>
  <li><strong>Library:</strong> Heroicons v2</li>
  <li><strong>Style:</strong> Outline (24px), Solid (20px)</li>
  <li><strong>Farbe:</strong> currentColor (erbt Text-Farbe)</li>
</ul>

<h3>7. Logo-Verwendung</h3>
<table>
  <tr><th>Variante</th><th>Verwendung</th><th>Min. Groesse</th></tr>
  <tr><td>Primary (Farbe)</td><td>Helle Hintergruende</td><td>120px breit</td></tr>
  <tr><td>White</td><td>Dunkle Hintergruende</td><td>120px breit</td></tr>
  <tr><td>Icon Only</td><td>Favicon, App Icon</td><td>32px</td></tr>
</table>

<h3>8. Accessibility</h3>
<ul>
  <li><strong>Kontrast:</strong> Minimum 4.5:1 fuer Text</li>
  <li><strong>Focus States:</strong> Sichtbarer Fokusring</li>
  <li><strong>Keyboard:</strong> Alle interaktiven Elemente erreichbar</li>
  <li><strong>Screen Reader:</strong> ARIA Labels vorhanden</li>
</ul>

<h3>9. Do's and Don'ts</h3>
<pre>
✓ Do:
  - Konsistente Spacing verwenden
  - Primary Color fuer CTAs
  - Ausreichend Weissraum
  - Hierarchie durch Typografie

✗ Don't:
  - Farben mischen
  - Logo verzerren
  - Zu viele Schriftgroessen
  - Zu wenig Kontrast
</pre>

<h3>10. Design Token Export</h3>
<p>Tokens sind verfuegbar als:</p>
<ul>
  <li>CSS Custom Properties</li>
  <li>Tailwind Config</li>
  <li>Figma Variables (geplant)</li>
  <li>JSON Token File</li>
</ul>
`,
  },

  // DSMS (Datenschutz-Management-System)
  dsms: {
    title: 'DSMS System-Info',
    description: 'Datenschutz-Management-System fuer DSGVO-Compliance.',
    version: '1.0',
    privacyNotes: [
      'Zentrale Verwaltung aller Datenschutz-Prozesse',
      'Verzeichnis der Verarbeitungstaetigkeiten (VVT)',
      'TOM-Dokumentation',
      'Datenschutz-Folgenabschaetzung (DSFA)',
    ],
    architecture: {
      layers: [
        { title: 'DSMS Dashboard', components: ['VVT Editor', 'TOM Manager', 'DSFA Tool'], color: '#3b82f6' },
        { title: 'Compliance Engine', components: ['Risk Assessment', 'Gap Analysis', 'Audit Trail'], color: '#8b5cf6' },
        { title: 'Document Management', components: ['Policies', 'Procedures', 'Records'], color: '#10b981' },
        { title: 'Reporting', components: ['Compliance Reports', 'DPA Dashboard', 'Exports'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'VVT-Verwaltung', status: 'active', description: 'Verzeichnis der Verarbeitungstaetigkeiten' },
      { name: 'TOM-Dokumentation', status: 'active', description: 'Technische und organisatorische Massnahmen' },
      { name: 'DSFA-Tool', status: 'planned', description: 'Datenschutz-Folgenabschaetzung' },
      { name: 'Audit-Management', status: 'planned', description: 'Interne und externe Audits' },
    ],
    roadmap: [
      { phase: 'Phase 1: Dokumentation (Q1)', priority: 'high', items: ['VVT-Erstellung', 'TOM-Katalog', 'Policy-Templates', 'Rollenkonzept'] },
      { phase: 'Phase 2: Compliance (Q2)', priority: 'high', items: ['Gap-Analyse', 'Risk-Scoring', 'Massnahmen-Tracking', 'Deadline-Management'] },
      { phase: 'Phase 3: Automation (Q3)', priority: 'medium', items: ['Auto-Assessments', 'Compliance-Monitoring', 'Alert-System', 'Report-Generator'] },
    ],
    technicalDetails: [
      { component: 'Framework', technology: 'DSGVO/GDPR', description: 'EU-Verordnung' },
      { component: 'Standards', technology: 'ISO 27701', description: 'Privacy Management' },
      { component: 'Storage', technology: 'PostgreSQL', description: 'Verschluesselt' },
      { component: 'Export', technology: 'PDF/Excel', description: 'Audit-Reports' },
    ],
    auditInfo: [
      {
        category: 'DSGVO-Dokumentation',
        items: [
          { label: 'VVT vorhanden', value: 'Ja', status: 'ok' },
          { label: 'TOM dokumentiert', value: 'Ja', status: 'ok' },
          { label: 'DSFA durchgefuehrt', value: 'Geplant', status: 'warning' },
          { label: 'Auftragsverarbeitung', value: 'Dokumentiert', status: 'ok' },
        ],
      },
      {
        category: 'Organisatorisch',
        items: [
          { label: 'DSB benannt', value: 'Ja', status: 'ok' },
          { label: 'Schulungen', value: 'Jaehrlich', status: 'ok' },
          { label: 'Incident Response', value: 'Definiert', status: 'ok' },
          { label: 'Policies aktuell', value: 'Review faellig', status: 'warning' },
        ],
      },
      {
        category: 'Technisch',
        items: [
          { label: 'Verschluesselung', value: 'AES-256', status: 'ok' },
          { label: 'Zugriffskontrolle', value: 'RBAC', status: 'ok' },
          { label: 'Logging', value: 'Aktiviert', status: 'ok' },
          { label: 'Backup', value: 'Taeglich', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Datenschutz-Management-System (DSMS)</h2>

<h3>1. Uebersicht</h3>
<p>Das DSMS bildet alle datenschutzrelevanten Prozesse und Dokumentationen ab. Es dient der Nachweispflicht gemaess DSGVO Art. 5 Abs. 2 (Rechenschaftspflicht).</p>

<h3>2. Kernkomponenten</h3>
<pre>
DSMS
├── Verzeichnis der Verarbeitungstaetigkeiten (VVT)
│   └── Art. 30 DSGVO
├── Technisch-Organisatorische Massnahmen (TOM)
│   └── Art. 32 DSGVO
├── Datenschutz-Folgenabschaetzung (DSFA)
│   └── Art. 35 DSGVO
├── Auftragsverarbeitung (AVV)
│   └── Art. 28 DSGVO
└── Policies & Schulungen
    └── Interne Richtlinien
</pre>

<h3>3. VVT-Struktur</h3>
<table>
  <tr><th>Feld</th><th>Beschreibung</th><th>Beispiel</th></tr>
  <tr><td>Bezeichnung</td><td>Name der Verarbeitung</td><td>Nutzerregistrierung</td></tr>
  <tr><td>Zweck</td><td>Verarbeitungszweck</td><td>Vertragserfuellung</td></tr>
  <tr><td>Rechtsgrundlage</td><td>Art. 6 DSGVO</td><td>Art. 6 Abs. 1 lit. b</td></tr>
  <tr><td>Kategorien Betroffener</td><td>Personengruppen</td><td>Schueler, Lehrer</td></tr>
  <tr><td>Datenkategorien</td><td>Art der Daten</td><td>Stammdaten, E-Mail</td></tr>
  <tr><td>Empfaenger</td><td>Datenempfaenger</td><td>Intern, Auftragsverarbeiter</td></tr>
  <tr><td>Drittlandtransfer</td><td>Uebermittlung</td><td>Nein / Mit SCC</td></tr>
  <tr><td>Loeschfrist</td><td>Aufbewahrung</td><td>Nach Vertragsende</td></tr>
</table>

<h3>4. TOM-Katalog</h3>
<pre>
Technisch-Organisatorische Massnahmen:

Vertraulichkeit (Art. 32 Abs. 1 lit. b):
├── Zutrittskontrolle: Rechenzentrum gesichert
├── Zugangskontrolle: SSH-Keys, MFA
├── Zugriffskontrolle: RBAC, Least Privilege
└── Weitergabekontrolle: TLS 1.3, Verschluesselung

Integritaet (Art. 32 Abs. 1 lit. b):
├── Eingabekontrolle: Audit-Logs
├── Trennungskontrolle: Multi-Tenant Isolation
└── Uebertragungskontrolle: API Authentication

Verfuegbarkeit (Art. 32 Abs. 1 lit. b):
├── Backup: Taeglich, 30 Tage Retention
├── Redundanz: Multi-AZ Deployment
└── Notfallplan: Dokumentiert
</pre>

<h3>5. DSFA-Prozess</h3>
<table>
  <tr><th>Schritt</th><th>Beschreibung</th><th>Verantwortlich</th></tr>
  <tr><td>1. Schwellwert-Analyse</td><td>DSFA erforderlich?</td><td>DSB</td></tr>
  <tr><td>2. Beschreibung</td><td>Verarbeitung dokumentieren</td><td>Fachbereich</td></tr>
  <tr><td>3. Risikobewertung</td><td>Eintrittswahrscheinlichkeit x Schaden</td><td>DSB + IT</td></tr>
  <tr><td>4. Massnahmen</td><td>Risikominimierung</td><td>IT</td></tr>
  <tr><td>5. Restrisiko</td><td>Bewertung, ggf. Konsultation</td><td>DSB</td></tr>
  <tr><td>6. Dokumentation</td><td>DSFA-Report</td><td>DSB</td></tr>
</table>

<h3>6. Auftragsverarbeitung</h3>
<pre>
Auftragsverarbeiter-Uebersicht:

┌────────────────────────────────────────────────────┐
│ Anbieter        │ Zweck          │ Standort │ AVV │
├────────────────────────────────────────────────────┤
│ Hetzner         │ Hosting        │ DE       │ ✓   │
│ vast.ai         │ GPU Computing  │ US/EU    │ ✓   │
│ OpenAI          │ LLM API        │ US       │ SCC │
│ Anthropic       │ LLM API        │ US       │ SCC │
└────────────────────────────────────────────────────┘
</pre>

<h3>7. Schulungen</h3>
<ul>
  <li><strong>Onboarding:</strong> Datenschutz-Grundlagen (Pflicht)</li>
  <li><strong>Jaehrlich:</strong> Auffrischung + aktuelle Themen</li>
  <li><strong>Spezial:</strong> IT-Sicherheit fuer Entwickler</li>
  <li><strong>Nachweis:</strong> Dokumentierte Teilnahme</li>
</ul>

<h3>8. Incident Response</h3>
<pre>
Datenpanne erkannt
       │
       v
┌──────────────────────────────────────┐
│ 1. Sofortmassnahmen (Containment)   │
│    - Zugriff sperren                 │
│    - Beweis sichern                  │
└─────────────────┬────────────────────┘
                  │
                  v
┌──────────────────────────────────────┐
│ 2. Bewertung (24h)                   │
│    - Schwere einschaetzen            │
│    - Betroffene identifizieren       │
└─────────────────┬────────────────────┘
                  │
                  v
┌──────────────────────────────────────┐
│ 3. Meldung (72h)                     │
│    - Aufsichtsbehoerde (Art. 33)     │
│    - Betroffene (Art. 34)            │
└─────────────────┬────────────────────┘
                  │
                  v
┌──────────────────────────────────────┐
│ 4. Nachbereitung                     │
│    - Root Cause Analysis             │
│    - Massnahmen umsetzen             │
│    - Dokumentation                   │
└──────────────────────────────────────┘
</pre>

<h3>9. Compliance-Dashboard</h3>
<table>
  <tr><th>Bereich</th><th>Status</th><th>Naechste Pruefung</th></tr>
  <tr><td>VVT</td><td>✓ Aktuell</td><td>Quartalsweise</td></tr>
  <tr><td>TOM</td><td>✓ Aktuell</td><td>Jaehrlich</td></tr>
  <tr><td>AVV</td><td>✓ Aktuell</td><td>Bei Aenderung</td></tr>
  <tr><td>Schulungen</td><td>✓ Durchgefuehrt</td><td>Jaehrlich</td></tr>
  <tr><td>DSFA</td><td>⚠ Offen</td><td>Bei neuer Verarbeitung</td></tr>
</table>

<h3>10. Export & Reporting</h3>
<ul>
  <li><strong>VVT-Export:</strong> PDF, Excel</li>
  <li><strong>TOM-Nachweis:</strong> PDF mit Unterschrift</li>
  <li><strong>DSFA-Report:</strong> PDF</li>
  <li><strong>Audit-Report:</strong> Compliance-Status</li>
</ul>
`,
  },

  // PCA Platform
  pcaPlatform: {
    title: 'PCA Platform System-Info',
    description: 'Partner Content Access Platform fuer Content-Partner.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Partner Portal', components: ['Dashboard', 'Content Upload', 'Analytics'], color: '#3b82f6' },
        { title: 'Content Pipeline', components: ['Ingestion', 'Processing', 'Quality Check'], color: '#8b5cf6' },
        { title: 'Distribution', components: ['CDN', 'API Access', 'Embed Codes'], color: '#10b981' },
        { title: 'Monetization', components: ['Usage Tracking', 'Revenue Share', 'Invoicing'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Partner Onboarding', status: 'active', description: 'Self-Service Registrierung' },
      { name: 'Content Upload', status: 'active', description: 'Bulk-Upload und Metadaten' },
      { name: 'Analytics Dashboard', status: 'active', description: 'Nutzungsstatistiken' },
      { name: 'Revenue Tracking', status: 'planned', description: 'Umsatzbeteiligung' },
    ],
    roadmap: [
      { phase: 'Phase 1: Core (Q1)', priority: 'high', items: ['Partner-Registrierung', 'Content-Upload', 'Basic Analytics', 'API Documentation'] },
      { phase: 'Phase 2: Quality (Q2)', priority: 'medium', items: ['Auto-Transcoding', 'Quality Gates', 'Metadata Validation', 'Preview System'] },
      { phase: 'Phase 3: Monetization (Q3)', priority: 'medium', items: ['Usage-based Billing', 'Revenue Reports', 'Payment Integration', 'Contract Management'] },
    ],
    technicalDetails: [
      { component: 'Upload', technology: 'TUS Protocol', description: 'Resumable Uploads' },
      { component: 'Storage', technology: 'MinIO/S3', description: 'Object Storage' },
      { component: 'CDN', technology: 'CloudFlare', description: 'Content Delivery' },
      { component: 'API', technology: 'REST/GraphQL', description: 'Partner Access' },
    ],
    auditInfo: [
      {
        category: 'Partner-Status',
        items: [
          { label: 'Aktive Partner', value: 'Variabel', status: 'ok' },
          { label: 'Pending Approvals', value: 'Dashboard', status: 'ok' },
          { label: 'Content-Uploads', value: 'Tracking', status: 'ok' },
          { label: 'API-Nutzung', value: 'Metered', status: 'ok' },
        ],
      },
      {
        category: 'Content Pipeline',
        items: [
          { label: 'Upload-Status', value: 'Aktiv', status: 'ok' },
          { label: 'Transcoding', value: 'Automatisch', status: 'ok' },
          { label: 'Quality Gates', value: 'Aktiviert', status: 'ok' },
          { label: 'CDN Distribution', value: 'CloudFlare', status: 'ok' },
        ],
      },
      {
        category: 'Monetarisierung',
        items: [
          { label: 'Usage Tracking', value: 'Aktiv', status: 'ok' },
          { label: 'Revenue Share', value: 'Geplant', status: 'warning' },
          { label: 'Invoicing', value: 'Geplant', status: 'warning' },
          { label: 'Payout', value: 'Geplant', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Partner Content Access (PCA) Platform</h2>

<h3>1. Uebersicht</h3>
<p>Die PCA-Plattform ermoeglicht Content-Partnern das Hochladen, Verwalten und Monetarisieren ihrer Bildungsinhalte. Sie bietet Self-Service-Tools fuer Onboarding und Analytics.</p>

<h3>2. Partner-Workflow</h3>
<pre>
Partner Journey:

Registrierung
     │
     v
┌─────────────────────────┐
│   Onboarding Wizard     │
│   - Firmendaten         │
│   - Vertrag / AGB       │
│   - API-Key Generierung │
└───────────┬─────────────┘
            │
            v
┌─────────────────────────┐
│   Content Upload        │
│   - Bulk Upload         │
│   - Metadata Editor     │
│   - Preview             │
└───────────┬─────────────┘
            │
            v
┌─────────────────────────┐
│   Quality Check         │
│   - Format Validation   │
│   - Metadata Check      │
│   - Review (optional)   │
└───────────┬─────────────┘
            │
            v
┌─────────────────────────┐
│   Publishing            │
│   - CDN Distribution    │
│   - API Access          │
│   - Embed Codes         │
└───────────┬─────────────┘
            │
            v
┌─────────────────────────┐
│   Analytics & Payout    │
│   - Views/Downloads     │
│   - Revenue Tracking    │
│   - Monthly Reports     │
└─────────────────────────┘
</pre>

<h3>3. Content-Typen</h3>
<table>
  <tr><th>Typ</th><th>Formate</th><th>Max. Groesse</th><th>Processing</th></tr>
  <tr><td>Video</td><td>MP4, MOV, MKV</td><td>5 GB</td><td>Transcoding</td></tr>
  <tr><td>Audio</td><td>MP3, WAV, FLAC</td><td>500 MB</td><td>Normalisierung</td></tr>
  <tr><td>Dokument</td><td>PDF, DOCX</td><td>100 MB</td><td>Preview Gen</td></tr>
  <tr><td>Bild</td><td>JPG, PNG, WEBP</td><td>50 MB</td><td>Thumbnails</td></tr>
  <tr><td>Interaktiv</td><td>H5P, SCORM</td><td>200 MB</td><td>Packaging</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/pca/partners</td><td>GET</td><td>Partner-Liste</td></tr>
  <tr><td>/api/pca/partners/{id}</td><td>GET</td><td>Partner-Details</td></tr>
  <tr><td>/api/pca/content</td><td>POST</td><td>Content hochladen</td></tr>
  <tr><td>/api/pca/content/{id}</td><td>GET</td><td>Content-Details</td></tr>
  <tr><td>/api/pca/analytics</td><td>GET</td><td>Nutzungsstatistiken</td></tr>
  <tr><td>/api/pca/embed/{id}</td><td>GET</td><td>Embed-Code</td></tr>
</table>

<h3>5. Upload-Protokoll (TUS)</h3>
<pre>
Resumable Upload Flow:

1. POST /uploads
   → Location: /uploads/abc123

2. PATCH /uploads/abc123
   Upload-Offset: 0
   Content-Length: 1000000
   [Binary Data]

3. HEAD /uploads/abc123
   Upload-Offset: 1000000
   Upload-Length: 5000000

4. Repeat PATCH until complete

5. Processing triggered
</pre>

<h3>6. Metadaten-Schema</h3>
<pre>
{
  "title": "Mathematik Grundlagen",
  "description": "Einfuehrung in...",
  "subject": "Mathematik",
  "grade_level": ["5", "6", "7"],
  "content_type": "video",
  "duration_minutes": 15,
  "language": "de",
  "license": "CC-BY-SA-4.0",
  "tags": ["Algebra", "Grundlagen"],
  "author": {
    "name": "Max Mustermann",
    "organization": "Muster Verlag"
  }
}
</pre>

<h3>7. Revenue Model</h3>
<table>
  <tr><th>Modell</th><th>Beschreibung</th><th>Split</th></tr>
  <tr><td>Views</td><td>Pro Aufruf</td><td>70/30</td></tr>
  <tr><td>Downloads</td><td>Pro Download</td><td>70/30</td></tr>
  <tr><td>Subscription</td><td>Anteilig</td><td>60/40</td></tr>
  <tr><td>Enterprise</td><td>Lizenz</td><td>Individuell</td></tr>
</table>

<h3>8. Quality Gates</h3>
<ul>
  <li><strong>Format:</strong> Unterstuetzte Formate, Codec-Check</li>
  <li><strong>Metadaten:</strong> Pflichtfelder ausgefuellt</li>
  <li><strong>Qualitaet:</strong> Min. 720p fuer Video</li>
  <li><strong>Lizenz:</strong> Gueltige Lizenzangabe</li>
  <li><strong>Moderation:</strong> Optionale manuelle Pruefung</li>
</ul>

<h3>9. Analytics-Dashboard</h3>
<table>
  <tr><th>Metrik</th><th>Beschreibung</th><th>Granularitaet</th></tr>
  <tr><td>Views</td><td>Gesamtaufrufe</td><td>Taeglich</td></tr>
  <tr><td>Unique Views</td><td>Eindeutige Nutzer</td><td>Taeglich</td></tr>
  <tr><td>Watch Time</td><td>Gesamtdauer</td><td>Pro Content</td></tr>
  <tr><td>Completion Rate</td><td>% bis Ende</td><td>Pro Content</td></tr>
  <tr><td>Downloads</td><td>Anzahl Downloads</td><td>Taeglich</td></tr>
</table>

<h3>10. Partner-Support</h3>
<pre>
Support-Kanaele:
├── Dokumentation (Self-Service)
├── API Reference (OpenAPI)
├── E-Mail Support (48h SLA)
├── Dedicated Manager (Enterprise)
└── Status Page (status.example.com)
</pre>
`,
  },

  // Education Search
  eduSearch: {
    title: 'Education Search System-Info',
    description: 'Semantische Suche fuer Bildungsinhalte und Lehrmaterialien.',
    version: '2.0',
    architecture: {
      layers: [
        { title: 'Search UI', components: ['Search Bar', 'Filters', 'Results Grid'], color: '#3b82f6' },
        { title: 'Search Engine', components: ['Query Parser', 'Ranking', 'Faceting'], color: '#8b5cf6' },
        { title: 'Indexing', components: ['Crawler', 'Text Extraction', 'Embedding Generator'], color: '#10b981' },
        { title: 'Data Layer', components: ['Qdrant', 'PostgreSQL', 'Elasticsearch'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Semantische Suche', status: 'active', description: 'Bedeutungsbasierte Suche mit Embeddings' },
      { name: 'Facettensuche', status: 'active', description: 'Filter nach Fach, Klassenstufe, Typ' },
      { name: 'Synonymerkennung', status: 'active', description: 'Automatische Begriffsexpansion' },
      { name: 'Personalisierung', status: 'planned', description: 'Nutzerspezifische Ergebnisse' },
    ],
    roadmap: [
      { phase: 'Phase 1: Quality (Q1)', priority: 'high', items: ['Relevanz-Tuning', 'Spell Correction', 'Query Suggestions', 'Did-you-mean'] },
      { phase: 'Phase 2: Features (Q2)', priority: 'medium', items: ['Saved Searches', 'Search History', 'Alerts', 'Export Results'] },
      { phase: 'Phase 3: AI (Q3)', priority: 'medium', items: ['Query Understanding', 'Intent Classification', 'Answer Extraction', 'Knowledge Graph'] },
    ],
    technicalDetails: [
      { component: 'Vector DB', technology: 'Qdrant', version: '1.12+', description: 'Semantic Search' },
      { component: 'Embeddings', technology: 'OpenAI', description: 'text-embedding-3-large' },
      { component: 'Full-Text', technology: 'PostgreSQL FTS', description: 'Keyword Search' },
      { component: 'UI', technology: 'React', description: 'Search Components' },
    ],
    auditInfo: [
      {
        category: 'Search Performance',
        items: [
          { label: 'Avg. Latency', value: '< 200ms', status: 'ok' },
          { label: 'Index Size', value: 'Skalierbar', status: 'ok' },
          { label: 'Uptime', value: '> 99.9%', status: 'ok' },
          { label: 'Cache Hit Ratio', value: '> 85%', status: 'ok' },
        ],
      },
      {
        category: 'Content Coverage',
        items: [
          { label: 'Indizierte Dokumente', value: 'Tracking', status: 'ok' },
          { label: 'Faecherabdeckung', value: 'Alle Kernfaecher', status: 'ok' },
          { label: 'Klassenstufen', value: '1-13', status: 'ok' },
          { label: 'Aktualitaet', value: 'Taeglich', status: 'ok' },
        ],
      },
      {
        category: 'AI Features',
        items: [
          { label: 'Semantic Search', value: 'Aktiv', status: 'ok' },
          { label: 'Embedding Model', value: 'text-embedding-3', status: 'ok' },
          { label: 'Query Expansion', value: 'Geplant', status: 'warning' },
          { label: 'Personalisierung', value: 'Geplant', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Education Search - Semantische Bildungssuche</h2>

<h3>1. Uebersicht</h3>
<p>Die Education Search kombiniert klassische Volltextsuche mit semantischer Vektorsuche fuer hochrelevante Suchergebnisse in Bildungsinhalten.</p>

<h3>2. Such-Architektur</h3>
<pre>
Suchanfrage
     │
     v
┌─────────────────────────────────────────────────────────────────┐
│                      Query Processor                             │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────────┐│
│  │ Tokenization   │  │ Spell Check    │  │ Query Expansion    ││
│  └────────────────┘  └────────────────┘  └────────────────────┘│
└──────────────────────────────┬──────────────────────────────────┘
                               │
              ┌────────────────┴────────────────┐
              │                                 │
              v                                 v
┌─────────────────────────┐       ┌─────────────────────────┐
│   Keyword Search        │       │   Semantic Search       │
│   (PostgreSQL FTS)      │       │   (Qdrant)              │
│   ┌─────────────────┐   │       │   ┌─────────────────┐   │
│   │ GIN Index       │   │       │   │ HNSW Index      │   │
│   └─────────────────┘   │       │   └─────────────────┘   │
└───────────┬─────────────┘       └───────────┬─────────────┘
            │                                 │
            └─────────────────┬───────────────┘
                              │
                              v
                  ┌───────────────────────┐
                  │   Result Fusion       │
                  │   (RRF Algorithm)     │
                  └───────────┬───────────┘
                              │
                              v
                  ┌───────────────────────┐
                  │   Re-Ranking          │
                  │   (Relevance Model)   │
                  └───────────────────────┘
</pre>

<h3>3. Facetten-Filter</h3>
<table>
  <tr><th>Facette</th><th>Optionen</th><th>Typ</th></tr>
  <tr><td>Fach</td><td>Mathematik, Deutsch, Englisch, ...</td><td>Multi-Select</td></tr>
  <tr><td>Klassenstufe</td><td>1-13</td><td>Range</td></tr>
  <tr><td>Content-Typ</td><td>Video, PDF, Arbeitsblatt, ...</td><td>Multi-Select</td></tr>
  <tr><td>Lizenz</td><td>CC-BY, CC-BY-SA, ...</td><td>Multi-Select</td></tr>
  <tr><td>Sprache</td><td>DE, EN, FR, ...</td><td>Single-Select</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/edu-search/search</td><td>GET</td><td>Suche ausfuehren</td></tr>
  <tr><td>/api/edu-search/suggest</td><td>GET</td><td>Autocomplete</td></tr>
  <tr><td>/api/edu-search/facets</td><td>GET</td><td>Facetten-Counts</td></tr>
  <tr><td>/api/edu-search/similar/{id}</td><td>GET</td><td>Aehnliche Inhalte</td></tr>
</table>

<h3>5. Embedding-Pipeline</h3>
<pre>
Neues Dokument
      │
      v
┌─────────────────────────────┐
│  1. Text Extraction         │
│     - PDF: PyMuPDF          │
│     - Video: Whisper        │
│     - HTML: BeautifulSoup   │
└───────────┬─────────────────┘
            │
            v
┌─────────────────────────────┐
│  2. Chunking                │
│     - 512 Token Chunks      │
│     - 50 Token Overlap      │
└───────────┬─────────────────┘
            │
            v
┌─────────────────────────────┐
│  3. Embedding Generation    │
│     - OpenAI text-embedding │
│     - 3072 Dimensions       │
└───────────┬─────────────────┘
            │
            v
┌─────────────────────────────┐
│  4. Vector Storage          │
│     - Qdrant Collection     │
│     - HNSW Index            │
└─────────────────────────────┘
</pre>

<h3>6. Relevanz-Tuning</h3>
<table>
  <tr><th>Signal</th><th>Gewicht</th><th>Beschreibung</th></tr>
  <tr><td>Titel-Match</td><td>3.0x</td><td>Query im Titel</td></tr>
  <tr><td>Semantic Score</td><td>1.5x</td><td>Cosine Similarity</td></tr>
  <tr><td>Freshness</td><td>1.2x</td><td>Neuere Inhalte</td></tr>
  <tr><td>Popularity</td><td>1.1x</td><td>Views/Downloads</td></tr>
  <tr><td>Quality Score</td><td>1.0x</td><td>Bewertungen</td></tr>
</table>

<h3>7. Performance-Optimierung</h3>
<ul>
  <li><strong>Caching:</strong> Query-Cache (5 Min TTL)</li>
  <li><strong>Prefetch:</strong> Top-Facetten vorgeladen</li>
  <li><strong>Pagination:</strong> Cursor-basiert</li>
  <li><strong>Index:</strong> Sharding bei grossen Datenmengen</li>
</ul>

<h3>8. Monitoring</h3>
<table>
  <tr><th>Metrik</th><th>Ziel</th><th>Alert</th></tr>
  <tr><td>P99 Latency</td><td>< 500ms</td><td>> 1s</td></tr>
  <tr><td>Zero Results Rate</td><td>< 5%</td><td>> 10%</td></tr>
  <tr><td>Click-Through Rate</td><td>> 30%</td><td>< 20%</td></tr>
  <tr><td>Index Lag</td><td>< 1h</td><td>> 4h</td></tr>
</table>

<h3>9. Datenschutz</h3>
<ul>
  <li><strong>Query Logging:</strong> Anonymisiert nach 30 Tagen</li>
  <li><strong>Personalisierung:</strong> Opt-in</li>
  <li><strong>Keine PII:</strong> In Suchlogs keine Nutzer-IDs</li>
</ul>

<h3>10. Geplante Features</h3>
<ol>
  <li>Query Understanding: Intent-Erkennung</li>
  <li>Personalisierung: Basierend auf Historie</li>
  <li>Federated Search: Externe Quellen</li>
  <li>Answer Extraction: Direkte Antworten</li>
</ol>
`,
  },

  // Note: staffSearch and uniCrawler removed (person-crawling discontinued)
  // System only crawls institution data (schools, universities) - no person data
  __removed_person_crawling_note: {
    title: 'Removed Configs Note',
    description: 'staffSearch and uniCrawler configs removed',
    version: '1.0',
    architecture: {
      layers: [],
    },
    features: [],
    roadmap: [],
    technicalDetails: [],
    auditInfo: [],
    fullDocumentation: 'Person crawling functionality removed. System only crawls institution data.',
  },

  // Backlog
  backlog: {
    title: 'Backlog System-Info',
    description: 'Produkt-Backlog und Feature-Tracking.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Backlog UI', components: ['Board View', 'List View', 'Roadmap'], color: '#3b82f6' },
        { title: 'Planning', components: ['Sprint Planning', 'Estimation', 'Prioritization'], color: '#8b5cf6' },
        { title: 'Tracking', components: ['Progress', 'Velocity', 'Burndown'], color: '#10b981' },
        { title: 'Integration', components: ['GitHub', 'Jira', 'Notion'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Feature Tracking', status: 'active', description: 'Anforderungsverwaltung' },
      { name: 'Prioritization', status: 'active', description: 'MoSCoW/RICE Methoden' },
      { name: 'Sprint Planning', status: 'active', description: 'Agile Planung' },
      { name: 'Dependency Tracking', status: 'planned', description: 'Feature-Abhaengigkeiten' },
    ],
    roadmap: [
      { phase: 'Phase 1: Core (Q1)', priority: 'high', items: ['Kanban Board', 'Story Points', 'Labels/Tags', 'Assignees'] },
      { phase: 'Phase 2: Planning (Q2)', priority: 'medium', items: ['Sprint Backlog', 'Velocity Charts', 'Capacity Planning', 'Release Planning'] },
      { phase: 'Phase 3: Intelligence (Q3)', priority: 'low', items: ['Auto-Prioritization', 'Effort Prediction', 'Risk Identification', 'Stakeholder Reports'] },
    ],
    technicalDetails: [
      { component: 'UI', technology: 'React DnD', description: 'Drag & Drop' },
      { component: 'Storage', technology: 'PostgreSQL', description: 'Relational Data' },
      { component: 'Sync', technology: 'GitHub API', description: 'Issue Sync' },
      { component: 'Export', technology: 'CSV/JSON', description: 'Data Export' },
    ],
    auditInfo: [
      {
        category: 'Backlog Status',
        items: [
          { label: 'Offene Items', value: 'Tracking', status: 'ok' },
          { label: 'In Progress', value: 'Tracking', status: 'ok' },
          { label: 'Completed (Sprint)', value: 'Tracking', status: 'ok' },
          { label: 'Backlog Grooming', value: 'Woechentlich', status: 'ok' },
        ],
      },
      {
        category: 'Priorisierung',
        items: [
          { label: 'Must Have', value: 'Tracking', status: 'ok' },
          { label: 'Should Have', value: 'Tracking', status: 'ok' },
          { label: 'Could Have', value: 'Tracking', status: 'ok' },
          { label: 'Wont Have', value: 'Tracking', status: 'ok' },
        ],
      },
      {
        category: 'Integration',
        items: [
          { label: 'GitHub Sync', value: 'Aktiv', status: 'ok' },
          { label: 'Jira Sync', value: 'Optional', status: 'ok' },
          { label: 'Slack Notifications', value: 'Konfigurierbar', status: 'ok' },
          { label: 'Webhooks', value: 'Aktiv', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Backlog Management System</h2>

<h3>1. Uebersicht</h3>
<p>Das Backlog-Modul verwaltet alle Feature-Anfragen, Bugs und Verbesserungen. Es unterstuetzt agile Methoden wie Scrum und Kanban.</p>

<h3>2. Item-Typen</h3>
<table>
  <tr><th>Typ</th><th>Icon</th><th>Beschreibung</th></tr>
  <tr><td>Epic</td><td>⚡</td><td>Grosses Feature, mehrere Stories</td></tr>
  <tr><td>Story</td><td>📖</td><td>User Story mit Akzeptanzkriterien</td></tr>
  <tr><td>Task</td><td>✓</td><td>Technische Aufgabe</td></tr>
  <tr><td>Bug</td><td>🐛</td><td>Fehlerbericht</td></tr>
  <tr><td>Improvement</td><td>💡</td><td>Verbesserungsvorschlag</td></tr>
</table>

<h3>3. Workflow</h3>
<pre>
┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐
│ Backlog  │ → │ Selected │ → │ In Dev   │ → │ Review   │ → │ Done     │
└──────────┘   └──────────┘   └──────────┘   └──────────┘   └──────────┘
     │              │              │              │              │
     │              │              │              │              │
  Priorisiert   Sprint       Entwicklung      Code Review    Abgeschlossen
               Planning      & Testing        & QA
</pre>

<h3>4. Item-Struktur</h3>
<pre>
{
  "id": "BP-123",
  "type": "story",
  "title": "Als Nutzer moechte ich...",
  "description": "...",
  "acceptance_criteria": [
    "Gegeben..., Wenn..., Dann..."
  ],
  "priority": "must_have",
  "story_points": 5,
  "labels": ["frontend", "ux"],
  "assignee": "user_id",
  "sprint": "Sprint 12",
  "epic": "BP-100",
  "created_at": "2025-01-14T10:00:00Z",
  "updated_at": "2025-01-14T12:00:00Z"
}
</pre>

<h3>5. Priorisierung (MoSCoW)</h3>
<table>
  <tr><th>Prioritaet</th><th>Beschreibung</th><th>Behandlung</th></tr>
  <tr><td>Must Have</td><td>Unverzichtbar</td><td>Im naechsten Sprint</td></tr>
  <tr><td>Should Have</td><td>Wichtig</td><td>Baldmoeglichst</td></tr>
  <tr><td>Could Have</td><td>Wuenschenswert</td><td>Wenn Zeit</td></tr>
  <tr><td>Wont Have</td><td>Nicht jetzt</td><td>Spaeter evaluieren</td></tr>
</table>

<h3>6. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/backlog/items</td><td>GET</td><td>Items listen</td></tr>
  <tr><td>/api/backlog/items</td><td>POST</td><td>Neues Item</td></tr>
  <tr><td>/api/backlog/items/{id}</td><td>PATCH</td><td>Item aktualisieren</td></tr>
  <tr><td>/api/backlog/sprints</td><td>GET</td><td>Sprints listen</td></tr>
  <tr><td>/api/backlog/kanban</td><td>GET</td><td>Board-Ansicht</td></tr>
</table>

<h3>7. Sprint Planning</h3>
<pre>
Sprint Planning Flow:

1. Velocity berechnen
   └── Durchschnitt der letzten 3 Sprints

2. Kapazitaet ermitteln
   └── Teamgroesse × Verfuegbarkeit

3. Items auswaehlen
   ├── Priorisierte Items
   ├── Story Points summieren
   └── Kapazitaet nicht ueberschreiten

4. Sprint Goal definieren
   └── Uebergreifendes Ziel

5. Sprint starten
   └── 2 Wochen Timeebox
</pre>

<h3>8. Metriken</h3>
<table>
  <tr><th>Metrik</th><th>Beschreibung</th><th>Ziel</th></tr>
  <tr><td>Velocity</td><td>Story Points/Sprint</td><td>Stabil</td></tr>
  <tr><td>Cycle Time</td><td>Zeit bis Done</td><td>Sinkend</td></tr>
  <tr><td>Lead Time</td><td>Backlog bis Done</td><td>Sinkend</td></tr>
  <tr><td>Burndown</td><td>Remaining Work</td><td>Linear</td></tr>
</table>

<h3>9. GitHub Integration</h3>
<pre>
Sync-Konfiguration:

GitHub Issues → Backlog Items
├── Labels → Typ-Mapping
├── Milestones → Sprints
├── Assignees → Team-Members
└── Comments → Bidirektional

Automatisierung:
├── PR merged → Item nach Done
├── Branch erstellt → Item nach In Dev
└── Review requested → Item nach Review
</pre>

<h3>10. Reporting</h3>
<ul>
  <li><strong>Burndown Chart:</strong> Sprint-Fortschritt</li>
  <li><strong>Velocity Chart:</strong> Trend ueber Sprints</li>
  <li><strong>Cumulative Flow:</strong> WIP-Analyse</li>
  <li><strong>Sprint Report:</strong> Completed vs Planned</li>
</ul>
`,
  },

  // Zeugnisse Crawler
  zeugnisseCrawler: {
    title: 'Zeugnisse Crawler System-Info',
    description: 'Crawler fuer Zeugnisformulierungen und Bewertungstexte.',
    version: '1.0',
    privacyNotes: [
      'Nur anonymisierte Textbausteine',
      'Keine personenbezogenen Daten',
      'Quellennachweis fuer alle Texte',
    ],
    architecture: {
      layers: [
        { title: 'Admin UI', components: ['Source Manager', 'Text Editor', 'Categories'], color: '#3b82f6' },
        { title: 'Crawler', components: ['PDF Parser', 'Text Extractor', 'Classifier'], color: '#8b5cf6' },
        { title: 'Processing', components: ['Deduplication', 'Quality Check', 'Tagging'], color: '#10b981' },
        { title: 'Database', components: ['Text Corpus', 'Categories', 'Search Index'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'PDF-Parsing', status: 'active', description: 'Extraktion aus Zeugnis-PDFs' },
      { name: 'Kategorisierung', status: 'active', description: 'Automatische Einordnung' },
      { name: 'Qualitaetssicherung', status: 'active', description: 'Review-Workflow' },
      { name: 'KI-Generierung', status: 'planned', description: 'Neue Formulierungen' },
    ],
    roadmap: [
      { phase: 'Phase 1: Corpus (Q1)', priority: 'high', items: ['PDF Import', 'Text Cleaning', 'Category System', 'Search Function'] },
      { phase: 'Phase 2: Quality (Q2)', priority: 'medium', items: ['Duplicate Detection', 'Quality Scoring', 'Source Tracking', 'Review Workflow'] },
      { phase: 'Phase 3: AI (Q3)', priority: 'medium', items: ['Style Analysis', 'Generation', 'Personalization', 'Compliance Check'] },
    ],
    technicalDetails: [
      { component: 'PDF', technology: 'PyMuPDF', description: 'PDF Parsing' },
      { component: 'NLP', technology: 'spaCy', description: 'Text Analysis' },
      { component: 'Search', technology: 'Qdrant', description: 'Semantic Search' },
      { component: 'Storage', technology: 'PostgreSQL', description: 'Text Database' },
    ],
    auditInfo: [
      {
        category: 'Corpus Status',
        items: [
          { label: 'Formulierungen', value: 'Tracking', status: 'ok' },
          { label: 'Kategorien', value: 'Definiert', status: 'ok' },
          { label: 'Qualitaet geprueft', value: 'Review', status: 'ok' },
          { label: 'Letzte Aktualisierung', value: 'Woechentlich', status: 'ok' },
        ],
      },
      {
        category: 'Datenschutz',
        items: [
          { label: 'Anonymisierung', value: 'Vollstaendig', status: 'ok' },
          { label: 'Quellennachweis', value: 'Vorhanden', status: 'ok' },
          { label: 'Keine PII', value: 'Verifiziert', status: 'ok' },
          { label: 'Lizenzstatus', value: 'Geprueft', status: 'ok' },
        ],
      },
      {
        category: 'KI-Features',
        items: [
          { label: 'Kategorisierung', value: 'Automatisch', status: 'ok' },
          { label: 'Stilanalyse', value: 'Geplant', status: 'warning' },
          { label: 'Generierung', value: 'Geplant', status: 'warning' },
          { label: 'Qualitaets-Scoring', value: 'Aktiv', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Zeugnisse Crawler - Formulierungsdatenbank</h2>

<h3>1. Uebersicht</h3>
<p>Der Zeugnisse Crawler sammelt und kategorisiert anonymisierte Zeugnisformulierungen. Er dient als Referenzdatenbank fuer die Erstellung von Arbeitszeugnissen.</p>

<h3>2. Datenquellen</h3>
<pre>
Quellen:
├── Oeffentliche Muster-Zeugnisse
│   └── Arbeitsagentur, IHK
├── Anonymisierte Beispiele
│   └── Von Nutzern eingereicht
├── Fachliteratur
│   └── Zeugnis-Handbuecher
└── Generierte Beispiele
    └── KI-erweitert (geplant)
</pre>

<h3>3. Kategorie-System</h3>
<table>
  <tr><th>Kategorie</th><th>Unterkategorien</th><th>Beispiel</th></tr>
  <tr><td>Leistung</td><td>sehr gut, gut, befriedigend, ...</td><td>"stets zur vollsten Zufriedenheit"</td></tr>
  <tr><td>Sozialverhalten</td><td>Kollegen, Vorgesetzte, Kunden</td><td>"war bei allen beliebt"</td></tr>
  <tr><td>Fachwissen</td><td>Theorie, Praxis, Weiterbildung</td><td>"verfuegt ueber fundiertes..."</td></tr>
  <tr><td>Arbeitsweise</td><td>Selbstaendigkeit, Sorgfalt, ...</td><td>"arbeitet aeusserst zuverlaessig"</td></tr>
  <tr><td>Schlussformel</td><td>Danksagung, Wuensche</td><td>"Wir wuenschen alles Gute..."</td></tr>
</table>

<h3>4. Formulierungs-Schema</h3>
<pre>
{
  "id": "zeug-123",
  "text": "Herr/Frau X hat die ihm/ihr uebertragenen Aufgaben...",
  "category": "leistung",
  "subcategory": "gesamtbewertung",
  "rating": 2,  // 1=sehr gut, 6=ungenuegend
  "gender_neutral": true,
  "source": "muster_vorlage",
  "verified": true,
  "usage_count": 150,
  "created_at": "2025-01-14T10:00:00Z"
}
</pre>

<h3>5. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/zeugnisse/search</td><td>GET</td><td>Formulierungen suchen</td></tr>
  <tr><td>/api/zeugnisse/categories</td><td>GET</td><td>Kategorien listen</td></tr>
  <tr><td>/api/zeugnisse/suggest</td><td>POST</td><td>Passende Formulierungen</td></tr>
  <tr><td>/api/zeugnisse/contribute</td><td>POST</td><td>Neue Formulierung einreichen</td></tr>
</table>

<h3>6. PDF-Parsing Pipeline</h3>
<pre>
PDF-Dokument
      │
      v
┌───────────────────────────────────────┐
│  1. Text Extraction (PyMuPDF)         │
│     - OCR falls noetig (Tesseract)    │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  2. Anonymisierung                    │
│     - Namen entfernen                 │
│     - Firmennamen entfernen           │
│     - Daten generalisieren            │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  3. Segmentierung                     │
│     - Absaetze trennen                │
│     - Formulierungen extrahieren      │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  4. Klassifizierung                   │
│     - Kategorie zuordnen              │
│     - Rating ableiten                 │
│     - Qualitaet bewerten              │
└───────────────────────────────────────┘
</pre>

<h3>7. Rating-Dekodierung</h3>
<table>
  <tr><th>Formulierung</th><th>Rating</th><th>Bedeutung</th></tr>
  <tr><td>"stets zur vollsten Zufriedenheit"</td><td>1</td><td>Sehr gut</td></tr>
  <tr><td>"zur vollsten Zufriedenheit"</td><td>2</td><td>Gut</td></tr>
  <tr><td>"zur vollen Zufriedenheit"</td><td>3</td><td>Befriedigend</td></tr>
  <tr><td>"zur Zufriedenheit"</td><td>4</td><td>Ausreichend</td></tr>
  <tr><td>"im Grossen und Ganzen..."</td><td>5</td><td>Mangelhaft</td></tr>
  <tr><td>"hat sich bemueht"</td><td>6</td><td>Ungenuegend</td></tr>
</table>

<h3>8. Qualitaetssicherung</h3>
<ul>
  <li><strong>Automated:</strong> Duplikat-Erkennung, Format-Check</li>
  <li><strong>Review:</strong> Manuelles Review neuer Eintraege</li>
  <li><strong>Rating Check:</strong> Plausibilitaetspruefung</li>
  <li><strong>Usage Tracking:</strong> Beliebte Formulierungen</li>
</ul>

<h3>9. Semantische Suche</h3>
<pre>
Suchanfrage: "gute Teamarbeit"
      │
      v
┌───────────────────────────────────────┐
│  1. Embedding generieren              │
│  2. Qdrant Vector Search              │
│  3. Keyword-Filter anwenden           │
│  4. Rating-Filter anwenden            │
│  5. Ergebnisse ranken                 │
└───────────────────────────────────────┘
      │
      v
Ergebnisse:
├── "war ein geschaetztes Teammitglied" (0.95)
├── "fuegte sich gut ins Team ein" (0.89)
└── "trug aktiv zur Teamarbeit bei" (0.85)
</pre>

<h3>10. Compliance</h3>
<ul>
  <li><strong>Keine personenbezogenen Daten:</strong> Vollstaendig anonymisiert</li>
  <li><strong>Quellennachweis:</strong> Herkunft dokumentiert</li>
  <li><strong>Lizenzpruefung:</strong> Nur freie Inhalte</li>
  <li><strong>Qualitaetsstandard:</strong> Nur positive Bewertungen (&ge; 3)</li>
</ul>
`,
  },

  // Training
  training: {
    title: 'Training System-Info',
    description: 'ML Model Training und Fine-Tuning Dashboard.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Training UI', components: ['Experiment Tracker', 'Metrics Dashboard', 'Model Registry'], color: '#3b82f6' },
        { title: 'Training Pipeline', components: ['Data Loader', 'Trainer', 'Evaluator'], color: '#8b5cf6' },
        { title: 'Compute', components: ['GPU Cluster', 'Job Scheduler', 'Resource Manager'], color: '#10b981' },
        { title: 'Storage', components: ['Dataset Store', 'Model Artifacts', 'Checkpoints'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Experiment Tracking', status: 'active', description: 'Versuchsprotokollierung' },
      { name: 'Hyperparameter Tuning', status: 'active', description: 'Automatische Optimierung' },
      { name: 'Model Versioning', status: 'active', description: 'Modellversionierung' },
      { name: 'Distributed Training', status: 'planned', description: 'Multi-GPU Training' },
    ],
    roadmap: [
      { phase: 'Phase 1: MLOps (Q1)', priority: 'high', items: ['Experiment Tracking', 'Model Registry', 'Artifact Storage', 'Reproducibility'] },
      { phase: 'Phase 2: Automation (Q2)', priority: 'medium', items: ['Auto-Tuning', 'Pipeline Orchestration', 'A/B Deployment', 'Rollback'] },
      { phase: 'Phase 3: Scale (Q3)', priority: 'medium', items: ['Distributed Training', 'Cost Optimization', 'Resource Scheduling', 'Multi-Cloud'] },
    ],
    technicalDetails: [
      { component: 'ML', technology: 'PyTorch', version: '2.x', description: 'Training Framework' },
      { component: 'Tracking', technology: 'MLflow/W&B', description: 'Experiment Tracking' },
      { component: 'GPU', technology: 'vast.ai', description: 'Cloud GPUs' },
      { component: 'Storage', technology: 'MinIO', description: 'Artifact Store' },
    ],
    auditInfo: [
      {
        category: 'Training Pipeline',
        items: [
          { label: 'Aktive Jobs', value: 'Tracking', status: 'ok' },
          { label: 'GPU Verfuegbarkeit', value: 'vast.ai', status: 'ok' },
          { label: 'Model Registry', value: 'MLflow', status: 'ok' },
          { label: 'Experiment Tracking', value: 'Aktiviert', status: 'ok' },
        ],
      },
      {
        category: 'Ressourcen',
        items: [
          { label: 'GPU Budget', value: 'Konfiguriert', status: 'ok' },
          { label: 'Storage', value: 'MinIO', status: 'ok' },
          { label: 'Compute Limits', value: 'Definiert', status: 'ok' },
          { label: 'Auto-Shutdown', value: 'Aktiviert', status: 'ok' },
        ],
      },
      {
        category: 'Compliance',
        items: [
          { label: 'Datensatz-Herkunft', value: 'Dokumentiert', status: 'ok' },
          { label: 'Model Cards', value: 'Vorhanden', status: 'ok' },
          { label: 'Bias-Pruefung', value: 'Geplant', status: 'warning' },
          { label: 'Audit Trail', value: 'Aktiviert', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>ML Training Dashboard</h2>

<h3>1. Uebersicht</h3>
<p>Das Training-Modul ermoeglicht das Training und Fine-Tuning von ML-Modellen mit Experiment-Tracking, Model Registry und GPU-Management.</p>

<h3>2. Training-Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────┐
│                      Training Dashboard                          │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────────┐│
│  │ Experiment     │  │ Model          │  │ Resource           ││
│  │ Tracker        │  │ Registry       │  │ Monitor            ││
│  └────────────────┘  └────────────────┘  └────────────────────┘│
└────────────────────────────┬────────────────────────────────────┘
                             │
                             v
┌─────────────────────────────────────────────────────────────────┐
│                      Training Pipeline                           │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────────┐│
│  │ Data Loader    │  │ Trainer        │  │ Evaluator          ││
│  └────────────────┘  └────────────────┘  └────────────────────┘│
└────────────────────────────┬────────────────────────────────────┘
                             │
          ┌──────────────────┴──────────────────┐
          │                                     │
          v                                     v
┌─────────────────────────┐       ┌─────────────────────────┐
│   GPU Cluster           │       │   Storage               │
│   (vast.ai)             │       │   (MinIO)               │
│   ├── RTX 4090          │       │   ├── Datasets          │
│   ├── A100              │       │   ├── Checkpoints       │
│   └── H100              │       │   └── Models            │
└─────────────────────────┘       └─────────────────────────┘
</pre>

<h3>3. Experiment-Struktur</h3>
<pre>
{
  "experiment_id": "exp-20250114-001",
  "name": "Fine-tune GPT for Education",
  "model_type": "causal_lm",
  "base_model": "meta-llama/Llama-2-7b",
  "dataset": "education-qa-v2",
  "hyperparameters": {
    "learning_rate": 2e-5,
    "batch_size": 16,
    "epochs": 3,
    "warmup_steps": 500,
    "weight_decay": 0.01
  },
  "metrics": {
    "train_loss": 0.45,
    "eval_loss": 0.52,
    "eval_accuracy": 0.89
  },
  "status": "completed",
  "gpu": "A100-80GB",
  "duration_hours": 4.5,
  "cost_usd": 6.75
}
</pre>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/training/experiments</td><td>GET</td><td>Experimente listen</td></tr>
  <tr><td>/api/training/experiments</td><td>POST</td><td>Neues Experiment</td></tr>
  <tr><td>/api/training/experiments/{id}</td><td>GET</td><td>Experiment-Details</td></tr>
  <tr><td>/api/training/models</td><td>GET</td><td>Model Registry</td></tr>
  <tr><td>/api/training/runs/{id}/stop</td><td>POST</td><td>Training stoppen</td></tr>
</table>

<h3>5. Training-Workflow</h3>
<pre>
Neues Experiment
       │
       v
┌───────────────────────────────────────┐
│  1. Konfiguration                     │
│     - Modell auswaehlen               │
│     - Dataset zuweisen                │
│     - Hyperparameter setzen           │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  2. Ressourcen-Allokation             │
│     - GPU-Instanz starten             │
│     - Daten laden                     │
│     - Environment setup               │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  3. Training                          │
│     - Forward/Backward Pass           │
│     - Metriken loggen                 │
│     - Checkpoints speichern           │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  4. Evaluation                        │
│     - Validation Set                  │
│     - Benchmarks                      │
│     - A/B Vergleich                   │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  5. Deployment (optional)             │
│     - Model Registry                  │
│     - Staging/Production              │
│     - Rollout                         │
└───────────────────────────────────────┘
</pre>

<h3>6. Hyperparameter-Tuning</h3>
<table>
  <tr><th>Methode</th><th>Beschreibung</th><th>Use Case</th></tr>
  <tr><td>Grid Search</td><td>Alle Kombinationen</td><td>Kleine Suchräume</td></tr>
  <tr><td>Random Search</td><td>Zufaellige Stichproben</td><td>Grosse Suchräume</td></tr>
  <tr><td>Bayesian</td><td>Informierte Suche</td><td>Teure Experimente</td></tr>
  <tr><td>Population Based</td><td>Evolutionaer</td><td>Kontinuierliches Training</td></tr>
</table>

<h3>7. Metriken & Monitoring</h3>
<pre>
Tracking:
├── Loss (Train/Eval)
├── Accuracy/F1/BLEU
├── Learning Rate Schedule
├── GPU Utilization
├── Memory Usage
└── Training Speed (samples/sec)

Alerts:
├── Loss exploding
├── GPU OOM
├── Training stalled
└── Budget exceeded
</pre>

<h3>8. Model Registry</h3>
<table>
  <tr><th>Status</th><th>Beschreibung</th><th>Aktion</th></tr>
  <tr><td>Draft</td><td>In Entwicklung</td><td>Experimentieren</td></tr>
  <tr><td>Staging</td><td>Zur Evaluation</td><td>A/B Testing</td></tr>
  <tr><td>Production</td><td>Live</td><td>Serving</td></tr>
  <tr><td>Archived</td><td>Veraltet</td><td>Backup</td></tr>
</table>

<h3>9. Kostenmanagement</h3>
<ul>
  <li><strong>Budget-Limits:</strong> Pro Experiment/Tag/Monat</li>
  <li><strong>Auto-Stop:</strong> Bei Inaktivität</li>
  <li><strong>Spot-Instances:</strong> Kostenreduktion</li>
  <li><strong>Reporting:</strong> Kosten pro Experiment</li>
</ul>

<h3>10. Best Practices</h3>
<ol>
  <li>Immer Baseline-Experiment als Referenz</li>
  <li>Checkpoints alle N Schritte speichern</li>
  <li>Early Stopping bei Overfitting</li>
  <li>Model Card fuer jedes produktive Modell</li>
  <li>Reproduzierbarkeit durch Seed-Setting</li>
</ol>
`,
  },

  // Content Management
  content: {
    title: 'Content Management System-Info',
    description: 'Verwaltung von Bildungsinhalten und Medien.',
    version: '1.5',
    architecture: {
      layers: [
        { title: 'Content UI', components: ['Media Library', 'Editor', 'Preview'], color: '#3b82f6' },
        { title: 'Processing', components: ['Transcoding', 'Thumbnail Gen', 'OCR'], color: '#8b5cf6' },
        { title: 'Delivery', components: ['CDN', 'Streaming', 'Download'], color: '#10b981' },
        { title: 'Storage', components: ['MinIO', 'PostgreSQL', 'Qdrant'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Media Upload', status: 'active', description: 'Multi-Format Upload' },
      { name: 'Auto-Processing', status: 'active', description: 'Automatische Konvertierung' },
      { name: 'Search & Filter', status: 'active', description: 'Content-Suche' },
      { name: 'Version Control', status: 'planned', description: 'Inhaltsversionierung' },
    ],
    roadmap: [
      { phase: 'Phase 1: Core (Q1)', priority: 'high', items: ['Bulk Upload', 'Metadata Editor', 'Tagging System', 'Folder Structure'] },
      { phase: 'Phase 2: Media (Q2)', priority: 'medium', items: ['Video Streaming', 'Adaptive Bitrate', 'Subtitle Support', 'Audio Transcription'] },
      { phase: 'Phase 3: AI (Q3)', priority: 'low', items: ['Auto-Tagging', 'Content Moderation', 'Similarity Search', 'Auto-Description'] },
    ],
    technicalDetails: [
      { component: 'Storage', technology: 'MinIO', description: 'S3-Compatible' },
      { component: 'Video', technology: 'FFmpeg', description: 'Transcoding' },
      { component: 'CDN', technology: 'CloudFlare', description: 'Delivery' },
      { component: 'Search', technology: 'Qdrant', description: 'Similarity' },
    ],
    auditInfo: [
      {
        category: 'Content Status',
        items: [
          { label: 'Gesamt-Assets', value: 'Tracking', status: 'ok' },
          { label: 'Veroeffentlicht', value: 'Tracking', status: 'ok' },
          { label: 'In Review', value: 'Tracking', status: 'ok' },
          { label: 'Storage genutzt', value: 'Monitoring', status: 'ok' },
        ],
      },
      {
        category: 'Processing',
        items: [
          { label: 'Transcoding Queue', value: 'Aktiv', status: 'ok' },
          { label: 'Thumbnail Gen', value: 'Automatisch', status: 'ok' },
          { label: 'OCR Pipeline', value: 'Aktiv', status: 'ok' },
          { label: 'CDN Sync', value: 'Aktiv', status: 'ok' },
        ],
      },
      {
        category: 'Qualitaet',
        items: [
          { label: 'Format-Standards', value: 'Definiert', status: 'ok' },
          { label: 'Metadata-Validierung', value: 'Aktiv', status: 'ok' },
          { label: 'Content-Moderation', value: 'Geplant', status: 'warning' },
          { label: 'Accessibility', value: 'In Arbeit', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Content Management System</h2>

<h3>1. Uebersicht</h3>
<p>Das CMS verwaltet alle Bildungsinhalte: Videos, PDFs, Arbeitsblätter und interaktive Medien. Es bietet Upload, Verarbeitung, Suche und Auslieferung.</p>

<h3>2. Content-Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────┐
│                      Content Dashboard                           │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────────┐│
│  │ Media Library  │  │ Editor         │  │ Preview            ││
│  └────────────────┘  └────────────────┘  └────────────────────┘│
└────────────────────────────┬────────────────────────────────────┘
                             │
                             v
┌─────────────────────────────────────────────────────────────────┐
│                      Processing Pipeline                         │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────────┐│
│  │ Upload Handler │  │ Transcoder     │  │ Indexer            ││
│  │ (TUS Protocol) │  │ (FFmpeg)       │  │ (Embeddings)       ││
│  └────────────────┘  └────────────────┘  └────────────────────┘│
└────────────────────────────┬────────────────────────────────────┘
                             │
          ┌──────────────────┴──────────────────┐
          │                                     │
          v                                     v
┌─────────────────────────┐       ┌─────────────────────────┐
│   Object Storage        │       │   CDN                   │
│   (MinIO)               │       │   (CloudFlare)          │
│   ├── Originals         │       │   ├── Thumbnails        │
│   ├── Transcoded        │       │   ├── Streaming         │
│   └── Thumbnails        │       │   └── Downloads         │
└─────────────────────────┘       └─────────────────────────┘
</pre>

<h3>3. Unterstuetzte Formate</h3>
<table>
  <tr><th>Typ</th><th>Eingabe</th><th>Ausgabe</th><th>Max Groesse</th></tr>
  <tr><td>Video</td><td>MP4, MOV, MKV, AVI</td><td>MP4 (H.264), HLS</td><td>5 GB</td></tr>
  <tr><td>Audio</td><td>MP3, WAV, FLAC, M4A</td><td>MP3, AAC</td><td>500 MB</td></tr>
  <tr><td>Dokument</td><td>PDF, DOCX, PPTX</td><td>PDF, Thumbnails</td><td>100 MB</td></tr>
  <tr><td>Bild</td><td>JPG, PNG, WEBP, GIF</td><td>WEBP, Thumbnails</td><td>50 MB</td></tr>
  <tr><td>Interaktiv</td><td>H5P, SCORM</td><td>Package</td><td>200 MB</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/content/upload</td><td>POST</td><td>Upload initiieren (TUS)</td></tr>
  <tr><td>/api/content/assets</td><td>GET</td><td>Assets listen</td></tr>
  <tr><td>/api/content/assets/{id}</td><td>GET</td><td>Asset-Details</td></tr>
  <tr><td>/api/content/assets/{id}</td><td>PATCH</td><td>Metadaten aktualisieren</td></tr>
  <tr><td>/api/content/search</td><td>GET</td><td>Content suchen</td></tr>
</table>

<h3>5. Metadata-Schema</h3>
<pre>
{
  "id": "asset-uuid",
  "title": "Mathematik Erklaervideo",
  "description": "...",
  "type": "video",
  "subject": "Mathematik",
  "grade_levels": [5, 6, 7],
  "language": "de",
  "duration_seconds": 600,
  "file_size_bytes": 150000000,
  "mime_type": "video/mp4",
  "dimensions": { "width": 1920, "height": 1080 },
  "thumbnail_url": "https://cdn.../thumb.webp",
  "stream_url": "https://cdn.../stream.m3u8",
  "download_url": "https://cdn.../download.mp4",
  "tags": ["Algebra", "Grundlagen"],
  "license": "CC-BY-SA-4.0",
  "created_at": "2025-01-14T10:00:00Z",
  "status": "published"
}
</pre>

<h3>6. Video-Transcoding</h3>
<pre>
Input Video
     │
     v
┌───────────────────────────────────────┐
│  1. Analyse                           │
│     - Codec, Resolution, Bitrate      │
│     - Audio Channels                  │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  2. Transcoding (FFmpeg)              │
│     - 1080p (5 Mbps)                  │
│     - 720p (2.5 Mbps)                 │
│     - 480p (1 Mbps)                   │
│     - 360p (0.5 Mbps)                 │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  3. HLS Packaging                     │
│     - Segmente (10s)                  │
│     - Master Playlist                 │
│     - Adaptive Bitrate                │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  4. CDN Upload                        │
│     - Edge Caching                    │
│     - Signed URLs                     │
└───────────────────────────────────────┘
</pre>

<h3>7. Ordner-Struktur</h3>
<pre>
Content Library/
├── Faecher/
│   ├── Mathematik/
│   │   ├── Klasse 5/
│   │   └── Klasse 6/
│   ├── Deutsch/
│   └── Englisch/
├── Sammlungen/
│   ├── Pruefungsvorbereitung/
│   └── Ferienkurse/
└── Archiv/
</pre>

<h3>8. Suche & Filter</h3>
<ul>
  <li><strong>Volltext:</strong> Titel, Beschreibung, Tags</li>
  <li><strong>Semantisch:</strong> Bedeutungsbasiert</li>
  <li><strong>Filter:</strong> Typ, Fach, Klassenstufe, Lizenz</li>
  <li><strong>Sortierung:</strong> Datum, Titel, Beliebtheit</li>
</ul>

<h3>9. Workflow-Status</h3>
<table>
  <tr><th>Status</th><th>Beschreibung</th><th>Sichtbar</th></tr>
  <tr><td>Uploading</td><td>Upload laeuft</td><td>Nein</td></tr>
  <tr><td>Processing</td><td>Transcoding/Thumbnail</td><td>Nein</td></tr>
  <tr><td>Draft</td><td>Entwurf</td><td>Nur Autor</td></tr>
  <tr><td>Review</td><td>In Pruefung</td><td>Reviewer</td></tr>
  <tr><td>Published</td><td>Veroeffentlicht</td><td>Alle</td></tr>
  <tr><td>Archived</td><td>Archiviert</td><td>Admin</td></tr>
</table>

<h3>10. Monitoring</h3>
<table>
  <tr><th>Metrik</th><th>Beschreibung</th><th>Alert</th></tr>
  <tr><td>Storage Usage</td><td>Genutzter Speicher</td><td>> 80%</td></tr>
  <tr><td>Processing Queue</td><td>Wartende Jobs</td><td>> 100</td></tr>
  <tr><td>CDN Bandwidth</td><td>Traffic</td><td>> Limit</td></tr>
  <tr><td>Error Rate</td><td>Fehlgeschlagene Jobs</td><td>> 5%</td></tr>
</table>
`,
  },

  // Documentation
  docs: {
    title: 'Documentation System-Info',
    description: 'Zentrale Dokumentationsplattform und Wissensmanagement.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Docs UI', components: ['Reader', 'Search', 'Navigation'], color: '#3b82f6' },
        { title: 'Content Engine', components: ['Markdown Parser', 'Version Control', 'Export'], color: '#8b5cf6' },
        { title: 'Search', components: ['Full-Text', 'Semantic', 'Facets'], color: '#10b981' },
        { title: 'Storage', components: ['Git Repo', 'PostgreSQL', 'Qdrant'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Markdown Support', status: 'active', description: 'GitHub-Flavored Markdown' },
      { name: 'Search', status: 'active', description: 'Volltext- und semantische Suche' },
      { name: 'Versioning', status: 'active', description: 'Git-basierte Versionierung' },
      { name: 'API Docs', status: 'planned', description: 'OpenAPI Integration' },
    ],
    roadmap: [
      { phase: 'Phase 1: Core (Q1)', priority: 'high', items: ['Markdown Rendering', 'Navigation Tree', 'Search Index', 'Dark Mode'] },
      { phase: 'Phase 2: Features (Q2)', priority: 'medium', items: ['API Reference', 'Code Examples', 'Interactive Demos', 'Feedback System'] },
      { phase: 'Phase 3: AI (Q3)', priority: 'low', items: ['AI Search', 'Auto-Suggestions', 'Translation', 'Doc Generation'] },
    ],
    technicalDetails: [
      { component: 'Renderer', technology: 'MDX', description: 'Enhanced Markdown' },
      { component: 'Search', technology: 'Algolia/Qdrant', description: 'Fast Search' },
      { component: 'Hosting', technology: 'Next.js', description: 'Static Generation' },
      { component: 'Version', technology: 'Git', description: 'Source Control' },
    ],
    auditInfo: [
      {
        category: 'Dokumentation Status',
        items: [
          { label: 'Seiten gesamt', value: 'Tracking', status: 'ok' },
          { label: 'Letzte Aktualisierung', value: 'Git-basiert', status: 'ok' },
          { label: 'Broken Links', value: 'Geprueft', status: 'ok' },
          { label: 'Search Index', value: 'Aktuell', status: 'ok' },
        ],
      },
      {
        category: 'API Documentation',
        items: [
          { label: 'OpenAPI Spec', value: 'Vorhanden', status: 'ok' },
          { label: 'Code Examples', value: 'Vorhanden', status: 'ok' },
          { label: 'Changelog', value: 'Aktuell', status: 'ok' },
          { label: 'Versioning', value: 'Aktiviert', status: 'ok' },
        ],
      },
      {
        category: 'Accessibility',
        items: [
          { label: 'Dark Mode', value: 'Vorhanden', status: 'ok' },
          { label: 'Keyboard Navigation', value: 'Funktioniert', status: 'ok' },
          { label: 'Screen Reader', value: 'Kompatibel', status: 'ok' },
          { label: 'Mobile', value: 'Responsive', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Documentation Platform</h2>

<h3>1. Uebersicht</h3>
<p>Die Dokumentationsplattform bietet zentrale technische Dokumentation fuer Entwickler, APIs und Endnutzer. Sie unterstuetzt Markdown, Versionierung und semantische Suche.</p>

<h3>2. Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────┐
│                      Documentation Site                          │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────────┐│
│  │ Navigation     │  │ Content        │  │ Search             ││
│  │ (Sidebar)      │  │ (MDX Render)   │  │ (Algolia/Qdrant)   ││
│  └────────────────┘  └────────────────┘  └────────────────────┘│
└────────────────────────────┬────────────────────────────────────┘
                             │
                             v
┌─────────────────────────────────────────────────────────────────┐
│                      Build Pipeline                              │
│  ├── Markdown/MDX Parsing                                       │
│  ├── Static Site Generation (Next.js)                           │
│  ├── Search Index Generation                                    │
│  └── Link Validation                                            │
└────────────────────────────┬────────────────────────────────────┘
                             │
                             v
┌─────────────────────────────────────────────────────────────────┐
│                      Source                                      │
│  ├── Git Repository (Versioned)                                 │
│  ├── OpenAPI Specs (Auto-generated)                             │
│  └── Code Comments (Extracted)                                  │
└─────────────────────────────────────────────────────────────────┘
</pre>

<h3>3. Content-Typen</h3>
<table>
  <tr><th>Typ</th><th>Format</th><th>Beschreibung</th></tr>
  <tr><td>Guides</td><td>MDX</td><td>Schritt-fuer-Schritt Anleitungen</td></tr>
  <tr><td>API Reference</td><td>OpenAPI</td><td>Endpoint-Dokumentation</td></tr>
  <tr><td>Concepts</td><td>MDX</td><td>Erklaerungen und Konzepte</td></tr>
  <tr><td>Tutorials</td><td>MDX + Code</td><td>Hands-on Beispiele</td></tr>
  <tr><td>Changelog</td><td>Markdown</td><td>Versionshistorie</td></tr>
</table>

<h3>4. MDX Features</h3>
<pre>
Erweiterte Markdown-Syntax:

# Standard Markdown
**bold**, *italic*, \`code\`

# Code-Bloecke mit Highlighting
\`\`\`typescript
const example = "code"
\`\`\`

# Custom Components
<Callout type="warning">
  Wichtiger Hinweis
</Callout>

<Tabs>
  <Tab label="JavaScript">...</Tab>
  <Tab label="Python">...</Tab>
</Tabs>

# Interaktive Elemente
<ApiPlayground endpoint="/api/example" />
</pre>

<h3>5. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/docs/search</td><td>GET</td><td>Dokumentation durchsuchen</td></tr>
  <tr><td>/api/docs/pages</td><td>GET</td><td>Seitenstruktur</td></tr>
  <tr><td>/api/docs/feedback</td><td>POST</td><td>Feedback einreichen</td></tr>
  <tr><td>/api/docs/versions</td><td>GET</td><td>Verfuegbare Versionen</td></tr>
</table>

<h3>6. Suche</h3>
<pre>
Suchanfrage
     │
     v
┌───────────────────────────────────────┐
│  1. Query Processing                  │
│     - Tokenization                    │
│     - Stemming                        │
│     - Synonyme                        │
└─────────────────┬─────────────────────┘
                  │
          ┌───────┴───────┐
          │               │
          v               v
┌─────────────────┐  ┌─────────────────┐
│ Keyword Search  │  │ Semantic Search │
│ (Algolia)       │  │ (Qdrant)        │
└────────┬────────┘  └────────┬────────┘
         │                    │
         └──────────┬─────────┘
                    │
                    v
         ┌─────────────────────┐
         │ Result Ranking      │
         │ - Relevance Score   │
         │ - Recency           │
         │ - Popularity        │
         └─────────────────────┘
</pre>

<h3>7. Versionierung</h3>
<table>
  <tr><th>Version</th><th>Branch</th><th>Status</th></tr>
  <tr><td>v3.x (latest)</td><td>main</td><td>Aktuell</td></tr>
  <tr><td>v2.x</td><td>v2</td><td>Maintained</td></tr>
  <tr><td>v1.x</td><td>v1</td><td>Deprecated</td></tr>
</table>

<h3>8. Contribution Workflow</h3>
<pre>
Dokumentation aendern:

1. Fork/Branch erstellen
2. Markdown bearbeiten
3. Lokal pruefen (npm run dev)
4. Pull Request erstellen
5. Review & Merge
6. Auto-Deploy
</pre>

<h3>9. Analytics</h3>
<ul>
  <li><strong>Page Views:</strong> Beliebteste Seiten</li>
  <li><strong>Search Queries:</strong> Haeufige Suchanfragen</li>
  <li><strong>Feedback:</strong> Hilfreich/Nicht hilfreich</li>
  <li><strong>404 Tracking:</strong> Fehlende Seiten</li>
</ul>

<h3>10. Qualitaetssicherung</h3>
<table>
  <tr><th>Check</th><th>Tool</th><th>CI-Integration</th></tr>
  <tr><td>Broken Links</td><td>Custom Script</td><td>Ja</td></tr>
  <tr><td>Spelling</td><td>cspell</td><td>Ja</td></tr>
  <tr><td>Formatting</td><td>Prettier</td><td>Ja</td></tr>
  <tr><td>Code Samples</td><td>mdx-lint</td><td>Ja</td></tr>
</table>
`,
  },

  // Game (Unity WebGL)
  game: {
    title: 'Game System-Info',
    description: 'Unity WebGL Spiel-Integration fuer Gamification.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Game UI', components: ['Game Canvas', 'Loading Screen', 'Score Display'], color: '#3b82f6' },
        { title: 'Unity Runtime', components: ['WebGL Player', 'Asset Bundles', 'Physics'], color: '#000000' },
        { title: 'Backend Bridge', components: ['Score API', 'Progress Sync', 'Leaderboard'], color: '#10b981' },
        { title: 'Storage', components: ['Player Data', 'Achievements', 'Analytics'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'WebGL Rendering', status: 'active', description: 'Browser-basiertes Spiel' },
      { name: 'Progress Tracking', status: 'active', description: 'Fortschrittsspeicherung' },
      { name: 'Leaderboard', status: 'planned', description: 'Bestenlisten' },
      { name: 'Achievements', status: 'planned', description: 'Erfolge und Badges' },
    ],
    roadmap: [
      { phase: 'Phase 1: Core (Q1)', priority: 'high', items: ['WebGL Optimization', 'Mobile Support', 'Save System', 'Auth Integration'] },
      { phase: 'Phase 2: Social (Q2)', priority: 'medium', items: ['Multiplayer', 'Chat', 'Friend System', 'Challenges'] },
      { phase: 'Phase 3: Gamification (Q3)', priority: 'low', items: ['Achievement System', 'Rewards', 'Seasons', 'Events'] },
    ],
    technicalDetails: [
      { component: 'Engine', technology: 'Unity', version: '2022 LTS', description: 'Game Engine' },
      { component: 'Platform', technology: 'WebGL 2.0', description: 'Browser Runtime' },
      { component: 'Compression', technology: 'Brotli', description: 'Asset Compression' },
      { component: 'API', technology: 'REST/WebSocket', description: 'Backend Communication' },
    ],
    auditInfo: [
      {
        category: 'Game Status',
        items: [
          { label: 'Build Version', value: 'Tracking', status: 'ok' },
          { label: 'WebGL Kompatibilitaet', value: 'Getestet', status: 'ok' },
          { label: 'Mobile Support', value: 'In Arbeit', status: 'warning' },
          { label: 'Performance', value: 'Optimiert', status: 'ok' },
        ],
      },
      {
        category: 'Integration',
        items: [
          { label: 'Auth Integration', value: 'Aktiv', status: 'ok' },
          { label: 'Progress Sync', value: 'Aktiv', status: 'ok' },
          { label: 'Leaderboard', value: 'Geplant', status: 'warning' },
          { label: 'Achievements', value: 'Geplant', status: 'warning' },
        ],
      },
      {
        category: 'Assets',
        items: [
          { label: 'Bundle Size', value: 'Optimiert', status: 'ok' },
          { label: 'Kompression', value: 'Brotli', status: 'ok' },
          { label: 'Lazy Loading', value: 'Aktiviert', status: 'ok' },
          { label: 'CDN', value: 'CloudFlare', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Unity WebGL Game Integration</h2>

<h3>1. Uebersicht</h3>
<p>Das Game-Modul integriert Unity-basierte Lernspiele als WebGL-Anwendungen in die Web-Plattform. Es ermoeglicht Gamification von Lerninhalten.</p>

<h3>2. Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────┐
│                      Web Application                             │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │                    Game Container                           │ │
│  │  ┌───────────────────────────────────────────────────────┐ │ │
│  │  │              Unity WebGL Canvas                        │ │ │
│  │  │                                                        │ │ │
│  │  │    ┌─────────────┐    ┌─────────────┐                 │ │ │
│  │  │    │   Scene     │    │   UI        │                 │ │ │
│  │  │    │   Objects   │    │   Layer     │                 │ │ │
│  │  │    └─────────────┘    └─────────────┘                 │ │ │
│  │  │                                                        │ │ │
│  │  └───────────────────────────────────────────────────────┘ │ │
│  └────────────────────────────────────────────────────────────┘ │
│                              │                                   │
│                              v                                   │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │                    Unity Bridge (jslib)                     │ │
│  └────────────────────────────────────────────────────────────┘ │
└────────────────────────────┬────────────────────────────────────┘
                             │
                             v
┌─────────────────────────────────────────────────────────────────┐
│                      Backend API                                 │
│  ├── /api/game/auth        (JWT Validation)                    │
│  ├── /api/game/progress    (Save/Load)                         │
│  ├── /api/game/leaderboard (Rankings)                          │
│  └── /api/game/events      (Analytics)                         │
└─────────────────────────────────────────────────────────────────┘
</pre>

<h3>3. Unity Build Settings</h3>
<table>
  <tr><th>Einstellung</th><th>Wert</th><th>Grund</th></tr>
  <tr><td>Compression</td><td>Brotli</td><td>Beste Kompression</td></tr>
  <tr><td>Code Stripping</td><td>Medium</td><td>Bundle-Groesse</td></tr>
  <tr><td>WebGL Memory</td><td>256 MB</td><td>Stabil</td></tr>
  <tr><td>Exception Handling</td><td>Explicitly Thrown</td><td>Performance</td></tr>
  <tr><td>Graphics API</td><td>WebGL 2.0</td><td>Features</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/game/session</td><td>POST</td><td>Session starten</td></tr>
  <tr><td>/api/game/progress</td><td>GET</td><td>Spielstand laden</td></tr>
  <tr><td>/api/game/progress</td><td>POST</td><td>Spielstand speichern</td></tr>
  <tr><td>/api/game/leaderboard</td><td>GET</td><td>Bestenliste</td></tr>
  <tr><td>/api/game/events</td><td>POST</td><td>Analytics-Events</td></tr>
</table>

<h3>5. Bridge Communication</h3>
<pre>
JavaScript → Unity:
├── SendMessage(objectName, methodName, value)
├── JSON Serialization fuer komplexe Daten
└── Event Queue fuer Batch-Operationen

Unity → JavaScript:
├── jslib Plugin: [DllImport("__Internal")]
├── Callback Pattern
└── JSON Response
</pre>

<h3>6. Save System</h3>
<pre>
{
  "player_id": "user-uuid",
  "game_id": "math-adventure",
  "progress": {
    "level": 5,
    "score": 1250,
    "stars": [3, 3, 2, 2, 1],
    "unlocked": ["item-1", "item-2"],
    "last_checkpoint": "level5-mid"
  },
  "settings": {
    "sound": true,
    "music_volume": 0.7,
    "difficulty": "normal"
  },
  "updated_at": "2025-01-14T12:00:00Z"
}
</pre>

<h3>7. Performance-Optimierung</h3>
<ul>
  <li><strong>Asset Bundles:</strong> Lazy Loading grosser Assets</li>
  <li><strong>Texture Compression:</strong> DXT/ETC2</li>
  <li><strong>Object Pooling:</strong> Wiederverwendung von Objekten</li>
  <li><strong>LOD:</strong> Level of Detail fuer 3D-Modelle</li>
  <li><strong>Batching:</strong> Draw Call Reduktion</li>
</ul>

<h3>8. Loading Flow</h3>
<pre>
Seite geladen
     │
     v
┌───────────────────────────────────────┐
│  1. Container initialisieren          │
│     - Canvas vorbereiten              │
│     - Loading UI anzeigen             │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  2. Unity Loader                      │
│     - .data (Assets)                  │
│     - .wasm (Code)                    │
│     - .js (Framework)                 │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  3. Initialisierung                   │
│     - User Auth pruefen               │
│     - Progress laden                  │
│     - Scene starten                   │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  4. Game Ready                        │
│     - Loading UI ausblenden           │
│     - Input aktivieren                │
└───────────────────────────────────────┘
</pre>

<h3>9. Analytics Events</h3>
<table>
  <tr><th>Event</th><th>Daten</th><th>Verwendung</th></tr>
  <tr><td>game_start</td><td>session_id</td><td>Session Tracking</td></tr>
  <tr><td>level_complete</td><td>level, score, time</td><td>Progression</td></tr>
  <tr><td>achievement</td><td>achievement_id</td><td>Engagement</td></tr>
  <tr><td>error</td><td>error_type, details</td><td>Debugging</td></tr>
  <tr><td>game_end</td><td>session_duration</td><td>Retention</td></tr>
</table>

<h3>10. Browser-Kompatibilitaet</h3>
<table>
  <tr><th>Browser</th><th>Desktop</th><th>Mobile</th></tr>
  <tr><td>Chrome</td><td>✓</td><td>✓</td></tr>
  <tr><td>Firefox</td><td>✓</td><td>✓</td></tr>
  <tr><td>Safari</td><td>✓</td><td>⚠ (iOS Limits)</td></tr>
  <tr><td>Edge</td><td>✓</td><td>✓</td></tr>
</table>
`,
  },

  // Onboarding
  onboarding: {
    title: 'Onboarding System-Info',
    description: 'Benutzer- und Schul-Onboarding Workflow.',
    version: '2.0',
    architecture: {
      layers: [
        { title: 'Onboarding UI', components: ['Wizard', 'Progress Bar', 'Tutorials'], color: '#3b82f6' },
        { title: 'Workflow Engine', components: ['Step Manager', 'Validation', 'Skip Logic'], color: '#8b5cf6' },
        { title: 'Data Collection', components: ['Forms', 'File Upload', 'Verification'], color: '#10b981' },
        { title: 'Integration', components: ['CRM', 'School Service', 'Notification'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Multi-Step Wizard', status: 'active', description: 'Gefuehrter Prozess' },
      { name: 'Progress Tracking', status: 'active', description: 'Fortschrittsanzeige' },
      { name: 'Document Upload', status: 'active', description: 'Vertragsuploads' },
      { name: 'Self-Service', status: 'planned', description: 'Autonomes Onboarding' },
    ],
    roadmap: [
      { phase: 'Phase 1: UX (Q1)', priority: 'high', items: ['Wizard Redesign', 'Mobile Optimization', 'Error Handling', 'Help System'] },
      { phase: 'Phase 2: Automation (Q2)', priority: 'medium', items: ['Auto-Verification', 'Document OCR', 'Pre-fill Data', 'Status Updates'] },
      { phase: 'Phase 3: Analytics (Q3)', priority: 'low', items: ['Funnel Analysis', 'Drop-off Points', 'A/B Testing', 'Conversion Optimization'] },
    ],
    technicalDetails: [
      { component: 'Wizard', technology: 'React Hook Form', description: 'Form Management' },
      { component: 'Validation', technology: 'Zod', description: 'Schema Validation' },
      { component: 'Storage', technology: 'PostgreSQL', description: 'Progress Data' },
      { component: 'Files', technology: 'MinIO', description: 'Document Storage' },
    ],
    auditInfo: [
      {
        category: 'Onboarding Status',
        items: [
          { label: 'Conversion Rate', value: 'Tracking', status: 'ok' },
          { label: 'Avg. Completion Time', value: 'Tracking', status: 'ok' },
          { label: 'Drop-off Points', value: 'Analysiert', status: 'ok' },
          { label: 'Support Tickets', value: 'Tracking', status: 'ok' },
        ],
      },
      {
        category: 'Prozess',
        items: [
          { label: 'Wizard Steps', value: 'Konfiguriert', status: 'ok' },
          { label: 'Validation', value: 'Aktiv', status: 'ok' },
          { label: 'Document Upload', value: 'Aktiv', status: 'ok' },
          { label: 'Auto-Verification', value: 'Geplant', status: 'warning' },
        ],
      },
      {
        category: 'Integration',
        items: [
          { label: 'CRM Sync', value: 'Aktiv', status: 'ok' },
          { label: 'E-Mail Notifications', value: 'Aktiv', status: 'ok' },
          { label: 'School Service', value: 'Aktiv', status: 'ok' },
          { label: 'Billing', value: 'Aktiv', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Onboarding Wizard</h2>

<h3>1. Uebersicht</h3>
<p>Der Onboarding Wizard fuehrt neue Nutzer und Schulen durch den Registrierungsprozess. Er sammelt notwendige Daten, Dokumente und Consents.</p>

<h3>2. Wizard-Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────┐
│                      Onboarding Wizard UI                        │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │ Progress Bar: [=====>                              ] 40%    │ │
│  └────────────────────────────────────────────────────────────┘ │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │                    Current Step                             │ │
│  │                                                             │ │
│  │    ┌─────────────────────────────────────────────────┐     │ │
│  │    │              Form / Upload / Info                │     │ │
│  │    └─────────────────────────────────────────────────┘     │ │
│  │                                                             │ │
│  │    [  Zurueck  ]                          [  Weiter  ]     │ │
│  └────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
</pre>

<h3>3. Wizard Steps (Schulen)</h3>
<table>
  <tr><th>Step</th><th>Titel</th><th>Felder</th><th>Pflicht</th></tr>
  <tr><td>1</td><td>Schuldaten</td><td>Name, Typ, Bundesland</td><td>Ja</td></tr>
  <tr><td>2</td><td>Ansprechpartner</td><td>Name, E-Mail, Telefon</td><td>Ja</td></tr>
  <tr><td>3</td><td>Adresse</td><td>Strasse, PLZ, Ort</td><td>Ja</td></tr>
  <tr><td>4</td><td>Vertrag</td><td>Paket-Auswahl, Upload</td><td>Ja</td></tr>
  <tr><td>5</td><td>Datenschutz</td><td>AVV, Consents</td><td>Ja</td></tr>
  <tr><td>6</td><td>Bestaetigung</td><td>Zusammenfassung</td><td>-</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/onboarding/start</td><td>POST</td><td>Wizard starten</td></tr>
  <tr><td>/api/onboarding/{id}/step/{n}</td><td>GET</td><td>Step-Daten laden</td></tr>
  <tr><td>/api/onboarding/{id}/step/{n}</td><td>POST</td><td>Step speichern</td></tr>
  <tr><td>/api/onboarding/{id}/complete</td><td>POST</td><td>Abschliessen</td></tr>
  <tr><td>/api/onboarding/{id}/status</td><td>GET</td><td>Fortschritt</td></tr>
</table>

<h3>5. Validation-Schema</h3>
<pre>
const schoolDataSchema = z.object({
  name: z.string().min(2).max(100),
  type: z.enum([
    "grundschule",
    "hauptschule",
    "realschule",
    "gymnasium",
    "gesamtschule",
    "berufsschule"
  ]),
  bundesland: z.enum([...bundeslaender]),
  studentCount: z.number().positive().optional(),
  website: z.string().url().optional()
});
</pre>

<h3>6. Document Upload</h3>
<pre>
Dokument-Upload Flow:

1. Datei auswaehlen
   └── Typ-Pruefung (PDF, max 10 MB)

2. Upload starten
   └── Progress-Anzeige

3. Virus-Scan
   └── ClamAV

4. Speicherung
   └── MinIO mit Verschluesselung

5. Verifikation (optional)
   └── Manuell oder OCR
</pre>

<h3>7. Status-Workflow</h3>
<pre>
┌──────────┐   ┌──────────┐   ┌───────────┐   ┌───────────┐
│ Started  │ → │ Progress │ → │ Submitted │ → │ Verified  │
└──────────┘   └──────────┘   └───────────┘   └───────────┘
                                    │              │
                                    │              v
                                    │         ┌───────────┐
                                    │         │ Activated │
                                    │         └───────────┘
                                    v
                              ┌───────────┐
                              │ Incomplete│
                              └───────────┘
</pre>

<h3>8. E-Mail-Benachrichtigungen</h3>
<table>
  <tr><th>Trigger</th><th>Template</th><th>Empfaenger</th></tr>
  <tr><td>Start</td><td>Willkommen</td><td>Ansprechpartner</td></tr>
  <tr><td>Pausiert (7 Tage)</td><td>Erinnerung</td><td>Ansprechpartner</td></tr>
  <tr><td>Submitted</td><td>Bestaetigung</td><td>Ansprechpartner</td></tr>
  <tr><td>Verified</td><td>Aktivierung</td><td>Ansprechpartner</td></tr>
  <tr><td>Incomplete</td><td>Fehlende Daten</td><td>Ansprechpartner</td></tr>
</table>

<h3>9. Analytics</h3>
<ul>
  <li><strong>Funnel:</strong> Drop-off pro Step</li>
  <li><strong>Completion Rate:</strong> Abschlussquote</li>
  <li><strong>Avg. Time:</strong> Durchschnittliche Dauer</li>
  <li><strong>Error Rate:</strong> Validierungsfehler</li>
</ul>

<h3>10. A/B Testing (geplant)</h3>
<pre>
Test-Varianten:
├── Step-Reihenfolge
├── Formular-Layout
├── CTA-Texte
├── Hilfe-Inhalte
└── Erfolgsmeldungen

Metriken:
├── Conversion Rate
├── Time to Complete
└── Drop-off Rate
</pre>
`,
  },

  // Unity Bridge
  unityBridge: {
    title: 'Unity Bridge System-Info',
    description: 'Kommunikationsschicht zwischen Web-App und Unity WebGL.',
    version: '1.0',
    architecture: {
      layers: [
        { title: 'Web Interface', components: ['Message Bus', 'Event Handlers', 'State Sync'], color: '#3b82f6' },
        { title: 'Bridge Layer', components: ['jslib Interface', 'Message Queue', 'Serialization'], color: '#8b5cf6' },
        { title: 'Unity Side', components: ['C# Handlers', 'Event System', 'Data Models'], color: '#000000' },
        { title: 'Shared', components: ['Protocol Buffers', 'Type Definitions', 'Validation'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Bidirektionale Kommunikation', status: 'active', description: 'Web <-> Unity Messaging' },
      { name: 'State Synchronisation', status: 'active', description: 'Zustandsabgleich' },
      { name: 'Event System', status: 'active', description: 'Event-basierte Kommunikation' },
      { name: 'Type Safety', status: 'planned', description: 'Typsichere Schnittstelle' },
    ],
    roadmap: [
      { phase: 'Phase 1: Stability (Q1)', priority: 'high', items: ['Error Handling', 'Reconnection Logic', 'Message Validation', 'Logging'] },
      { phase: 'Phase 2: Performance (Q2)', priority: 'medium', items: ['Message Batching', 'Compression', 'Lazy Loading', 'Memory Management'] },
      { phase: 'Phase 3: Features (Q3)', priority: 'low', items: ['Binary Protocol', 'Streaming', 'Debugging Tools', 'Hot Reload'] },
    ],
    technicalDetails: [
      { component: 'Web', technology: 'TypeScript', description: 'Type-safe JS' },
      { component: 'Bridge', technology: 'jslib', description: 'Unity Plugin' },
      { component: 'Unity', technology: 'C#', description: 'Game Logic' },
      { component: 'Protocol', technology: 'JSON/Binary', description: 'Message Format' },
    ],
    auditInfo: [
      {
        category: 'Bridge Status',
        items: [
          { label: 'Connection', value: 'Aktiv', status: 'ok' },
          { label: 'Message Queue', value: 'Stabil', status: 'ok' },
          { label: 'Error Rate', value: '< 0.1%', status: 'ok' },
          { label: 'Latency', value: '< 10ms', status: 'ok' },
        ],
      },
      {
        category: 'Protokoll',
        items: [
          { label: 'Serialization', value: 'JSON', status: 'ok' },
          { label: 'Validation', value: 'Aktiv', status: 'ok' },
          { label: 'Compression', value: 'Geplant', status: 'warning' },
          { label: 'Binary Mode', value: 'Geplant', status: 'warning' },
        ],
      },
      {
        category: 'Debugging',
        items: [
          { label: 'Message Logging', value: 'Optional', status: 'ok' },
          { label: 'Performance Monitor', value: 'Aktiv', status: 'ok' },
          { label: 'Error Tracking', value: 'Sentry', status: 'ok' },
          { label: 'Dev Tools', value: 'In Entwicklung', status: 'warning' },
        ],
      },
    ],
    fullDocumentation: `
<h2>Unity Bridge - Web-Unity Kommunikation</h2>

<h3>1. Uebersicht</h3>
<p>Die Unity Bridge ermoeglicht bidirektionale Kommunikation zwischen der Web-Anwendung (JavaScript/TypeScript) und Unity WebGL (C#). Sie abstrahiert die jslib-Schnittstelle.</p>

<h3>2. Architektur</h3>
<pre>
┌─────────────────────────────────────────────────────────────────┐
│                      Web Application                             │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │                   UnityBridge (TypeScript)                  │ │
│  │  ├── MessageBus                                            │ │
│  │  ├── EventEmitter                                          │ │
│  │  ├── StateSync                                             │ │
│  │  └── ErrorHandler                                          │ │
│  └────────────────────────────────────────────────────────────┘ │
│                              │                                   │
│                              │ SendMessage / Callback            │
│                              │                                   │
└──────────────────────────────┼───────────────────────────────────┘
                               │
┌──────────────────────────────┼───────────────────────────────────┐
│                      Unity WebGL                                 │
│                              │                                   │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │                   BridgeManager (C#)                        │ │
│  │  ├── MessageReceiver                                       │ │
│  │  ├── EventDispatcher                                       │ │
│  │  ├── StateManager                                          │ │
│  │  └── ExternalInterface (jslib)                             │ │
│  └────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
</pre>

<h3>3. Message-Protokoll</h3>
<pre>
{
  "type": "event" | "command" | "query" | "response",
  "id": "msg-uuid",
  "timestamp": 1705234800000,
  "channel": "game" | "ui" | "system",
  "payload": {
    "action": "player_score",
    "data": {
      "score": 100,
      "level": 5
    }
  }
}
</pre>

<h3>4. JavaScript API</h3>
<pre>
// Bridge initialisieren
const bridge = new UnityBridge({
  unityInstance: unityRef,
  gameObjectName: "BridgeManager"
});

// Event an Unity senden
bridge.send("player.action", {
  action: "jump",
  force: 10
});

// Event von Unity empfangen
bridge.on("game.score", (data) => {
  console.log("Score:", data.score);
});

// Query mit Response
const result = await bridge.query("game.state");
console.log("Current level:", result.level);
</pre>

<h3>5. C# API</h3>
<pre>
// BridgeManager.cs
public class BridgeManager : MonoBehaviour
{
    // Von JavaScript empfangen
    public void OnBridgeMessage(string json)
    {
        var message = JsonUtility.FromJson<BridgeMessage>(json);
        HandleMessage(message);
    }

    // An JavaScript senden
    public void SendToWeb(string channel, object data)
    {
        var json = JsonUtility.ToJson(data);
        WebBridge.SendMessage(channel, json);
    }
}
</pre>

<h3>6. Event-Kanaele</h3>
<table>
  <tr><th>Kanal</th><th>Richtung</th><th>Beschreibung</th></tr>
  <tr><td>game.*</td><td>Unity → Web</td><td>Game Events</td></tr>
  <tr><td>player.*</td><td>Bidirektional</td><td>Player Actions</td></tr>
  <tr><td>ui.*</td><td>Web → Unity</td><td>UI Commands</td></tr>
  <tr><td>system.*</td><td>Bidirektional</td><td>System Events</td></tr>
  <tr><td>auth.*</td><td>Web → Unity</td><td>Auth State</td></tr>
</table>

<h3>7. State Synchronisation</h3>
<pre>
Web State                  Unity State
    │                          │
    │    ┌────────────────┐    │
    ├───>│  State Sync    │<───┤
    │    │  (Bidirectional)    │
    │    └────────────────┘    │
    │                          │
    v                          v
┌─────────┐              ┌─────────┐
│ React   │              │ Unity   │
│ Store   │              │ State   │
└─────────┘              └─────────┘

Sync Events:
├── Initial Sync (Game Load)
├── Delta Sync (Changes only)
└── Full Sync (Recovery)
</pre>

<h3>8. Error Handling</h3>
<pre>
Error Types:
├── ConnectionError: Bridge nicht verbunden
├── TimeoutError: Keine Antwort
├── ParseError: JSON ungueltig
├── ValidationError: Schema-Fehler
└── UnityError: C#-Exception

Recovery:
├── Auto-Reconnect (3 Versuche)
├── Message Queue (bis reconnect)
└── Fallback UI (bei Dauerfehler)
</pre>

<h3>9. Performance</h3>
<table>
  <tr><th>Metrik</th><th>Ziel</th><th>Messung</th></tr>
  <tr><td>Latency</td><td>< 10ms</td><td>Per-Message</td></tr>
  <tr><td>Throughput</td><td>1000 msg/s</td><td>Batch Test</td></tr>
  <tr><td>Memory</td><td>< 1MB Queue</td><td>Monitoring</td></tr>
  <tr><td>CPU</td><td>< 1%</td><td>Profiler</td></tr>
</table>

<h3>10. Debugging</h3>
<pre>
// Debug Mode aktivieren
bridge.setDebug(true);

// Message Inspector
bridge.onAny((channel, data) => {
  console.log(\`[\${channel}]\`, data);
});

// Performance Monitor
bridge.getMetrics();
// {
//   messagesSent: 1234,
//   messagesReceived: 5678,
//   avgLatency: 5.2,
//   errors: 2
// }
</pre>
`,
  },

  // RAG System
  rag: {
    title: 'RAG System-Info',
    description: 'Retrieval Augmented Generation fuer intelligente Dokumentensuche.',
    version: '2.5',
    architecture: {
      layers: [
        { title: 'RAG UI', components: ['Chat Interface', 'Document Viewer', 'Source Citations'], color: '#3b82f6' },
        { title: 'RAG Pipeline', components: ['Query Processor', 'Retriever', 'Generator'], color: '#8b5cf6' },
        { title: 'Vector Store', components: ['Qdrant', 'Embedding Service', 'Index Manager'], color: '#10b981' },
        { title: 'Document Store', components: ['MinIO', 'PostgreSQL', 'Chunk Cache'], color: '#f59e0b' },
      ],
    },
    features: [
      { name: 'Semantic Search', status: 'active', description: 'Bedeutungsbasierte Suche' },
      { name: 'Source Citations', status: 'active', description: 'Quellenangaben in Antworten' },
      { name: 'Multi-Document', status: 'active', description: 'Suche ueber mehrere Dokumente' },
      { name: 'Hybrid Search', status: 'active', description: 'Kombination semantisch + keyword' },
      { name: 'Conversation Memory', status: 'planned', description: 'Kontextbewahrung' },
    ],
    roadmap: [
      { phase: 'Phase 1: Quality (Q1)', priority: 'high', items: ['Relevanz-Tuning', 'Chunk Optimization', 'Re-Ranking', 'Answer Quality'] },
      { phase: 'Phase 2: Scale (Q2)', priority: 'high', items: ['Index Sharding', 'Cache Layer', 'Batch Processing', 'Multi-Tenant'] },
      { phase: 'Phase 3: Intelligence (Q3)', priority: 'medium', items: ['Query Expansion', 'Self-Reflection', 'Multi-Hop QA', 'Knowledge Graph'] },
    ],
    technicalDetails: [
      { component: 'Vector DB', technology: 'Qdrant', version: '1.12+', description: 'Similarity Search' },
      { component: 'Embeddings', technology: 'OpenAI', description: 'text-embedding-3-large' },
      { component: 'LLM', technology: 'GPT-4o / Claude', description: 'Answer Generation' },
      { component: 'Chunking', technology: 'LangChain', description: 'Document Processing' },
    ],
    privacyNotes: [
      'Dokumente werden lokal verarbeitet',
      'Embeddings enthalten keine Klartextdaten',
      'LLM-Anfragen sind tenant-isoliert',
    ],
    auditInfo: [
      {
        category: 'RAG Pipeline',
        items: [
          { label: 'Indexierte Dokumente', value: 'Tracking', status: 'ok' },
          { label: 'Vector DB Status', value: 'Qdrant Online', status: 'ok' },
          { label: 'Embedding Model', value: 'text-embedding-3', status: 'ok' },
          { label: 'LLM Provider', value: 'Multi-Provider', status: 'ok' },
        ],
      },
      {
        category: 'Qualitaet',
        items: [
          { label: 'Retrieval Precision', value: 'Tracking', status: 'ok' },
          { label: 'Answer Accuracy', value: 'Evaluation', status: 'ok' },
          { label: 'Halluzinations-Rate', value: 'Monitoring', status: 'ok' },
          { label: 'Citation Accuracy', value: '> 95%', status: 'ok' },
        ],
      },
      {
        category: 'Performance',
        items: [
          { label: 'Avg. Latency', value: '< 3s', status: 'ok' },
          { label: 'Cache Hit Rate', value: '> 30%', status: 'ok' },
          { label: 'Concurrent Users', value: 'Skalierbar', status: 'ok' },
          { label: 'Cost per Query', value: 'Tracking', status: 'ok' },
        ],
      },
    ],
    fullDocumentation: `
<h2>RAG System - Retrieval Augmented Generation</h2>

<h3>1. Uebersicht</h3>
<p>Das RAG-System kombiniert Dokumenten-Retrieval mit LLM-Generation fuer praezise, quellenbasierte Antworten auf Nutzeranfragen.</p>

<h3>2. RAG-Pipeline</h3>
<pre>
User Query
     │
     v
┌───────────────────────────────────────────────────────────────┐
│                      Query Processing                          │
│  ├── Query Analysis (Intent, Entities)                        │
│  ├── Query Expansion (Synonyme, Reformulierung)               │
│  └── Embedding Generation                                      │
└────────────────────────────┬──────────────────────────────────┘
                             │
                             v
┌───────────────────────────────────────────────────────────────┐
│                      Retrieval                                 │
│  ┌─────────────────┐    ┌─────────────────┐                   │
│  │ Vector Search   │    │ Keyword Search  │                   │
│  │ (Qdrant)        │    │ (PostgreSQL)    │                   │
│  └────────┬────────┘    └────────┬────────┘                   │
│           │                      │                             │
│           └──────────┬───────────┘                             │
│                      v                                         │
│           ┌─────────────────────┐                              │
│           │   Hybrid Fusion     │                              │
│           │   (RRF Algorithm)   │                              │
│           └─────────────────────┘                              │
└────────────────────────┬──────────────────────────────────────┘
                         │
                         v
┌───────────────────────────────────────────────────────────────┐
│                      Re-Ranking                                │
│  ├── Cross-Encoder Scoring                                    │
│  ├── Metadata Filtering                                       │
│  └── Diversity Sampling                                       │
└────────────────────────┬──────────────────────────────────────┘
                         │
                         v
┌───────────────────────────────────────────────────────────────┐
│                      Generation                                │
│  ├── Context Assembly                                         │
│  ├── Prompt Engineering                                       │
│  ├── LLM Call (GPT-4o / Claude)                               │
│  └── Citation Extraction                                      │
└────────────────────────┬──────────────────────────────────────┘
                         │
                         v
┌───────────────────────────────────────────────────────────────┐
│                      Response                                  │
│  ├── Answer Text                                              │
│  ├── Source Citations                                         │
│  └── Confidence Score                                         │
└───────────────────────────────────────────────────────────────┘
</pre>

<h3>3. Chunking-Strategie</h3>
<table>
  <tr><th>Parameter</th><th>Wert</th><th>Grund</th></tr>
  <tr><td>Chunk Size</td><td>512 Tokens</td><td>Optimal fuer Retrieval</td></tr>
  <tr><td>Overlap</td><td>50 Tokens</td><td>Kontext-Erhalt</td></tr>
  <tr><td>Splitter</td><td>Semantic</td><td>Natuerliche Grenzen</td></tr>
  <tr><td>Metadata</td><td>Document, Page, Section</td><td>Zitation</td></tr>
</table>

<h3>4. API Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/rag/query</td><td>POST</td><td>Frage stellen</td></tr>
  <tr><td>/api/rag/documents</td><td>GET</td><td>Dokumente listen</td></tr>
  <tr><td>/api/rag/documents</td><td>POST</td><td>Dokument indexieren</td></tr>
  <tr><td>/api/rag/collections</td><td>GET</td><td>Sammlungen</td></tr>
  <tr><td>/api/rag/evaluate</td><td>POST</td><td>Antwort bewerten</td></tr>
</table>

<h3>5. Prompt-Template</h3>
<pre>
System:
Du bist ein hilfreicher Assistent fuer Bildungsinhalte.
Beantworte Fragen basierend auf den gegebenen Dokumenten.
Zitiere immer die Quellen in [1], [2] Format.
Wenn du dir nicht sicher bist, sage es.

Context:
[1] {chunk_1_text}
[2] {chunk_2_text}
[3] {chunk_3_text}

User:
{user_question}

Regeln:
- Nur Informationen aus dem Kontext verwenden
- Bei Unsicherheit "Ich weiss nicht" sagen
- Quellen mit [n] zitieren
- Praezise und strukturiert antworten
</pre>

<h3>6. Qualitaets-Metriken</h3>
<table>
  <tr><th>Metrik</th><th>Beschreibung</th><th>Ziel</th></tr>
  <tr><td>Precision@K</td><td>Relevante unter Top-K</td><td>> 80%</td></tr>
  <tr><td>Recall@K</td><td>Gefundene Relevante</td><td>> 70%</td></tr>
  <tr><td>NDCG</td><td>Ranking-Qualitaet</td><td>> 0.85</td></tr>
  <tr><td>Answer Relevance</td><td>LLM-Evaluation</td><td>> 4/5</td></tr>
  <tr><td>Faithfulness</td><td>Fakten-Treue</td><td>> 95%</td></tr>
</table>

<h3>7. Caching</h3>
<pre>
Cache-Strategie:
├── Query Cache
│   ├── Key: Query Embedding Hash
│   ├── TTL: 24 Stunden
│   └── Invalidierung: Bei Index-Update
│
├── Retrieval Cache
│   ├── Key: Query + Collection
│   ├── TTL: 1 Stunde
│   └── Top-K Results
│
└── Answer Cache
    ├── Key: Query Hash + Context Hash
    ├── TTL: 24 Stunden
    └── Full Response
</pre>

<h3>8. Multi-Tenant</h3>
<ul>
  <li><strong>Collection per Tenant:</strong> Isolierte Vektoren</li>
  <li><strong>Access Control:</strong> RBAC auf Collection-Ebene</li>
  <li><strong>Query Routing:</strong> Automatisch zu Tenant-Collection</li>
  <li><strong>Audit-Log:</strong> Pro Tenant</li>
</ul>

<h3>9. Evaluation-Pipeline</h3>
<pre>
Test-Datensatz
     │
     ├── Frage-Antwort-Paare (Golden Set)
     │
     v
┌───────────────────────────────────────┐
│  RAG Pipeline                         │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  Evaluation Metrics                   │
│  ├── Retrieval: Precision, Recall     │
│  ├── Generation: BLEU, ROUGE          │
│  ├── LLM-as-Judge: Relevance, Correct │
│  └── Human Eval: Subset               │
└─────────────────┬─────────────────────┘
                  │
                  v
┌───────────────────────────────────────┐
│  Report & Regression Detection        │
└───────────────────────────────────────┘
</pre>

<h3>10. Optimierungs-Roadmap</h3>
<ol>
  <li><strong>Hybrid Search:</strong> Kombination Vektor + Keyword (✓)</li>
  <li><strong>Re-Ranking:</strong> Cross-Encoder (✓)</li>
  <li><strong>Query Expansion:</strong> LLM-basiert (In Arbeit)</li>
  <li><strong>Multi-Hop QA:</strong> Verkettete Abfragen (Geplant)</li>
  <li><strong>Self-Reflection:</strong> Antwort-Pruefung (Geplant)</li>
</ol>
`,
  },
  workflow: {
    title: 'BPMN Workflow Engine',
    description: 'Camunda 7 basierte Geschaeftsprozess-Automatisierung',
    version: '7.21.0',
    architecture: {
      layers: [
        {
          title: 'Frontend',
          color: '#3b82f6',
          components: ['bpmn-js Editor', 'React Components', 'Python Studio Module']
        },
        {
          title: 'Backend',
          color: '#8b5cf6',
          components: ['FastAPI Proxy', 'Camunda REST API', 'Task Management']
        },
        {
          title: 'BPMN Engine',
          color: '#10b981',
          components: ['Camunda 7', 'Process Executor', 'Job Executor']
        },
        {
          title: 'Datenbank',
          color: '#f59e0b',
          components: ['PostgreSQL', 'Camunda Schema', 'Process History']
        }
      ]
    },
    features: [
      { name: 'BPMN 2.0 Modellierung', status: 'active' as const, description: 'Visueller Prozess-Editor mit bpmn-js' },
      { name: 'Process Deployment', status: 'active' as const, description: 'Prozesse in Camunda deployen' },
      { name: 'Task Management', status: 'active' as const, description: 'User Tasks bearbeiten und delegieren' },
      { name: 'Service Tasks', status: 'active' as const, description: 'Automatische Serviceaufrufe' },
      { name: 'Timer Events', status: 'active' as const, description: 'Zeitgesteuerte Prozessschritte' },
      { name: 'Process History', status: 'planned' as const, description: 'Historische Prozessdaten und Analytics' }
    ],
    roadmap: [
      {
        phase: 'Phase 1: Editor & Deployment',
        priority: 'high' as const,
        items: ['bpmn-js Editor Integration', 'Camunda Docker Setup', 'REST API Proxy', 'Task Inbox']
      },
      {
        phase: 'Phase 2: Consent Workflow',
        priority: 'high' as const,
        items: ['Document Status BPMN', 'DSB Approval Task', 'Scheduled Publishing', 'Notification Tasks']
      },
      {
        phase: 'Phase 3: GDPR Workflows',
        priority: 'medium' as const,
        items: ['DSR Request Processing', 'Deadline Monitoring', 'Data Export Automation', 'Deletion Workflow']
      }
    ],
    technicalDetails: [
      { component: 'BPMN Engine', technology: 'Camunda 7.21.0', description: 'Apache 2.0 Lizenz' },
      { component: 'Editor Library', technology: 'bpmn-js', version: '17.11.1' },
      { component: 'API Port', technology: '8089', description: 'REST API Proxy' },
      { component: 'Datenbank', technology: 'PostgreSQL', description: 'camunda Schema' }
    ],
    privacyNotes: [
      'Prozessdaten werden lokal in PostgreSQL gespeichert',
      'Keine externen Cloud-Dienste fuer BPMN-Engine',
      'Camunda Community Edition unter Apache 2.0 Lizenz',
      'Audit-Trail fuer alle Prozessaktivitaeten'
    ],
    auditInfo: [
      {
        category: 'Camunda Engine',
        items: [
          { label: 'Version', value: '7.21.0', status: 'ok' as const },
          { label: 'Lizenz', value: 'Apache 2.0', status: 'ok' as const },
          { label: 'Health Check', value: '/api/bpmn/health', status: 'ok' as const }
        ]
      },
      {
        category: 'Datenschutz',
        items: [
          { label: 'Datenstandort', value: 'Lokal (PostgreSQL)', status: 'ok' as const },
          { label: 'Audit-Trail', value: 'Aktiviert', status: 'ok' as const },
          { label: 'Externe Dienste', value: 'Keine', status: 'ok' as const }
        ]
      }
    ],
    fullDocumentation: `
<h2>BPMN Workflow Engine - Dokumentation</h2>

<h3>1. Uebersicht</h3>
<p>Die BPMN Workflow Engine basiert auf Camunda 7 (Apache 2.0 Lizenz) und ermoeglicht die Modellierung und Automatisierung von Geschaeftsprozessen.</p>

<h3>2. API-Endpoints</h3>
<table>
  <tr><th>Endpoint</th><th>Methode</th><th>Beschreibung</th></tr>
  <tr><td>/api/bpmn/health</td><td>GET</td><td>Engine Health-Check</td></tr>
  <tr><td>/api/bpmn/process-definition</td><td>GET</td><td>Alle Prozess-Definitionen</td></tr>
  <tr><td>/api/bpmn/process-definition/{key}/start</td><td>POST</td><td>Prozess starten</td></tr>
  <tr><td>/api/bpmn/task</td><td>GET</td><td>Offene Tasks</td></tr>
  <tr><td>/api/bpmn/task/{id}/complete</td><td>POST</td><td>Task abschliessen</td></tr>
  <tr><td>/api/bpmn/deployment/create</td><td>POST</td><td>BPMN deployen</td></tr>
</table>

<h3>3. Camunda starten</h3>
<pre>
# Mit BPMN-Profil starten
docker-compose --profile bpmn up -d camunda

# Web UI oeffnen
open http://localhost:8089/camunda
</pre>

<h3>4. Lizenz</h3>
<p><strong>Apache License 2.0</strong> - Die Camunda Community Edition ist vollstaendig Open Source und darf ohne Einschraenkungen kommerziell genutzt werden.</p>
`,
  },
}
