from pydantic import BaseModel, Field from typing import Optional class GloryBase(BaseModel): team_name: str = Field(..., description="Team name", index=True) league: str = Field(..., description="League name") points: int = Field(default=0, description="Total points") matches_played: int = Field(default=0, description="Number of matches played") wins: int = Field(default=0, description="Number of wins") draws: int = Field(default=0, description="Number of draws") losses: int = Field(default=0, description="Number of losses") goals_for: int = Field(default=0, description="Goals scored") goals_against: int = Field(default=0, description="Goals conceded") goal_difference: int = Field(default=0, description="Goal difference") position: int = Field(..., description="Current position in league") is_active: bool = Field(default=True, description="Team active status") season: str = Field(..., description="Season identifier") coach: Optional[str] = Field(None, description="Team coach name") home_stadium: Optional[str] = Field(None, description="Home stadium name") class GloryCreate(GloryBase): class Config: schema_extra = { "example": { "team_name": "Manchester United", "league": "Premier League", "position": 1, "season": "2023/2024", "coach": "Erik ten Hag", "home_stadium": "Old Trafford" } } class Glory(GloryBase): class Config: orm_mode = True schema_extra = { "example": { "team_name": "Manchester United", "league": "Premier League", "points": 75, "matches_played": 38, "wins": 23, "draws": 6, "losses": 9, "goals_for": 68, "goals_against": 36, "goal_difference": 32, "position": 1, "is_active": True, "season": "2023/2024", "coach": "Erik ten Hag", "home_stadium": "Old Trafford" } }