from sqlalchemy import Column, Integer, String, Text, DateTime
from sqlalchemy.sql import func
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime

Base = declarative_base()

class CallRecord(Base):
    __tablename__ = "call_records"

    id = Column(Integer, primary_key=True, index=True)
    original_audio_path = Column(String, nullable=False)  # keep path required
    processed_audio_path = Column(String, nullable=True)
    original_file_name = Column(String, nullable=True)
    file_title = Column(String, nullable=True)
    ai_title = Column(String, nullable=True)
    transcription_text = Column(Text, nullable=True)
    language = Column(String, nullable=True)
    sentiment = Column(String, nullable=True)
    category = Column(String, nullable=True)
    created_at = Column(DateTime(timezone=True), server_default=func.now())
