import type { SystemInfoConfig } from './types'

export const gameConfig: SystemInfoConfig = {
  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>
`,
}
