"""
Breakpilot Service Module Registry - Seed Data

Contains all 51+ Breakpilot services with:
- Technical details (port, stack, repository)
- Data categories processed
- Applicable regulations
"""

from typing import Dict, List, Any

# Service Type Constants
BACKEND = "backend"
DATABASE = "database"
AI = "ai"
COMMUNICATION = "communication"
STORAGE = "storage"
INFRASTRUCTURE = "infrastructure"
MONITORING = "monitoring"
SECURITY = "security"

# Relevance Level Constants
CRITICAL = "critical"
HIGH = "high"
MEDIUM = "medium"
LOW = "low"


BREAKPILOT_SERVICES: List[Dict[str, Any]] = [
    # =========================================================================
    # CORE BACKEND SERVICES
    # =========================================================================
    {
        "name": "python-backend",
        "display_name": "Python Backend (FastAPI)",
        "description": "Hauptbackend für API, Frontend-Serving, GDPR-Export und alle Core-Funktionen",
        "service_type": BACKEND,
        "port": 8000,
        "technology_stack": ["Python", "FastAPI", "SQLAlchemy", "PostgreSQL"],
        "repository_path": "/backend",
        "docker_image": "breakpilot-pwa-backend",
        "data_categories": ["user_data", "consent_records", "documents", "learning_data"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Backend Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Verarbeitet alle personenbezogenen Daten"},
            {"code": "AIACT", "relevance": HIGH, "notes": "Orchestriert KI-Services"},
            {"code": "DSA", "relevance": MEDIUM, "notes": "Content-Moderation"},
            {"code": "NIS2", "relevance": HIGH, "notes": "Kritische Infrastruktur"},
        ]
    },
    {
        "name": "consent-service",
        "display_name": "Go Consent Service",
        "description": "Kernlogik für Consent-Management, Einwilligungsverwaltung und Versionierung",
        "service_type": BACKEND,
        "port": 8081,
        "technology_stack": ["Go", "Gin", "GORM", "PostgreSQL"],
        "repository_path": "/consent-service",
        "docker_image": "breakpilot-pwa-consent-service",
        "data_categories": ["consent_records", "user_preferences", "audit_logs"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Backend Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Art. 7 Einwilligung, Art. 30 VVZ"},
            {"code": "TDDDG", "relevance": CRITICAL, "notes": "§ 25 Cookie-Consent"},
            {"code": "BSI-TR-03161-2", "relevance": HIGH, "notes": "Session-Management"},
        ]
    },
    {
        "name": "billing-service",
        "display_name": "Billing Service",
        "description": "Zahlungsabwicklung, Abonnements und Rechnungsstellung",
        "service_type": BACKEND,
        "port": 8083,
        "technology_stack": ["Python", "FastAPI", "Stripe API"],
        "repository_path": "/billing-service",
        "docker_image": "breakpilot-pwa-billing",
        "data_categories": ["payment_data", "subscriptions", "invoices"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Backend Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Zahlungsdaten = besonders schützenswert"},
            {"code": "DSA", "relevance": LOW, "notes": "Transparenz bei Gebühren"},
        ]
    },
    {  # Lehrer-Stack (keine Compliance-Runtime-Dependency)
        "name": "school-service",
        "display_name": "School Service",
        "description": "Schulverwaltung, Klassen, Noten und Zeugnisse",
        "service_type": BACKEND,
        "port": 8084,
        "technology_stack": ["Python", "FastAPI", "PostgreSQL"],
        "repository_path": "/school-service",
        "docker_image": "breakpilot-pwa-school-service",
        "data_categories": ["student_data", "grades", "certificates", "class_data"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Education Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Schülerdaten = besonderer Schutz"},
            {"code": "BSI-TR-03161-1", "relevance": HIGH, "notes": "Sicherheit für Bildungsanwendungen"},
        ]
    },
    {  # Lehrer-Stack (keine Compliance-Runtime-Dependency)
        "name": "calendar-service",
        "display_name": "Calendar Service",
        "description": "Kalender, Termine und Stundenplanung",
        "service_type": BACKEND,
        "port": 8085,
        "technology_stack": ["Python", "FastAPI", "PostgreSQL"],
        "repository_path": "/calendar-service",
        "docker_image": "breakpilot-pwa-calendar",
        "data_categories": ["schedule_data", "appointments"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Backend Team",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Terminbezogene Daten"},
        ]
    },

    # =========================================================================
    # AI / ML SERVICES
    # =========================================================================
    {  # Lehrer-Stack (keine Compliance-Runtime-Dependency)
        "name": "klausur-service",
        "display_name": "Klausur Service (AI Correction)",
        "description": "KI-gestützte Klausurbewertung, PDF-Analyse und Feedback-Generierung",
        "service_type": AI,
        "port": 8086,
        "technology_stack": ["Python", "FastAPI", "Claude API", "PyMuPDF"],
        "repository_path": "/klausur-service",
        "docker_image": "breakpilot-pwa-klausur-service",
        "data_categories": ["exam_papers", "corrections", "student_submissions"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": True,
        "criticality": "high",
        "owner_team": "AI Team",
        "regulations": [
            {"code": "AIACT", "relevance": CRITICAL, "notes": "High-Risk KI im Bildungsbereich Art. 6"},
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Automatisierte Entscheidung Art. 22"},
            {"code": "BSI-TR-03161-2", "relevance": HIGH, "notes": "Input-Validierung für Uploads"},
        ]
    },
    {
        "name": "embedding-service",
        "display_name": "Embedding Service",
        "description": "Vektor-Embeddings für semantische Suche und RAG",
        "service_type": AI,
        "port": 8087,
        "technology_stack": ["Python", "FastAPI", "SentenceTransformers", "Qdrant"],
        "repository_path": "/embedding-service",
        "docker_image": "breakpilot-pwa-embedding-service",
        "data_categories": ["document_embeddings", "search_queries"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": True,
        "criticality": "medium",
        "owner_team": "AI Team",
        "regulations": [
            {"code": "AIACT", "relevance": MEDIUM, "notes": "General-Purpose AI System"},
            {"code": "GDPR", "relevance": LOW, "notes": "Keine direkten personenbezogenen Daten"},
        ]
    },
    {
        "name": "transcription-worker",
        "display_name": "Transcription Worker",
        "description": "Whisper-basierte Audio-Transkription für Meetings und Videos",
        "service_type": AI,
        "port": None,
        "technology_stack": ["Python", "Whisper", "FFmpeg"],
        "repository_path": "/transcription-service",
        "docker_image": "breakpilot-pwa-transcription",
        "data_categories": ["audio_recordings", "transcripts"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": True,
        "criticality": "medium",
        "owner_team": "AI Team",
        "regulations": [
            {"code": "AIACT", "relevance": MEDIUM, "notes": "Audio-Analyse"},
            {"code": "GDPR", "relevance": HIGH, "notes": "Sprachaufnahmen = biometrische Daten"},
        ]
    },
    {
        "name": "llm-gateway",
        "display_name": "LLM Gateway",
        "description": "Zentraler Gateway für alle LLM-Anfragen (Claude, OpenAI, Self-Hosted)",
        "service_type": AI,
        "port": 8088,
        "technology_stack": ["Python", "FastAPI", "LiteLLM"],
        "repository_path": "/llm-gateway",
        "docker_image": "breakpilot-pwa-llm-gateway",
        "data_categories": ["llm_prompts", "llm_responses"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": True,
        "criticality": "high",
        "owner_team": "AI Team",
        "regulations": [
            {"code": "AIACT", "relevance": CRITICAL, "notes": "Orchestrierung von KI-Systemen"},
            {"code": "GDPR", "relevance": HIGH, "notes": "Daten an externe APIs"},
        ]
    },

    # =========================================================================
    # DATABASES
    # =========================================================================
    {
        "name": "postgresql",
        "display_name": "PostgreSQL Database",
        "description": "Primäre relationale Datenbank für alle persistenten Daten",
        "service_type": DATABASE,
        "port": 5432,
        "technology_stack": ["PostgreSQL 15"],
        "repository_path": None,
        "docker_image": "postgres:15",
        "data_categories": ["all_persistent_data"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Art. 32 Sicherheit der Verarbeitung"},
            {"code": "BSI-TR-03161-3", "relevance": CRITICAL, "notes": "Datenbank-Sicherheit"},
            {"code": "NIS2", "relevance": HIGH, "notes": "Kritische Infrastruktur"},
        ]
    },
    {
        "name": "qdrant",
        "display_name": "Qdrant Vector DB",
        "description": "Vektordatenbank für Embeddings und semantische Suche",
        "service_type": DATABASE,
        "port": 6333,
        "technology_stack": ["Qdrant"],
        "repository_path": None,
        "docker_image": "qdrant/qdrant",
        "data_categories": ["vector_embeddings", "document_metadata"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "AI Team",
        "regulations": [
            {"code": "GDPR", "relevance": LOW, "notes": "Keine direkten PII"},
            {"code": "BSI-TR-03161-3", "relevance": MEDIUM, "notes": "Datenbank-Sicherheit"},
        ]
    },
    {
        "name": "valkey",
        "display_name": "Valkey (Redis Fork)",
        "description": "In-Memory Cache und Message Queue",
        "service_type": DATABASE,
        "port": 6379,
        "technology_stack": ["Valkey"],
        "repository_path": None,
        "docker_image": "valkey/valkey",
        "data_categories": ["session_data", "cache_data", "job_queues"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Session-Daten"},
            {"code": "BSI-TR-03161-2", "relevance": HIGH, "notes": "Session-Management"},
        ]
    },

    # =========================================================================
    # STORAGE
    # =========================================================================
    {
        "name": "minio",
        "display_name": "MinIO Object Storage",
        "description": "S3-kompatibler Object Storage für Dateien, Bilder und Backups",
        "service_type": STORAGE,
        "port": 9000,
        "technology_stack": ["MinIO"],
        "repository_path": None,
        "docker_image": "minio/minio",
        "data_categories": ["uploaded_files", "recordings", "backups", "exports"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Speicherung von Nutzerdaten"},
            {"code": "BSI-TR-03161-3", "relevance": HIGH, "notes": "Speichersicherheit"},
        ]
    },

    # =========================================================================
    # COMMUNICATION SERVICES
    # =========================================================================
    {
        "name": "matrix-synapse",
        "display_name": "Matrix Synapse",
        "description": "Dezentraler Chat-Server für Messaging",
        "service_type": COMMUNICATION,
        "port": 8008,
        "technology_stack": ["Python", "Matrix Protocol", "PostgreSQL"],
        "repository_path": None,
        "docker_image": "matrixdotorg/synapse",
        "data_categories": ["messages", "chat_history", "user_presence"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Communication Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Chat-Inhalte"},
            {"code": "DSA", "relevance": HIGH, "notes": "Content-Moderation"},
        ]
    },
    {
        "name": "jitsi-meet",
        "display_name": "Jitsi Meet",
        "description": "WebRTC-basierte Videokonferenzen",
        "service_type": COMMUNICATION,
        "port": 8443,
        "technology_stack": ["JavaScript", "WebRTC", "Prosody"],
        "repository_path": None,
        "docker_image": "jitsi/web",
        "data_categories": ["video_streams", "audio_streams", "screen_shares"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Communication Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Video-/Audiodaten"},
            {"code": "BSI-TR-03161-2", "relevance": HIGH, "notes": "WebRTC-Sicherheit"},
        ]
    },
    {
        "name": "jitsi-prosody",
        "display_name": "Jitsi Prosody (XMPP)",
        "description": "XMPP-Server für Jitsi Signaling",
        "service_type": COMMUNICATION,
        "port": 5222,
        "technology_stack": ["Lua", "Prosody", "XMPP"],
        "repository_path": None,
        "docker_image": "jitsi/prosody",
        "data_categories": ["signaling_data", "presence"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Communication Team",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Signaling-Metadaten"},
        ]
    },
    {
        "name": "jitsi-jicofo",
        "display_name": "Jitsi Jicofo",
        "description": "Jitsi Focus Component für Konferenzkoordination",
        "service_type": COMMUNICATION,
        "port": None,
        "technology_stack": ["Java"],
        "repository_path": None,
        "docker_image": "jitsi/jicofo",
        "data_categories": ["conference_metadata"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Communication Team",
        "regulations": [
            {"code": "GDPR", "relevance": LOW, "notes": "Nur Metadaten"},
        ]
    },
    {
        "name": "jitsi-jvb",
        "display_name": "Jitsi JVB (Video Bridge)",
        "description": "Video Bridge für Multi-Party Konferenzen",
        "service_type": COMMUNICATION,
        "port": 10000,
        "technology_stack": ["Java", "WebRTC"],
        "repository_path": None,
        "docker_image": "jitsi/jvb",
        "data_categories": ["video_streams"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Communication Team",
        "regulations": [
            {"code": "GDPR", "relevance": HIGH, "notes": "Video-Routing"},
            {"code": "BSI-TR-03161-2", "relevance": MEDIUM, "notes": "WebRTC-Sicherheit"},
        ]
    },
    {
        "name": "jibri",
        "display_name": "Jitsi Jibri (Recording)",
        "description": "Meeting-Aufzeichnung und Streaming",
        "service_type": COMMUNICATION,
        "port": None,
        "technology_stack": ["Java", "FFmpeg", "Chrome"],
        "repository_path": None,
        "docker_image": "jitsi/jibri",
        "data_categories": ["recordings", "video_files"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Communication Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Video-Aufzeichnungen"},
        ]
    },

    # =========================================================================
    # CONTENT SERVICES
    # =========================================================================
    {
        "name": "h5p-service",
        "display_name": "H5P Content Service",
        "description": "Interaktive Lerninhalte (H5P)",
        "service_type": BACKEND,
        "port": 8082,
        "technology_stack": ["PHP", "H5P Framework"],
        "repository_path": "/h5p-service",
        "docker_image": "breakpilot-pwa-h5p",
        "data_categories": ["learning_content", "user_progress"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Education Team",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Lernfortschritt"},
        ]
    },
    {
        "name": "content-db",
        "display_name": "Content Database",
        "description": "Dedizierte DB für Content-Services",
        "service_type": DATABASE,
        "port": 5433,
        "technology_stack": ["PostgreSQL 15"],
        "repository_path": None,
        "docker_image": "postgres:15",
        "data_categories": ["content_metadata"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "BSI-TR-03161-3", "relevance": MEDIUM, "notes": "Datenbank-Sicherheit"},
        ]
    },

    # =========================================================================
    # SECURITY SERVICES
    # =========================================================================
    {
        "name": "vault",
        "display_name": "HashiCorp Vault",
        "description": "Secrets Management und Encryption as a Service",
        "service_type": SECURITY,
        "port": 8200,
        "technology_stack": ["Vault"],
        "repository_path": "/vault",
        "docker_image": "hashicorp/vault",
        "data_categories": ["secrets", "encryption_keys", "api_credentials"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Security Team",
        "regulations": [
            {"code": "GDPR", "relevance": HIGH, "notes": "Art. 32 Verschlüsselung"},
            {"code": "BSI-TR-03161-1", "relevance": CRITICAL, "notes": "Schlüsselverwaltung"},
            {"code": "BSI-TR-03161-3", "relevance": CRITICAL, "notes": "O.Cryp Prüfaspekte"},
        ]
    },

    # =========================================================================
    # INFRASTRUCTURE
    # =========================================================================
    {
        "name": "traefik",
        "display_name": "Traefik Reverse Proxy",
        "description": "Reverse Proxy, Load Balancer und TLS Termination",
        "service_type": INFRASTRUCTURE,
        "port": 443,
        "technology_stack": ["Traefik", "Let's Encrypt"],
        "repository_path": None,
        "docker_image": "traefik",
        "data_categories": ["access_logs", "request_metadata"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "NIS2", "relevance": HIGH, "notes": "Netzwerksicherheit"},
            {"code": "BSI-TR-03161-2", "relevance": HIGH, "notes": "TLS-Konfiguration"},
        ]
    },

    # =========================================================================
    # MONITORING
    # =========================================================================
    {
        "name": "loki",
        "display_name": "Grafana Loki",
        "description": "Log-Aggregation und -Analyse",
        "service_type": MONITORING,
        "port": 3100,
        "technology_stack": ["Loki", "Grafana"],
        "repository_path": None,
        "docker_image": "grafana/loki",
        "data_categories": ["logs", "audit_trails"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Log-Retention"},
            {"code": "BSI-TR-03161-3", "relevance": HIGH, "notes": "O.Log Prüfaspekte"},
        ]
    },
    {
        "name": "grafana",
        "display_name": "Grafana",
        "description": "Dashboards und Visualisierung",
        "service_type": MONITORING,
        "port": 3000,
        "technology_stack": ["Grafana"],
        "repository_path": None,
        "docker_image": "grafana/grafana",
        "data_categories": ["metrics", "dashboards"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "BSI-TR-03161-3", "relevance": MEDIUM, "notes": "Monitoring"},
        ]
    },
    {
        "name": "prometheus",
        "display_name": "Prometheus",
        "description": "Metrics Collection und Alerting",
        "service_type": MONITORING,
        "port": 9090,
        "technology_stack": ["Prometheus"],
        "repository_path": None,
        "docker_image": "prom/prometheus",
        "data_categories": ["metrics", "alerts"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "NIS2", "relevance": MEDIUM, "notes": "Incident Detection"},
        ]
    },

    # =========================================================================
    # WEBSITE / FRONTEND
    # =========================================================================
    {
        "name": "website",
        "display_name": "Next.js Website",
        "description": "Frontend-Anwendung für Nutzer und Admin-Panel",
        "service_type": BACKEND,
        "port": 3000,
        "technology_stack": ["Next.js", "React", "TypeScript", "TailwindCSS"],
        "repository_path": "/website",
        "docker_image": "breakpilot-pwa-website",
        "data_categories": ["frontend_state", "ui_preferences"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Frontend Team",
        "regulations": [
            {"code": "GDPR", "relevance": HIGH, "notes": "Cookie-Consent UI"},
            {"code": "TDDDG", "relevance": CRITICAL, "notes": "Cookie-Banner"},
            {"code": "DSA", "relevance": MEDIUM, "notes": "Transparenz-Anforderungen"},
            {"code": "BSI-TR-03161-2", "relevance": HIGH, "notes": "XSS-Prävention, CSRF"},
        ]
    },

    # =========================================================================
    # ERP / BUSINESS
    # =========================================================================
    {
        "name": "erpnext",
        "display_name": "ERPNext",
        "description": "Enterprise Resource Planning für Schulverwaltung",
        "service_type": BACKEND,
        "port": 8080,
        "technology_stack": ["Python", "Frappe", "MariaDB"],
        "repository_path": None,
        "docker_image": "frappe/erpnext",
        "data_categories": ["business_data", "employee_data", "financial_data"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Business Team",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Mitarbeiterdaten"},
        ]
    },
    {
        "name": "erpnext-db",
        "display_name": "ERPNext Database (MariaDB)",
        "description": "Dedizierte MariaDB für ERPNext",
        "service_type": DATABASE,
        "port": 3306,
        "technology_stack": ["MariaDB"],
        "repository_path": None,
        "docker_image": "mariadb",
        "data_categories": ["erp_data"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "high",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": HIGH, "notes": "ERP-Daten"},
            {"code": "BSI-TR-03161-3", "relevance": HIGH, "notes": "Datenbank-Sicherheit"},
        ]
    },

    # =========================================================================
    # COMPLIANCE SERVICE (Self-Reference)
    # =========================================================================
    {
        "name": "compliance-module",
        "display_name": "Compliance & Audit Module",
        "description": "Dieses Modul - Compliance-Management, Audit-Vorbereitung, Risiko-Tracking",
        "service_type": BACKEND,
        "port": None,
        "technology_stack": ["Python", "FastAPI", "SQLAlchemy"],
        "repository_path": "/backend/compliance",
        "docker_image": None,
        "data_categories": ["compliance_data", "audit_records", "risk_assessments"],
        "processes_pii": False,
        "processes_health_data": False,
        "ai_components": True,
        "criticality": "high",
        "owner_team": "Compliance Team",
        "regulations": [
            {"code": "GDPR", "relevance": HIGH, "notes": "Art. 30 VVZ, Art. 35 DPIA"},
            {"code": "AIACT", "relevance": MEDIUM, "notes": "KI-Interpretations-Feature"},
        ]
    },

    # =========================================================================
    # DSMS - Dezentrales Speichersystem (Private IPFS)
    # =========================================================================
    {
        "name": "dsms-node",
        "display_name": "DSMS Node (IPFS)",
        "description": "Dezentraler IPFS-Node für verteiltes Speichersystem",
        "service_type": STORAGE,
        "port": 5001,
        "technology_stack": ["IPFS", "Go"],
        "repository_path": "/dsms-node",
        "docker_image": "breakpilot-pwa-dsms-node",
        "data_categories": ["distributed_files", "content_hashes"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": HIGH, "notes": "Dezentrale Datenspeicherung"},
            {"code": "BSI-TR-03161-3", "relevance": MEDIUM, "notes": "Speichersicherheit"},
        ]
    },
    {
        "name": "dsms-gateway",
        "display_name": "DSMS Gateway",
        "description": "REST API Gateway für DSMS/IPFS Zugriff",
        "service_type": BACKEND,
        "port": 8082,
        "technology_stack": ["Python", "FastAPI"],
        "repository_path": "/dsms-gateway",
        "docker_image": "breakpilot-pwa-dsms-gateway",
        "data_categories": ["file_metadata", "access_logs"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Backend Team",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "API für Dateizugriff"},
        ]
    },

    # =========================================================================
    # ADDITIONAL INFRASTRUCTURE
    # =========================================================================
    {
        "name": "mailpit",
        "display_name": "Mailpit (Development Mail Server)",
        "description": "Lokaler E-Mail-Server für Entwicklung und Testing",
        "service_type": INFRASTRUCTURE,
        "port": 8025,
        "technology_stack": ["Go"],
        "repository_path": None,
        "docker_image": "axllent/mailpit",
        "data_categories": ["test_emails"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "low",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": LOW, "notes": "Nur für Entwicklung"},
        ]
    },
    {
        "name": "backup",
        "display_name": "Database Backup Service",
        "description": "Automatisches PostgreSQL Backup (täglich 2 Uhr)",
        "service_type": INFRASTRUCTURE,
        "port": None,
        "technology_stack": ["PostgreSQL Tools"],
        "repository_path": None,
        "docker_image": "postgres:16-alpine",
        "data_categories": ["database_backups"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "critical",
        "owner_team": "Infrastructure",
        "regulations": [
            {"code": "GDPR", "relevance": CRITICAL, "notes": "Art. 32 Backup-Pflicht"},
            {"code": "BSI-TR-03161-3", "relevance": CRITICAL, "notes": "O.Back_1 Datensicherung"},
        ]
    },

    # =========================================================================
    # BREAKPILOT DRIVE - Unity WebGL Lernspiel
    # =========================================================================
    {
        "name": "breakpilot-drive",
        "display_name": "Breakpilot Drive (Unity Game)",
        "description": "Unity WebGL Lernspiel mit LLM-Integration",
        "service_type": BACKEND,
        "port": 3001,
        "technology_stack": ["Unity", "WebGL", "Nginx"],
        "repository_path": "/breakpilot-drive",
        "docker_image": "breakpilot-pwa-drive",
        "data_categories": ["game_progress", "player_data", "leaderboards"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": True,
        "criticality": "medium",
        "owner_team": "Education Team",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Spieldaten und Fortschritt"},
            {"code": "AIACT", "relevance": MEDIUM, "notes": "LLM-Integration"},
        ]
    },

    # =========================================================================
    # CAMUNDA - BPMN Workflow Engine
    # =========================================================================
    {
        "name": "camunda",
        "display_name": "Camunda BPMN Platform",
        "description": "Workflow Engine für Business Process Automation",
        "service_type": BACKEND,
        "port": 8089,
        "technology_stack": ["Java", "Camunda", "PostgreSQL"],
        "repository_path": None,
        "docker_image": "camunda/camunda-bpm-platform",
        "data_categories": ["workflow_instances", "process_variables"],
        "processes_pii": True,
        "processes_health_data": False,
        "ai_components": False,
        "criticality": "medium",
        "owner_team": "Backend Team",
        "regulations": [
            {"code": "GDPR", "relevance": MEDIUM, "notes": "Workflow-Daten können PII enthalten"},
        ]
    },
]


def get_service_count() -> int:
    """Returns the number of registered services."""
    return len(BREAKPILOT_SERVICES)


def get_services_by_type(service_type: str) -> List[Dict[str, Any]]:
    """Returns all services of a specific type."""
    return [s for s in BREAKPILOT_SERVICES if s["service_type"] == service_type]


def get_services_processing_pii() -> List[Dict[str, Any]]:
    """Returns all services that process PII."""
    return [s for s in BREAKPILOT_SERVICES if s["processes_pii"]]


def get_services_with_ai() -> List[Dict[str, Any]]:
    """Returns all services with AI components."""
    return [s for s in BREAKPILOT_SERVICES if s["ai_components"]]


def get_critical_services() -> List[Dict[str, Any]]:
    """Returns all critical services."""
    return [s for s in BREAKPILOT_SERVICES if s["criticality"] == "critical"]
