"""ORM model for configurable position-roundtable roles.""" from __future__ import annotations from datetime import UTC, datetime from sqlalchemy import Boolean, Integer, String from sqlalchemy.orm import Mapped, mapped_column from deerflow.persistence.base import Base from deerflow.persistence.types import BeijingDateTime class PositionRoleRow(Base): """A work-view role in the position-roundtable product. ``role_type`` is intentionally small and stable: ``standard`` denotes a normal business-chain position; ``intent`` denotes the single special position responsible for initial intent identification and closing-agent entry. It is a configuration concern, not an organisation/RBAC position. """ __tablename__ = "position_roles" id: Mapped[str] = mapped_column(String(128), primary_key=True) name: Mapped[str] = mapped_column(String(128), unique=True, index=True) description: Mapped[str] = mapped_column(String(512), default="") role_type: Mapped[str] = mapped_column(String(32), default="standard", index=True) enabled: Mapped[bool] = mapped_column(Boolean, default=True) is_builtin: Mapped[bool] = mapped_column(Boolean, default=False, server_default="0") sort_order: Mapped[int] = mapped_column(Integer, default=0) updated_by: Mapped[str | None] = mapped_column(String(64)) updated_at: Mapped[datetime] = mapped_column( BeijingDateTime(), default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC), )