# backend/app/routers/llm.py
from fastapi import APIRouter, Depends

from ..llm.provider import LLMProvider, get_provider
from ..schemas import LLMHealth

router = APIRouter()  # prefix 없음. main.py 에서 prefix="/api" 등록.


@router.get("/llm/health", response_model=LLMHealth)
def llm_health(provider: LLMProvider = Depends(get_provider)):
    h = provider.health()
    return LLMHealth(
        reachable=h.get("reachable", False),
        provider=h.get("provider", ""),
        model=h.get("model", ""),
        host=h.get("host"),
        detail=h.get("detail", ""),
    )
