aeat.domain.invoices._protocols module

Domain-level repository Protocol for the invoice catalogue.

Application-layer code that persists or loads the InvoiceCatalogue depends on InvoiceCatalogueRepositoryProtocol, not on the concrete secure-object-backed InvoiceCatalogueRepository. This keeps callers typed against the narrow port while the concrete repository owns the adapter integration.

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

Bases: Protocol

Narrow domain-facing repository contract for the invoice catalogue.

Any object that provides exists, load, and save over a per-bucket InvoiceCatalogue satisfies this protocol. The production implementation is InvoiceCatalogueRepository.

property bucket_id: str | None

Return the profile bucket id when this repository resolved one.

exists()[source]

Return whether an invoice catalogue has been persisted.

Return type:

bool

load()[source]

Return the persisted catalogue or an empty catalogue if absent.

Return type:

InvoiceCatalogue

Returns:

The InvoiceCatalogue loaded from storage.

save(catalogue)[source]

Persist catalogue atomically under the file lock.

Parameters:

catalogue (InvoiceCatalogue) – The InvoiceCatalogue to persist.

Return type:

None