from datetime import datetime

from sqlalchemy import JSON, DateTime, String, func
from sqlalchemy.orm import Mapped, mapped_column

from app.core.database import Base


class SuspendedOrder(Base):
    __tablename__ = "ordini_suspended_orders"

    id: Mapped[int] = mapped_column(primary_key=True, index=True)
    staff: Mapped[str] = mapped_column(String(80), nullable=False, unique=True, index=True)
    payload: Mapped[dict[str, int]] = mapped_column(JSON, nullable=False)
    updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
