"""# Summary Items persistence ports — integer-id document and repository factory. """ from mongo_ops import BaseDocument from pydantic import Field from domain.item.models import Item from infra.db.repos import create_repo class ItemDocument(Item, BaseDocument): """Persisted item document. The integer ``id`` shadows the ObjectId.""" id: int | None = Field(default=None, validation_alias="_id") def create_item_repo(): """Create the item repository selected by ``settings.repo_backend``. Returns: IntIdMemoryRepository | IntIdMongoRepository: Repository wired to the ``items`` collection/store. """ return create_repo("items", ItemDocument)