from typing import Optional
from datetime import datetime
from ninja import Schema


class NoitaSubmissionOut(Schema):
    id: str
    user_id: Optional[int]
    username: Optional[str]
    file_size: int
    content_type: str
    created_at: datetime
    processed: bool


class ObjectivResultOut(Schema):
    objectiv_id: str
    display_string: str
    first_seen_at: datetime | None
    count: int
    max_count: int
    seed: str | None
    points_per_objectiv: int
    total_points: int | None


class ResultsOut(Schema):
    total_score: int
    deaths_count: int
    objectives: list[ObjectivResultOut]


class LeaderboardEntryOut(Schema):
    rank: int
    username: str
    is_staff: bool
    total_score: int
    objectives_count: int
    deaths_count: int


class LeaderboardOut(Schema):
    leaderboard: list[LeaderboardEntryOut]
