"""Class insights router. GET /ai/v2/class-insights/{class_id} — returns class-level weak LOs, at-risk counts, and recommended interventions. """ from fastapi import APIRouter, Depends, Query from app.api.v2.dependencies import get_class_insights_service from app.schemas.class_insights import ClassInsightsResponse router = APIRouter(prefix="/ai/v2", tags=["inference"]) @router.get( "/class-insights/{class_id}", response_model=ClassInsightsResponse, summary="Get Class Insights", description="Return class-level insights including weakest LOs, at-risk students, and interventions.", ) async def get_class_insights( class_id: str, subject: str | None = Query(None, description="Optional subject filter"), service=Depends(get_class_insights_service), ) -> ClassInsightsResponse: """Retrieve class-level insights for a teacher.""" return service.get_insights(class_id=class_id, subject=subject)