package handlers

import "testing"

func TestIsCyberSecurityCategory_RoutedToCRA(t *testing.T) {
	cyber := []string{
		"unauthorized_access", "firmware_corruption", "cyber_resilience",
		"logging_audit_failure", "cyber_network", "sensor_spoofing",
		"ai_specific", "ai_misclassification", "false_classification",
		"model_drift", "data_poisoning", "unintended_bias",
	}
	for _, c := range cyber {
		if !isCyberSecurityCategory(c) {
			t.Errorf("category %q must be routed to the CRA module, not the traditional IACE log", c)
		}
	}
}

func TestIsCyberSecurityCategory_StaysInIACE(t *testing.T) {
	// Physical + functional-safety categories must remain in the traditional CE
	// hazard log. communication_failure (bus failure -> loss of control) and
	// update_failure (botched update -> lost safety function) are FUNCTIONAL
	// faults, not attacks, so they stay too.
	keep := []string{
		"mechanical_hazard", "electrical_hazard", "thermal_hazard",
		"pneumatic_hydraulic", "noise_vibration", "ergonomic_hazard",
		"material_environmental", "chemical_risk", "fire_explosion",
		"software_control", "software_fault", "safety_function_failure",
		"configuration_error", "sensor_fault", "hmi_error",
		"communication_failure", "update_failure",
	}
	for _, c := range keep {
		if isCyberSecurityCategory(c) {
			t.Errorf("category %q must stay in the traditional IACE log, not be routed to CRA", c)
		}
	}
}
