from sqlalchemy import String, DateTime, ForeignKey, Text
from sqlalchemy.orm import Mapped, mapped_column, relationship
from datetime import datetime
from app.database import Base


class MatchComment(Base):
    __tablename__ = "match_comments"

    id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
    spread_bet_id: Mapped[int] = mapped_column(ForeignKey("spread_bets.id"))
    user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
    content: Mapped[str] = mapped_column(Text)
    created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)

    # Relationships
    spread_bet: Mapped["SpreadBet"] = relationship()
    user: Mapped["User"] = relationship()
