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


class Chat_analytics_daily(Base):
    __tablename__ = "chat_analytics_daily"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    date = Column(Date, nullable=False)
    department_id = Column(Integer, nullable=True)
    total_chats = Column(Integer, nullable=True)
    ai_resolved = Column(Integer, nullable=True)
    human_resolved = Column(Integer, nullable=True)
    avg_first_response_sec = Column(Integer, nullable=True)
    avg_resolution_sec = Column(Integer, nullable=True)
    sla_breaches = Column(Integer, nullable=True)
    escalations = Column(Integer, nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)