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


class Chat_messages(Base):
    __tablename__ = "chat_messages"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    conversation_id = Column(Integer, nullable=False)
    sender_type = Column(String, nullable=False)
    sender_seat_id = Column(Integer, nullable=True)
    sender_name = Column(String, nullable=True)
    content = Column(String, nullable=False)
    attachments = Column(String, nullable=True)
    is_internal_note = Column(Boolean, nullable=True)
    ai_confidence = Column(Float, nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)