"""Email queue model for failed email retry."""
from sqlalchemy import Column, Integer, String, Text, TIMESTAMP, func
from app.database import Base


class EmailQueue(Base):
    __tablename__ = "email_queue"

    id = Column(Integer, primary_key=True, autoincrement=True)
    to_addr = Column(String(255), nullable=False)
    subject = Column(String(255), nullable=False)
    html_body = Column(Text, nullable=False)
    text_body = Column(Text)
    reply_to = Column(String(255))
    status = Column(String(32), default="pending", nullable=False)
    attempts = Column(Integer, default=0, nullable=False)
    created_at = Column(TIMESTAMP, server_default=func.now())
    updated_at = Column(TIMESTAMP, server_default=func.now(), onupdate=func.now())
