from pydantic import BaseModel, Field from typing import Optional class GloryBase(BaseModel): team_name: str = Field(..., min_length=1, max_length=100) league: str = Field(..., min_length=1, max_length=100) points: int = Field(default=0, ge=0) matches_played: int = Field(default=0, ge=0) wins: int = Field(default=0, ge=0) draws: int = Field(default=0, ge=0) losses: int = Field(default=0, ge=0) goals_for: int = Field(default=0, ge=0) goals_against: int = Field(default=0, ge=0) goal_difference: int = Field(default=0) position: int = Field(..., gt=0) is_active: bool = Field(default=True) season: str = Field(..., min_length=1, max_length=50) class GloryCreate(GloryBase): class Config: schema_extra = { "example": { "team_name": "Manchester United", "league": "Premier League", "position": 1, "season": "2023/2024" } } class Glory(GloryBase): id: int = Field(..., gt=0) class Config: orm_mode = True schema_extra = { "example": { "id": 1, "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" } }