from __future__ import annotations

from datetime import date

from sqlalchemy import Boolean, Date, Float, Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column

from .base import Base


class TournamentResult(Base):
    """SQLAlchemy ORM model for TournamentResults"""

    __tablename__ = "TournamentResults"

    # Primary Key - using UniqueLine as primary key
    UniqueLine: Mapped[str] = mapped_column(String, primary_key=True)

    # Basic Information
    Event: Mapped[str | None] = mapped_column(String, default=None)
    OverviewPage: Mapped[str | None] = mapped_column(String, default=None)
    Tier: Mapped[str | None] = mapped_column(String, default=None)
    Date: Mapped[date | None] = mapped_column(Date, default=None)
    Showmatch: Mapped[bool | None] = mapped_column(Boolean, default=None)

    # Team and Roster Information
    Team: Mapped[str | None] = mapped_column(String, default=None)
    RosterPage: Mapped[str | None] = mapped_column(String, default=None)
    PageAndTeam: Mapped[str | None] = mapped_column(String, default=None)

    # Placement Information
    Place: Mapped[str | None] = mapped_column(String, default=None)
    ForceNewPlace: Mapped[bool | None] = mapped_column(Boolean, default=None)
    Place_Number: Mapped[int | None] = mapped_column(Integer, default=None)
    Qualified: Mapped[bool | None] = mapped_column(Boolean, default=None)

    # Prize Information
    Prize: Mapped[int | None] = mapped_column(Integer, default=None)
    Prize_USD: Mapped[float | None] = mapped_column(Float, default=None)
    Prize_Euro: Mapped[float | None] = mapped_column(Float, default=None)
    PrizeUnit: Mapped[str | None] = mapped_column(String, default=None)
    Prize_Markup: Mapped[str | None] = mapped_column(String, default=None)
    PrizeOther: Mapped[str | None] = mapped_column(String, default=None)
    TotalPrize: Mapped[int | None] = mapped_column(Integer, default=None)

    # Phase and Group Information
    Phase: Mapped[str | None] = mapped_column(String, default=None)
    GroupName: Mapped[str | None] = mapped_column(String, default=None)

    # Achievement and Last Result Information
    IsAchievement: Mapped[bool | None] = mapped_column(Boolean, default=None)
    LastResult: Mapped[str | None] = mapped_column(String, default=None)
    LastTeam: Mapped[str | None] = mapped_column(String, default=None)
    LastOpponent_Markup: Mapped[str | None] = mapped_column(Text, default=None)
    LastOutcome: Mapped[str | None] = mapped_column(String, default=None)
