"""Connect-Endpoint: erzeugt IDE-/Agent-Snippets (auf den Gateway + Memory-MCP)."""

from fastapi import APIRouter

from services.connect import DEFAULT_HOST, build_snippets, check_health

router = APIRouter(prefix="/api")


@router.get("/connect")
def connect(host: str = DEFAULT_HOST, mcp_path: str | None = None) -> dict:
    kwargs = {}
    if mcp_path:
        kwargs["mcp_script_path"] = mcp_path
    return build_snippets(host=host, **kwargs)


@router.get("/connect/health")
def connect_health() -> dict:
    """Live-Status der zwei Leitungen (Gateway + Gedächtnis) für den Verbinden-Tab."""
    return check_health()
