import { ScreenDefinition, ConnectionDef } from './types'

// ============================================
// STUDIO SCREENS (Port 8000)
// ============================================

export const STUDIO_SCREENS: ScreenDefinition[] = [
  { id: 'lehrer-dashboard', name: 'Mein Dashboard', description: 'Hauptuebersicht mit Widgets', category: 'navigation', icon: '🏠', url: '/app#lehrer-dashboard' },
  { id: 'lehrer-onboarding', name: 'Erste Schritte', description: 'Onboarding & Schnellstart', category: 'navigation', icon: '🚀', url: '/app#lehrer-onboarding' },
  { id: 'hilfe', name: 'Dokumentation', description: 'Hilfe & Anleitungen', category: 'navigation', icon: '📚', url: '/app#hilfe' },
  { id: 'worksheets', name: 'Arbeitsblaetter Studio', description: 'Lernmaterialien erstellen', category: 'content', icon: '📝', url: '/app#worksheets' },
  { id: 'content-creator', name: 'Content Creator', description: 'Inhalte erstellen', category: 'content', icon: '✨', url: '/app#content-creator' },
  { id: 'content-feed', name: 'Content Feed', description: 'Inhalte durchsuchen', category: 'content', icon: '📰', url: '/app#content-feed' },
  { id: 'unit-creator', name: 'Unit Creator', description: 'Lerneinheiten erstellen', category: 'content', icon: '📦', url: '/app#unit-creator' },
  { id: 'letters', name: 'Briefe & Vorlagen', description: 'Brief-Generator', category: 'content', icon: '✉️', url: '/app#letters' },
  { id: 'correction', name: 'Korrektur', description: 'Arbeiten korrigieren', category: 'content', icon: '✏️', url: '/app#correction' },
  { id: 'klausur-korrektur', name: 'Abiturklausuren', description: 'KI-gestuetzte Klausurkorrektur', category: 'content', icon: '📋', url: '/app#klausur-korrektur' },
  { id: 'jitsi', name: 'Videokonferenz', description: 'Jitsi Meet Integration', category: 'communication', icon: '🎥', url: '/app#jitsi' },
  { id: 'messenger', name: 'Messenger', description: 'Matrix E2EE Chat', category: 'communication', icon: '💬', url: '/app#messenger' },
  { id: 'mail', name: 'Unified Inbox', description: 'E-Mail Verwaltung', category: 'communication', icon: '📧', url: '/app#mail' },
  { id: 'school-classes', name: 'Klassen', description: 'Klassenverwaltung', category: 'school', icon: '👥', url: '/app#school-classes' },
  { id: 'school-exams', name: 'Pruefungen', description: 'Pruefungsverwaltung', category: 'school', icon: '📝', url: '/app#school-exams' },
  { id: 'school-grades', name: 'Noten', description: 'Notenverwaltung', category: 'school', icon: '📊', url: '/app#school-grades' },
  { id: 'school-gradebook', name: 'Notenbuch', description: 'Digitales Notenbuch', category: 'school', icon: '📖', url: '/app#school-gradebook' },
  { id: 'school-certificates', name: 'Zeugnisse', description: 'Zeugniserstellung', category: 'school', icon: '🎓', url: '/app#school-certificates' },
  { id: 'companion', name: 'Begleiter & Stunde', description: 'KI-Unterrichtsassistent', category: 'ai', icon: '🤖', url: '/app#companion' },
  { id: 'alerts', name: 'Alerts', description: 'News & Benachrichtigungen', category: 'ai', icon: '🔔', url: '/app#alerts' },
  { id: 'admin', name: 'Einstellungen', description: 'Systemeinstellungen', category: 'admin', icon: '⚙️', url: '/app#admin' },
  { id: 'rbac-admin', name: 'Rollen & Rechte', description: 'Berechtigungsverwaltung', category: 'admin', icon: '🔐', url: '/app#rbac-admin' },
  { id: 'abitur-docs-admin', name: 'Abitur Dokumente', description: 'Erwartungshorizonte', category: 'admin', icon: '📄', url: '/app#abitur-docs-admin' },
  { id: 'system-info', name: 'System Info', description: 'Systeminformationen', category: 'admin', icon: '💻', url: '/app#system-info' },
  { id: 'workflow', name: 'Workflow', description: 'Automatisierungen', category: 'admin', icon: '⚡', url: '/app#workflow' },
]

export const STUDIO_CONNECTIONS: ConnectionDef[] = [
  { source: 'lehrer-onboarding', target: 'worksheets', label: 'Arbeitsblaetter' },
  { source: 'lehrer-onboarding', target: 'klausur-korrektur', label: 'Abiturklausuren' },
  { source: 'lehrer-onboarding', target: 'correction', label: 'Korrektur' },
  { source: 'lehrer-onboarding', target: 'letters', label: 'Briefe' },
  { source: 'lehrer-onboarding', target: 'school-classes', label: 'Klassen' },
  { source: 'lehrer-onboarding', target: 'jitsi', label: 'Meet' },
  { source: 'lehrer-onboarding', target: 'hilfe', label: 'Doku' },
  { source: 'lehrer-onboarding', target: 'admin', label: 'Settings' },
  { source: 'lehrer-dashboard', target: 'worksheets' },
  { source: 'lehrer-dashboard', target: 'correction' },
  { source: 'lehrer-dashboard', target: 'jitsi' },
  { source: 'lehrer-dashboard', target: 'letters' },
  { source: 'lehrer-dashboard', target: 'messenger' },
  { source: 'lehrer-dashboard', target: 'klausur-korrektur' },
  { source: 'lehrer-dashboard', target: 'companion' },
  { source: 'lehrer-dashboard', target: 'alerts' },
  { source: 'lehrer-dashboard', target: 'mail' },
  { source: 'lehrer-dashboard', target: 'school-classes' },
  { source: 'lehrer-dashboard', target: 'lehrer-onboarding', label: 'Sidebar' },
  { source: 'school-classes', target: 'school-exams' },
  { source: 'school-classes', target: 'school-grades' },
  { source: 'school-grades', target: 'school-gradebook' },
  { source: 'school-gradebook', target: 'school-certificates' },
  { source: 'worksheets', target: 'content-creator' },
  { source: 'worksheets', target: 'unit-creator' },
  { source: 'content-creator', target: 'content-feed' },
  { source: 'klausur-korrektur', target: 'abitur-docs-admin' },
  { source: 'admin', target: 'rbac-admin' },
  { source: 'admin', target: 'system-info' },
  { source: 'admin', target: 'workflow' },
]

// ============================================
// ADMIN SCREENS (Port 3000)
// ============================================

export const ADMIN_SCREENS: ScreenDefinition[] = [
  { id: 'admin-dashboard', name: 'Dashboard', description: 'Uebersicht & Statistiken', category: 'overview', icon: '🏠', url: '/admin' },
  { id: 'admin-onboarding', name: 'Onboarding', description: 'Lern-Wizards fuer alle Module', category: 'overview', icon: '📖', url: '/admin/onboarding' },
  { id: 'admin-gpu', name: 'GPU Infrastruktur', description: 'vast.ai GPU Management', category: 'infrastructure', icon: '🖥️', url: '/admin/gpu' },
  { id: 'admin-middleware', name: 'Middleware', description: 'Middleware Stack & Test', category: 'infrastructure', icon: '🔧', url: '/admin/middleware' },
  { id: 'admin-mac-mini', name: 'Mac Mini', description: 'Headless Mac Mini Control', category: 'infrastructure', icon: '🍎', url: '/admin/mac-mini' },
  { id: 'admin-consent', name: 'Consent Verwaltung', description: 'Rechtliche Dokumente', category: 'compliance', icon: '📄', url: '/admin/consent' },
  { id: 'admin-dsr', name: 'Datenschutzanfragen', description: 'DSGVO Art. 15-21', category: 'compliance', icon: '🔒', url: '/admin/dsr' },
  { id: 'admin-dsms', name: 'DSMS', description: 'Datenschutz-Management', category: 'compliance', icon: '🛡️', url: '/admin/dsms' },
  { id: 'admin-compliance', name: 'Compliance', description: 'GRC & Audit', category: 'compliance', icon: '✅', url: '/admin/compliance' },
  { id: 'admin-docs-audit', name: 'DSGVO-Audit', description: 'Audit-Dokumentation', category: 'compliance', icon: '📋', url: '/admin/docs/audit' },
  { id: 'admin-rag', name: 'Daten & RAG', description: 'Training Data & RAG', category: 'ai', icon: '🗄️', url: '/admin/rag' },
  { id: 'admin-ocr-labeling', name: 'OCR-Labeling', description: 'Handschrift-Training', category: 'ai', icon: '🏷️', url: '/admin/ocr-labeling' },
  { id: 'admin-magic-help', name: 'Magic Help (TrOCR)', description: 'Handschrift-OCR', category: 'ai', icon: '✨', url: '/admin/magic-help' },
  { id: 'admin-companion', name: 'Companion Dev', description: 'Lesson-Modus Entwicklung', category: 'ai', icon: '📚', url: '/admin/companion' },
  { id: 'admin-communication', name: 'Kommunikation', description: 'Matrix & Jitsi Monitoring', category: 'communication', icon: '💬', url: '/admin/communication' },
  { id: 'admin-alerts', name: 'Alerts Monitoring', description: 'Google Alerts & Feeds', category: 'communication', icon: '🔔', url: '/admin/alerts' },
  { id: 'admin-mail', name: 'Unified Inbox', description: 'E-Mail & KI-Analyse', category: 'communication', icon: '📧', url: '/admin/mail' },
  { id: 'admin-security', name: 'Security', description: 'DevSecOps Dashboard', category: 'security', icon: '🔐', url: '/admin/security' },
  { id: 'admin-sbom', name: 'SBOM', description: 'Software Bill of Materials', category: 'security', icon: '📦', url: '/admin/sbom' },
  { id: 'admin-screen-flow', name: 'Screen Flow', description: 'UI Verbindungen', category: 'security', icon: '🔀', url: '/admin/screen-flow' },
  { id: 'admin-content', name: 'Uebersetzungen', description: 'Website Content', category: 'content', icon: '🌍', url: '/admin/content' },
  { id: 'admin-edu-search', name: 'Education Search', description: 'Bildungsquellen & Crawler', category: 'content', icon: '🔍', url: '/admin/edu-search' },
  { id: 'admin-staff-search', name: 'Personensuche', description: 'Uni-Mitarbeiter', category: 'content', icon: '👤', url: '/admin/staff-search' },
  { id: 'admin-uni-crawler', name: 'Uni-Crawler', description: 'Universitaets-Crawling', category: 'content', icon: '🕷️', url: '/admin/uni-crawler' },
  { id: 'admin-game', name: 'Breakpilot Drive', description: 'Lernspiel Klasse 2-6', category: 'game', icon: '🎮', url: '/admin/game' },
  { id: 'admin-unity-bridge', name: 'Unity Bridge', description: 'Unity Editor Steuerung', category: 'game', icon: '⚡', url: '/admin/unity-bridge' },
  { id: 'admin-backlog', name: 'Production Backlog', description: 'Go-Live Checkliste', category: 'misc', icon: '📝', url: '/admin/backlog' },
  { id: 'admin-brandbook', name: 'Brandbook', description: 'Corporate Design', category: 'misc', icon: '🎨', url: '/admin/brandbook' },
  { id: 'admin-docs', name: 'Developer Docs', description: 'API & Architektur', category: 'misc', icon: '📖', url: '/admin/docs' },
  { id: 'admin-pca-platform', name: 'PCA Platform', description: 'Bot-Erkennung', category: 'misc', icon: '💰', url: '/admin/pca-platform' },
]

export const ADMIN_CONNECTIONS: ConnectionDef[] = [
  { source: 'admin-dashboard', target: 'admin-onboarding' },
  { source: 'admin-dashboard', target: 'admin-security' },
  { source: 'admin-dashboard', target: 'admin-compliance' },
  { source: 'admin-onboarding', target: 'admin-gpu' },
  { source: 'admin-onboarding', target: 'admin-consent' },
  { source: 'admin-consent', target: 'admin-dsr' },
  { source: 'admin-dsr', target: 'admin-dsms' },
  { source: 'admin-dsms', target: 'admin-compliance' },
  { source: 'admin-compliance', target: 'admin-docs-audit' },
  { source: 'admin-rag', target: 'admin-ocr-labeling' },
  { source: 'admin-ocr-labeling', target: 'admin-magic-help' },
  { source: 'admin-magic-help', target: 'admin-companion' },
  { source: 'admin-security', target: 'admin-sbom' },
  { source: 'admin-sbom', target: 'admin-screen-flow' },
  { source: 'admin-communication', target: 'admin-alerts' },
  { source: 'admin-alerts', target: 'admin-mail' },
  { source: 'admin-gpu', target: 'admin-middleware' },
  { source: 'admin-middleware', target: 'admin-mac-mini' },
  { source: 'admin-game', target: 'admin-unity-bridge' },
  { source: 'admin-edu-search', target: 'admin-staff-search' },
  { source: 'admin-staff-search', target: 'admin-uni-crawler' },
]

// ============================================
// CATEGORY COLORS & LABELS
// ============================================

export const STUDIO_COLORS: Record<string, { bg: string; border: string; text: string }> = {
  navigation: { bg: '#dbeafe', border: '#3b82f6', text: '#1e40af' },
  content: { bg: '#dcfce7', border: '#22c55e', text: '#166534' },
  communication: { bg: '#fef3c7', border: '#f59e0b', text: '#92400e' },
  school: { bg: '#fce7f3', border: '#ec4899', text: '#9d174d' },
  admin: { bg: '#f3e8ff', border: '#a855f7', text: '#6b21a8' },
  ai: { bg: '#cffafe', border: '#06b6d4', text: '#0e7490' },
}

export const ADMIN_COLORS: Record<string, { bg: string; border: string; text: string }> = {
  overview: { bg: '#dbeafe', border: '#3b82f6', text: '#1e40af' },
  infrastructure: { bg: '#fef3c7', border: '#f59e0b', text: '#92400e' },
  compliance: { bg: '#dcfce7', border: '#22c55e', text: '#166534' },
  ai: { bg: '#cffafe', border: '#06b6d4', text: '#0e7490' },
  communication: { bg: '#fce7f3', border: '#ec4899', text: '#9d174d' },
  security: { bg: '#fee2e2', border: '#ef4444', text: '#991b1b' },
  content: { bg: '#f3e8ff', border: '#a855f7', text: '#6b21a8' },
  game: { bg: '#fef9c3', border: '#eab308', text: '#713f12' },
  misc: { bg: '#f1f5f9', border: '#64748b', text: '#334155' },
}

export const STUDIO_LABELS: Record<string, string> = {
  navigation: 'Navigation',
  content: 'Content & Tools',
  communication: 'Kommunikation',
  school: 'Schulverwaltung',
  admin: 'Administration',
  ai: 'KI & Assistent',
}

export const ADMIN_LABELS: Record<string, string> = {
  overview: 'Uebersicht',
  infrastructure: 'Infrastruktur',
  compliance: 'DSGVO & Compliance',
  ai: 'KI & LLM',
  communication: 'Kommunikation',
  security: 'Security & DevOps',
  content: 'Content & Suche',
  game: 'Game & Unity',
  misc: 'Sonstiges',
}
