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

from fastapi import APIRouter, Depends

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

router = APIRouter()


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