"""Domain-level repository Protocol for the invoice catalogue.Application-layer code that persists or loads the :class:`InvoiceCatalogue`depends on :class:`~aeat.domain.invoices.InvoiceCatalogueRepositoryProtocol`,not on the concrete secure-object-backed :class:`InvoiceCatalogueRepository`.This keeps callers typed against the narrow port while the concrete repositoryowns the adapter integration."""from__future__importannotationsfromtypingimportProtocol,runtime_checkablefrom._modelsimportInvoiceCatalogue
[docs]@runtime_checkableclassInvoiceCatalogueRepositoryProtocol(Protocol):"""Narrow domain-facing repository contract for the invoice catalogue. Any object that provides ``exists``, ``load``, and ``save`` over a per-bucket :class:`InvoiceCatalogue` satisfies this protocol. The production implementation is :class:`InvoiceCatalogueRepository`. """@propertydefbucket_id(self)->str|None:"""Return the profile bucket id when this repository resolved one."""...
[docs]defexists(self)->bool:"""Return whether an invoice catalogue has been persisted."""...
[docs]defload(self)->InvoiceCatalogue:"""Return the persisted catalogue or an empty catalogue if absent. Returns: The :class:`InvoiceCatalogue` loaded from storage. """...
[docs]defsave(self,catalogue:InvoiceCatalogue)->None:"""Persist ``catalogue`` atomically under the file lock. Args: catalogue: The :class:`InvoiceCatalogue` to persist. """...