"""Permission catalog discovery API — Phase 13.0."""
from __future__ import annotations

from fastapi import APIRouter, Depends

from app.api.permissions import require_permissions
from app.permissions.definitions import (
    ALL_PERMISSIONS,
    HEALTHCARE_VIEW,
    PERMISSION_PREFIXES,
)
from shared.security import CurrentUser

router = APIRouter()


@router.get("/catalog")
async def permission_catalog(
    _user: CurrentUser = Depends(require_permissions(HEALTHCARE_VIEW)),
):
    """Static permission discovery for Identity / admin consoles."""
    return {
        "prefix": "healthcare.",
        "prefixes": list(PERMISSION_PREFIXES),
        "permissions": list(ALL_PERMISSIONS),
        "count": len(ALL_PERMISSIONS),
    }
