aeat.adapters.persistence.profile.filing_drafts module

Governed-persistence repository for filing drafts.

ModeloDraft records carry exact casilla arithmetic and tax due values. They are stored as encrypted byte objects via SecureObjectRepository at FINANCIAL SensitivityClass and serialised through an Envelope by SecureBoundRepository; no plaintext draft JSON or envelope file lands on disk.

This concrete repository is the persistence adapter behind the ModeloDraftRepositoryProtocol port. It lives in the persistence adapter (not in domain.filing) because its SecureBoundRepository base is SQL/crypto-coupled; the domain package owns only the typed ModeloDraft payload and the narrow read/save port that domain-facing service code depends on.

See also

ModeloDraft

Strict filing payload persisted by this repository.

SecureBoundRepository

Generic encrypted-envelope repository base used for the draft store.

adapters.persistence.storage.FILING_DRAFTS_NAMESPACE

Namespace, sensitivity, schema-version, object-key, and custody contract for draft secure objects.

application.filing

Application review flow that reads and updates persisted drafts.

class ModeloDraftRepository(*, bucket_id=None, objects=None)[source]

Bases: SecureBoundRepository[ModeloDraft]

Encrypted FINANCIAL repository for ModeloDraft payloads.

The SecureBoundRepository base wraps each draft in an Envelope and writes it under adapters.persistence.storage.FILING_DRAFTS_NAMESPACE. The draft id is the natural key, so list and iteration APIs expose draft aggregates rather than submission or amendment records. The namespace definition supplies the FINANCIAL SensitivityClass, schema version, object-key grammar, and custody contract.

Parameters:
namespace: ClassVar[str]
sensitivity: ClassVar[SensitivityClass]
schema_version: ClassVar[int]
classmethod payload_model()[source]

Return the ModeloDraft encrypted payload model for filing drafts.

Return type:

type[ModeloDraft]

property bucket_id: str | None

Return the profile bucket id when this repository resolved one.

extract_identifier(payload)[source]

Return the natural id for payload (used as the SQL object key).

Subclasses MUST override. The base implementation raises NotImplementedError.

Return type:

str

Parameters:

payload (ModeloDraft)

list_draft_ids()[source]

Return every draft id persisted in this repository, in lexicographic order.

Return type:

tuple[str, ...]

iter_drafts()[source]

Yield every persisted ModeloDraft, in lexicographic id order.

Return type:

Iterator[ModeloDraft]