from logging import getLogger

from fastapi import FastAPI
from fastapi.responses import ORJSONResponse

from database import lifespan
from middlewares import register_middlewares

from .config import settings
from .exceptions import register_exceptions
from .routers.v1 import router as v1_router

logger = getLogger(__name__)

app = FastAPI(
    debug=settings.DEBUG,
    title=settings.APP_NAME,
    description=settings.APP_DESCRIPTION,
    version=str(settings.VERSION),
    openapi_url=None,
    default_response_class=ORJSONResponse,
    lifespan=lifespan,
    docs_url=None,
    redoc_url=None,
)

app = register_middlewares(app)
app = register_exceptions(app)
app.include_router(v1_router)
