from fastapi import FastAPI
from core.config import settings, createAdminAcc
from db.session import engine
from db.base import Base
from apis.base import api_router


def include_routes(app):  # include all routes from our api/v1/
    app.include_router(api_router)


def startup():  # start the project, and create the tables
    app = FastAPI(
        title=settings.PROJECT_NAME,
        version=settings.PROJECT_VERSION,
    )
    Base.metadata.create_all(bind=engine)
    createAdminAcc()
    include_routes(app)
    return app


app = startup()


# Testing stuff
@app.get("/")
def root():
    return {"message": "Hello World!"}