from fastapi import FastAPI
from app.api.eta import router as eta_router
from app.services import simulation
from app.services import notifications
import os

app = FastAPI(title="Recoleccion API")
app.include_router(eta_router)


@app.on_event("startup")
async def startup_event():
    # Carga los datos en memoria al iniciar la app
    simulation.load_data()
    simulation.start_simulation_state()
    # Inicializar Firebase Admin si hay credenciales
    cred_path = os.environ.get("FIREBASE_CREDENTIALS_PATH", "backend/secrets/firebase-adminsdk.json")
    notifications.init_firebase(cred_path)
