"""Endpoints for listing available profiles and tools."""

from typing import Annotated

from fastapi import APIRouter, Depends

from navi.api.deps import get_profile_registry, get_tool_registry
from navi.core import ProfileRegistry, ToolRegistry

router = APIRouter(prefix="/agents", tags=["agents"])


@router.get("/profiles")
async def list_profiles(
    profiles: Annotated[ProfileRegistry, Depends(get_profile_registry)],
) -> list[dict]:
    return [
        {
            "id": p.id,
            "name": p.name,
            "description": p.description,
            "enabled_tools": p.enabled_tools,
            "llm_backend": p.llm_backend,
            "model": p.model,
        }
        for p in profiles.all()
    ]


@router.get("/tools")
async def list_tools(
    tools: Annotated[ToolRegistry, Depends(get_tool_registry)],
) -> list[dict]:
    return [
        {"name": t.name, "description": t.description}
        for t in tools.all()
    ]
