# app/models.py from pydantic import BaseModel, Field from typing import Any, Optional class QuizRequest(BaseModel): """Model for the incoming POST request to the API.""" email: str = Field(..., description="Student email ID") secret: str = Field(..., description="Student-provided secret") url: str = Field(..., description="A unique task URL") class QuizSubmitPayload(BaseModel): """Model for the payload sent to the submit endpoint.""" email: str secret: str url: str answer: Any # The answer type varies (str, int, bool, JSON object, etc.) class QuizSubmitResponse(BaseModel): """Model for the response received from the submit endpoint.""" correct: bool url: Optional[str] = Field(None, description="New quiz URL if provided") reason: Optional[str] = None