from datetime import datetime from sqlalchemy import DateTime, Integer, String 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 SkillVersion(TenantMixin, AuditMixin, VersionMixin, Base): __tablename__ = "skill_version" skill_id: Mapped[str] = mapped_column(String(36), index=True) version_no: Mapped[int] = mapped_column(Integer) status: Mapped[str] = mapped_column(String(32), default="draft", index=True) runtime_type: Mapped[str] = mapped_column(String(32), default="template") entrypoint: Mapped[str | None] = mapped_column(String(128), nullable=True) parameter_schema_json: Mapped[dict[str, JSONValue]] = mapped_column(JSON, default=dict) output_schema_json: Mapped[dict[str, JSONValue]] = mapped_column(JSON, default=dict) implementation_json: Mapped[dict[str, JSONValue]] = mapped_column(JSON, default=dict) published_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)