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


class Kb_articles(Base):
    __tablename__ = "kb_articles"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    title = Column(String, nullable=False)
    slug = Column(String, nullable=True)
    source = Column(String, nullable=False)
    source_url = Column(String, nullable=True)
    content = Column(String, nullable=False)
    tags = Column(String, nullable=True)
    is_published = Column(Boolean, nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)