"""Permission definition tests."""
from app.permissions.definitions import ALL_PERMISSIONS, PERMISSION_PREFIXES


def test_all_permissions_use_healthcare_prefix():
    assert ALL_PERMISSIONS
    for perm in ALL_PERMISSIONS:
        assert perm.startswith("healthcare.")


def test_permission_prefixes_stable():
    assert "healthcare." in PERMISSION_PREFIXES
    assert "healthcare.clinics." in PERMISSION_PREFIXES
    assert "healthcare.doctors." in PERMISSION_PREFIXES
    assert "healthcare.patients." in PERMISSION_PREFIXES


def test_doctor_patient_permissions_present():
    from app.permissions.definitions import (
        DOCTORS_CREATE,
        DOCTORS_VIEW,
        PATIENTS_CREATE,
        PATIENTS_VIEW,
    )

    assert DOCTORS_VIEW in ALL_PERMISSIONS
    assert DOCTORS_CREATE in ALL_PERMISSIONS
    assert PATIENTS_VIEW in ALL_PERMISSIONS
    assert PATIENTS_CREATE in ALL_PERMISSIONS
