from core.database import Base
from datetime import datetime
from sqlalchemy import Column, DateTime, Integer, String


class Presales_messages(Base):
    __tablename__ = "presales_messages"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    name = Column(String(120), nullable=False)
    email = Column(String(255), nullable=False)
    phone = Column(String(40), nullable=True)
    company = Column(String(200), nullable=True)
    source_page = Column(String(80), nullable=False)
    topic = Column(String(40), nullable=True)
    message = Column(String, nullable=False)
    status = Column(String(20), nullable=True)
    user_agent = Column(String(500), nullable=True)
    referrer = Column(String(500), nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)