# app/routers/admin.py
from fastapi import APIRouter, HTTPException

from app.services.berlin_data_service import BerlinDataService

router = APIRouter(prefix="/admin", tags=["admin"])

# Services
berlin_data = BerlinDataService()

@router.post("/refresh-data")
async def refresh_berlin_data():
    """Refresh cached Berlin open data (admin endpoint)."""
    try:
        result = await berlin_data.refresh_all_data()
        return {"status": "success", "refreshed": result}
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Refresh failed: {str(e)}")
