"""
Public feature-flag read API — lets the authenticated frontend know
which AI-powered sections to render.

This is NOT the admin mutation endpoint (that's in ``admin.py`` and
gated by ``require_admin``). Here we only expose the effective boolean
state so the UI can hide things like the People view, Tags view, or
text-search affordances when the underlying pipeline stage is off.
"""
from fastapi import APIRouter, Depends

from app.dependencies import get_current_user
from app.models.user import User
from app.services.feature_flags import ALL_FLAGS, is_enabled

router = APIRouter()


@router.get("")
async def get_enabled_features(_: User = Depends(get_current_user)):
    """Return ``{flag_name: bool}`` for every known flag, reflecting
    the currently effective value (admin override or YAML default)."""
    return {name: is_enabled(name) for name in ALL_FLAGS}
