cadrumo.domain.prorrata_register.protocols module

Domain-level repository Protocol for the cross-period IVA prorrata register.

Application-layer code that persists or loads the ProrrataRegister depends on ProrrataRegisterRepositoryProtocol, not on the concrete adapter-backed ProrrataRegisterRepository. This keeps the domain layer free of adapter imports while still providing a typed port surface.

class ProrrataRegisterRepositoryProtocol(*args, **kwargs)[source]

Bases: Protocol

Narrow domain-facing repository contract for the prorrata register.

Any object that provides its readable bucket identity together with load and to_secure_object_write over the singleton ProrrataRegister satisfies this protocol. The concrete secure-object-backed implementation is ProrrataRegisterRepository.

property bucket_id: str | None

Return the profile bucket id when the repository is explicitly bound to one.

load()[source]

Return the persisted register or an empty register if absent.

Return type:

ProrrataRegister

Returns:

The ProrrataRegister loaded from storage.

load_revisioned()[source]

Return the register together with its current persistence revision.

Return type:

tuple[ProrrataRegister, str]

to_secure_object_write(register, *, expected_revision_id=None)[source]

Return the guarded SecureObjectWrite for register without committing it.

expected_revision_id must be the revision returned by load_revisioned() whenever the singleton register was rebuilt from a read.

Return type:

SecureObjectWrite

Parameters: