from datetime import datetime from sqlalchemy import DateTime, 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 User(TenantMixin, AuditMixin, VersionMixin, Base): __tablename__ = "auth_user" username: Mapped[str] = mapped_column(String(128), index=True) display_name: Mapped[str | None] = mapped_column(String(128), nullable=True) email: Mapped[str | None] = mapped_column(String(256), nullable=True, index=True) status: Mapped[str] = mapped_column(String(32), default="active", index=True) metadata_json: Mapped[dict[str, JSONValue]] = mapped_column(JSON, default=dict) last_login_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)