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


class AdminSettings(Base):
    __tablename__ = "admin_settings"

    id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
    default_house_commission_percent: Mapped[Decimal] = mapped_column(Numeric(5, 2), default=Decimal("10.00"))
    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_min_spread: Mapped[float] = mapped_column(Float, default=-10.0)
    default_max_spread: Mapped[float] = mapped_column(Float, default=10.0)
    spread_increment: Mapped[float] = mapped_column(Float, default=0.5)
    platform_name: Mapped[str] = mapped_column(String(100), default="H2H Sports Betting")
    maintenance_mode: Mapped[bool] = mapped_column(default=False)
    updated_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
