from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session

from .. import schemas
from ..database import get_db
from ..services.risk_service import analyze_risk

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


@router.post("/analyze", response_model=schemas.AnalysisResponse)
def analyze(payload: schemas.AnalysisRequest, db: Session = Depends(get_db)):
    return analyze_risk(db, payload)
