""" API Dependencies — Shared dependency injection for all routes. """ from fastapi import Depends, HTTPException, Request from sqlalchemy.ext.asyncio import AsyncSession from core.gateway import AIPSTNGateway from db.database import get_db def get_gateway(request: Request) -> AIPSTNGateway: """Get the gateway instance from app state.""" gateway = getattr(request.app.state, "gateway", None) if gateway is None: raise HTTPException(status_code=503, detail="Gateway not initialized") return gateway