from fastapi import FastAPI

from app.db import create_db_and_tables
from app.routers import auth, health, postal_codes, referentials, simulations, stats, sync

app = FastAPI(
    title="RenoValid Back Office",
    version="0.1.0",
    description="Back-office MVP pour référentiels, barèmes, codes postaux, projets et statistiques terrain.",
)


@app.on_event("startup")
def on_startup() -> None:
    create_db_and_tables()


app.include_router(auth.router)
app.include_router(health.router)
app.include_router(referentials.router)
app.include_router(postal_codes.router)
app.include_router(simulations.router)
app.include_router(stats.router)
app.include_router(sync.router)
