"""Pin the CRA conformity-path gating (CRA Art. 32 / Anhang VIII).

Regression: wichtige Klasse-II- und kritische Produkte duerfen NICHT selbst
bewerten — eine harmonisierte Norm allein genuegt dort nicht.
"""
from compliance.api.cra_routes import ALLOWED_PATHS, CONFORMITY_PATHS


def test_self_assessment_only_for_standard_and_important_i():
    assert "self_assessment" in ALLOWED_PATHS["STANDARD"]
    assert "self_assessment" in ALLOWED_PATHS["IMPORTANT_I"]
    assert "self_assessment" not in ALLOWED_PATHS["IMPORTANT_II"]
    assert "self_assessment" not in ALLOWED_PATHS["CRITICAL"]


def test_important_ii_needs_notified_body_or_eucc():
    # Klasse II: harmonisierte Norm allein ist KEIN gueltiger Pfad.
    assert ALLOWED_PATHS["IMPORTANT_II"] == {"eucc", "notified_body"}


def test_critical_allows_eucc_and_notified_body():
    assert ALLOWED_PATHS["CRITICAL"] == {"eucc", "notified_body"}


def test_not_in_scope_has_no_paths():
    assert ALLOWED_PATHS["NOT_IN_SCOPE"] == set()


def test_all_allowed_paths_are_known():
    for paths in ALLOWED_PATHS.values():
        assert paths <= CONFORMITY_PATHS
