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


class Chat_attachments(Base):
    __tablename__ = "chat_attachments"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    conversation_id = Column(Integer, nullable=False)
    message_id = Column(Integer, nullable=True)
    object_key = Column(String, nullable=False)
    file_name = Column(String, nullable=False)
    mime_type = Column(String, nullable=True)
    size_bytes = Column(Integer, nullable=True)
    url = Column(String, nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)