from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel, Field
from app.models.entities import PyObjectId


class SessionEntity(BaseModel):
    id: Optional[PyObjectId] = Field(default=None, alias="_id")
    session_code: str
    quiz_id: str
    host_id: str
    created_at: datetime = Field(default_factory=datetime.now)
    started_at: datetime | None = None
    ended_at: datetime | None = None
    is_active: bool = True
    participan_limit: int = 10
    participants: List[str] = []
    current_question_index: int = 0
