from __future__ import annotations from collections.abc import Callable, Iterator from dataclasses import dataclass from domain.property.property import Property @dataclass class Properties: """A first-class collection of Property objects — the unit of bulk operation in services (CONTEXT.md: Properties). Services take and return `Properties` rather than bare lists so batch operations read clearly. """ items: list[Property] def __iter__(self) -> Iterator[Property]: return iter(self.items) def __len__(self) -> int: return len(self.items) def filter(self, predicate: Callable[[Property], bool]) -> "Properties": return Properties([p for p in self.items if predicate(p)])