from contextlib import asynccontextmanager

from fastapi import FastAPI

from api import config

from .v1 import router


@asynccontextmanager
async def lifespan(_: FastAPI):
    await config.init_mongo_db()
    config.init_langfuse()
    yield


app = FastAPI(
    lifespan=lifespan,
    docs_url="/api/docs",
    openapi_url="/api/openapi.json",
)

app.include_router(router)
