from __future__ import annotations from abc import ABC, abstractmethod from typing import Optional from datatypes.epc.domain.epc_property_data import EpcPropertyData class EpcRepository(ABC): """Persists and loads the structured EPC Property Data slice. `save` writes the `EpcPropertyData` to the `epc_property` parent row and its child tables; `get` reconstructs the persisted projection back into an `EpcPropertyData`. Round-trip fidelity over that projection is pinned by the Slice-1 round-trip test (Hestia-Homes/Model#1129). """ @abstractmethod def save( self, data: EpcPropertyData, property_id: int | None = None, portfolio_id: int | None = None, ) -> int: ... @abstractmethod def get(self, epc_property_id: int) -> EpcPropertyData: ... @abstractmethod def get_for_property(self, property_id: int) -> Optional[EpcPropertyData]: ... @abstractmethod def get_for_properties( self, property_ids: list[int] ) -> dict[int, EpcPropertyData]: """Bulk-hydrate a batch's EPCs, keyed by property_id (only those with an EPC are present). A handful of per-table queries, not N per property.""" ...