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


def test_all_permissions_use_beauty_business_prefix():
    assert ALL_PERMISSIONS
    for perm in ALL_PERMISSIONS:
        assert perm.startswith("beauty_business.")


def test_permission_prefixes_stable():
    assert "beauty_business." in PERMISSION_PREFIXES
    assert "beauty_business.organizations." in PERMISSION_PREFIXES
    assert "beauty_business.appointments." in PERMISSION_PREFIXES
    assert "beauty_business.integrations." in PERMISSION_PREFIXES


def test_appointment_permissions_present():
    from app.permissions.definitions import (
        APPOINTMENTS_CONFIRM,
        APPOINTMENTS_CREATE,
        APPOINTMENTS_VIEW,
    )

    assert APPOINTMENTS_VIEW in ALL_PERMISSIONS
    assert APPOINTMENTS_CREATE in ALL_PERMISSIONS
    assert APPOINTMENTS_CONFIRM in ALL_PERMISSIONS
