"""People — first-class Aurora entities (section 6).""" from __future__ import annotations from datetime import date from sqlalchemy import JSON, Date, Float, String, Text from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.orm import Mapped, mapped_column from app.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin JSONVariant = JSONB().with_variant(JSON(), "sqlite") class Person(Base, UUIDPrimaryKeyMixin, TimestampMixin): __tablename__ = "people" name: Mapped[str] = mapped_column(String(300), nullable=False, index=True) aliases: Mapped[list[str]] = mapped_column(JSONVariant, default=list) biography: Mapped[str | None] = mapped_column(Text, nullable=True) birthday: Mapped[date | None] = mapped_column(Date, nullable=True) deathday: Mapped[date | None] = mapped_column(Date, nullable=True) birthplace: Mapped[str | None] = mapped_column(String(300), nullable=True) # Free-text, only populated when a source legitimately provides it — # never inferred. gender: Mapped[str | None] = mapped_column(String(30), nullable=True) known_for_department: Mapped[str | None] = mapped_column(String(100), nullable=True) popularity: Mapped[float | None] = mapped_column(Float, nullable=True) __all__ = ["Person"]