from typing import List, Optional
from datetime import datetime
from pydantic import BaseModel

# Base schema with common attributes
class GameBase(BaseModel):
    name: str
    publisher: Optional[str] = None
    release_date: Optional[datetime] = None
    description: Optional[str] = None
    website: Optional[str] = None
    logo_url: Optional[str] = None
    status: Optional[str] = "active"  # active, inactive, discontinued

# Schema for creating a new game
class GameCreate(GameBase):
    pass

# Schema for updating a game
class GameUpdate(GameBase):
    pass

# Schema for reading a game
class GameInDB(GameBase):
    id: int
    created_at: datetime
    updated_at: Optional[datetime] = None

    class Config:
        from_attributes = True

# Schema for deleting a game
class GameDelete(BaseModel):
    message: str

# Schema for listing games
class GameList(BaseModel):
    games: List[GameInDB]
    total: int
    page: int
    limit: int 