Source code for aeat.domain.prorrata_register._protocols
"""Domain-level repository Protocol for the cross-period IVA prorrata register.Application-layer code that persists or loads the :class:`ProrrataRegister`depends on :class:`ProrrataRegisterRepositoryProtocol`, not on the concreteadapter-backed :class:`ProrrataRegisterRepository`. This keeps the domain layerfree of adapter imports while still providing a typed port surface."""from__future__importannotationsfromtypingimportTYPE_CHECKING,Protocol,runtime_checkableifTYPE_CHECKING:# pragma: no cover - typing-only boundary DTO (lives in core, not adapters)from...coreimportSecureObjectWritefrom.importProrrataRegister
[docs]@runtime_checkableclassProrrataRegisterRepositoryProtocol(Protocol):"""Narrow domain-facing repository contract for the prorrata register. Any object that provides ``load`` and ``to_secure_object_write`` over the singleton :class:`ProrrataRegister` satisfies this protocol. The concrete secure-object-backed implementation is :class:`ProrrataRegisterRepository`. """
[docs]defload(self)->ProrrataRegister:"""Return the persisted register or an empty register if absent. Returns: The :class:`ProrrataRegister` loaded from storage. """...
[docs]defto_secure_object_write(self,register:ProrrataRegister)->SecureObjectWrite:"""Return the :class:`SecureObjectWrite` for ``register`` without committing it."""...