from sqlalchemy import String, Numeric, Float, Integer
from sqlalchemy.orm import Mapped, mapped_column
from decimal import Decimal
from app.database import Base


class AdminSettings(Base):
    """Global admin settings - single row configuration table"""
    __tablename__ = "admin_settings"

    id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)

    # House commission settings
    default_house_commission_percent: Mapped[Decimal] = mapped_column(Numeric(5, 2), default=Decimal("10.00"))

    # Default betting limits
    default_min_bet_amount: Mapped[Decimal] = mapped_column(Numeric(12, 2), default=Decimal("10.00"))
    default_max_bet_amount: Mapped[Decimal] = mapped_column(Numeric(12, 2), default=Decimal("1000.00"))

    # Default spread range for new events
    default_min_spread: Mapped[float] = mapped_column(Float, default=-10.0)
    default_max_spread: Mapped[float] = mapped_column(Float, default=10.0)

    # Spread increment (0.5 or 1.0)
    spread_increment: Mapped[float] = mapped_column(Float, default=0.5)

    # Platform settings
    platform_name: Mapped[str] = mapped_column(String(100), default="H2H Sports Betting")
    maintenance_mode: Mapped[bool] = mapped_column(default=False)

    # Note: This should be a single-row table
    # Access via: await db.execute(select(AdminSettings).limit(1))
