from sqlalchemy import String, Text from sqlalchemy.dialects.sqlite import JSON from sqlalchemy.orm import Mapped, mapped_column from core_db import AuditMixin, Base, TenantMixin, VersionMixin from core_shared import JSONValue class KnowledgeBase(TenantMixin, AuditMixin, VersionMixin, Base): __tablename__ = "knowledge_base" code: Mapped[str] = mapped_column(String(64), index=True) name: Mapped[str] = mapped_column(String(128)) description: Mapped[str | None] = mapped_column(Text, nullable=True) status: Mapped[str] = mapped_column(String(32), default="active", index=True) metadata_json: Mapped[dict[str, JSONValue] | None] = mapped_column(JSON, nullable=True)