"""Test-only entity used to exercise the framework without pulling in a real domain entity. Milestone 0.5 introduces the Registrant entity for the vertical slice; until then, this Thing model is enough to prove CRUD + audit + versioning. """ from __future__ import annotations from typing import ClassVar from pydantic import BaseModel from sqlalchemy import String from sqlalchemy.orm import Mapped, mapped_column from ypms.db import Base from ypms.framework.base import SoftDeleteMixin, TimestampMixin, VersionedMixin from ypms.framework.retention import Disposal, RetentionPolicy class Thing(Base, TimestampMixin, SoftDeleteMixin, VersionedMixin): __tablename__ = "things" # Every mapped table needs a policy, test-only ones included (milestone 0.7). retention_policy: ClassVar[RetentionPolicy] = RetentionPolicy( "test_fixture", Disposal.RETAIN, None, authority="test-only model" ) id: Mapped[int] = mapped_column(primary_key=True) name: Mapped[str] = mapped_column(String(64), nullable=False) color: Mapped[str | None] = mapped_column(String(32), nullable=True) class ThingCreate(BaseModel): name: str color: str | None = None class ThingUpdate(BaseModel): name: str | None = None color: str | None = None class ThingRead(BaseModel): id: int name: str color: str | None = None version: int