package gci

import "time"

// MockModuleData provides fallback data when academy store is empty
func MockModuleData(tenantID string) []ModuleScore {
	return []ModuleScore{
		// DSGVO modules
		{ModuleID: "dsgvo-grundlagen", ModuleName: "DSGVO Grundlagen", Assigned: 25, Completed: 22, Category: "dsgvo", RiskWeight: 2.0},
		{ModuleID: "dsgvo-betroffenenrechte", ModuleName: "Betroffenenrechte", Assigned: 25, Completed: 18, Category: "dsgvo", RiskWeight: 2.5},
		{ModuleID: "dsgvo-tom", ModuleName: "Technisch-Organisatorische Massnahmen", Assigned: 20, Completed: 17, Category: "dsgvo", RiskWeight: 2.5},
		{ModuleID: "dsgvo-dsfa", ModuleName: "Datenschutz-Folgenabschaetzung", Assigned: 15, Completed: 10, Category: "dsgvo", RiskWeight: 2.0},
		{ModuleID: "dsgvo-auftragsverarbeitung", ModuleName: "Auftragsverarbeitung", Assigned: 20, Completed: 16, Category: "dsgvo", RiskWeight: 2.0},

		// NIS2 modules
		{ModuleID: "nis2-risikomanagement", ModuleName: "NIS2 Risikomanagement", Assigned: 15, Completed: 11, Category: "nis2", RiskWeight: 3.0},
		{ModuleID: "nis2-incident-response", ModuleName: "NIS2 Incident Response", Assigned: 15, Completed: 9, Category: "nis2", RiskWeight: 3.0},
		{ModuleID: "nis2-supply-chain", ModuleName: "NIS2 Lieferkettensicherheit", Assigned: 10, Completed: 6, Category: "nis2", RiskWeight: 2.0},
		{ModuleID: "nis2-management", ModuleName: "NIS2 Geschaeftsleitungspflicht", Assigned: 10, Completed: 8, Category: "nis2", RiskWeight: 3.0},

		// ISO 27001 modules
		{ModuleID: "iso-isms", ModuleName: "ISMS Grundlagen", Assigned: 20, Completed: 16, Category: "iso27001", RiskWeight: 2.0},
		{ModuleID: "iso-risikobewertung", ModuleName: "Risikobewertung", Assigned: 15, Completed: 12, Category: "iso27001", RiskWeight: 2.0},
		{ModuleID: "iso-zugangssteuerung", ModuleName: "Zugangssteuerung", Assigned: 20, Completed: 18, Category: "iso27001", RiskWeight: 2.0},
		{ModuleID: "iso-kryptografie", ModuleName: "Kryptografie", Assigned: 10, Completed: 7, Category: "iso27001", RiskWeight: 1.5},
		{ModuleID: "iso-physisch", ModuleName: "Physische Sicherheit", Assigned: 10, Completed: 9, Category: "iso27001", RiskWeight: 1.0},

		// AI Act modules
		{ModuleID: "ai-risikokategorien", ModuleName: "KI-Risikokategorien", Assigned: 15, Completed: 12, Category: "ai_act", RiskWeight: 2.5},
		{ModuleID: "ai-transparenz", ModuleName: "KI-Transparenzpflichten", Assigned: 15, Completed: 10, Category: "ai_act", RiskWeight: 2.0},
		{ModuleID: "ai-hochrisiko", ModuleName: "Hochrisiko-KI-Systeme", Assigned: 10, Completed: 6, Category: "ai_act", RiskWeight: 2.5},
		{ModuleID: "ai-governance", ModuleName: "KI-Governance", Assigned: 10, Completed: 7, Category: "ai_act", RiskWeight: 2.0},
	}
}

// MockCertificateData provides mock certificate validity dates
func MockCertificateData() map[string]time.Time {
	now := time.Now()
	return map[string]time.Time{
		"dsgvo-grundlagen":          now.AddDate(0, 8, 0),  // valid 8 months
		"dsgvo-betroffenenrechte":   now.AddDate(0, 3, 0),  // expiring in 3 months
		"dsgvo-tom":                 now.AddDate(0, 10, 0), // valid
		"dsgvo-dsfa":                now.AddDate(0, -1, 0), // expired 1 month ago
		"dsgvo-auftragsverarbeitung": now.AddDate(0, 6, 0),
		"nis2-risikomanagement":     now.AddDate(0, 5, 0),
		"nis2-incident-response":    now.AddDate(0, 2, 0),  // expiring soon
		"nis2-supply-chain":         now.AddDate(0, -2, 0), // expired 2 months
		"nis2-management":           now.AddDate(0, 9, 0),
		"iso-isms":                  now.AddDate(1, 0, 0),
		"iso-risikobewertung":       now.AddDate(0, 4, 0),
		"iso-zugangssteuerung":      now.AddDate(0, 11, 0),
		"iso-kryptografie":          now.AddDate(0, 1, 0),  // expiring in 1 month
		"iso-physisch":              now.AddDate(0, 7, 0),
		"ai-risikokategorien":       now.AddDate(0, 6, 0),
		"ai-transparenz":            now.AddDate(0, 3, 0),
		"ai-hochrisiko":             now.AddDate(0, -3, 0), // expired 3 months
		"ai-governance":             now.AddDate(0, 5, 0),
	}
}

// MockIncidentData returns mock incident counts for adjustment
func MockIncidentData() (openIncidents int, criticalIncidents int) {
	return 3, 1
}

// MockGCIHistory returns mock historical GCI snapshots
func MockGCIHistory(tenantID string) []GCISnapshot {
	now := time.Now()
	return []GCISnapshot{
		{TenantID: tenantID, Score: 58.2, MaturityLevel: MaturityReactive, AreaScores: map[string]float64{"dsgvo": 62, "nis2": 48, "iso27001": 60, "ai_act": 55}, CalculatedAt: now.AddDate(0, -3, 0)},
		{TenantID: tenantID, Score: 62.5, MaturityLevel: MaturityDefined, AreaScores: map[string]float64{"dsgvo": 65, "nis2": 55, "iso27001": 63, "ai_act": 58}, CalculatedAt: now.AddDate(0, -2, 0)},
		{TenantID: tenantID, Score: 67.8, MaturityLevel: MaturityDefined, AreaScores: map[string]float64{"dsgvo": 70, "nis2": 60, "iso27001": 68, "ai_act": 62}, CalculatedAt: now.AddDate(0, -1, 0)},
	}
}
