aeat.domain.submission._protocols module¶
Narrow Protocol surfaces and value types for the submission engine.
The submission engine is composed of read-only sub-systems that the test suite exercises with concrete, hand-rolled Protocol-conforming classes (no mocks, no patches). Each Protocol declares only the surface the engine actually consumes, decoupling submission from the richer surfaces of its sibling subpackages.
AuthProviderProbe— narrow auth-provider surface for the preflight gate.DeadlineWindowChecker— narrow surface overaeat.domain.deadlinesused by preflight.ModeloFinding/ModeloDraftLike/ModeloDraftLoader— narrow filing draft surfaces;aeat.application.filing.ModeloDraftstructurally conforms toModeloDraftLike.
Every record is either a strict+frozen pydantic v2 model or a
runtime_checkable Protocol; no dataclasses; no bare dicts.
- class AuthProviderDescriptionLike(*args, **kwargs)[source]¶
Bases:
ProtocolSubmission-facing shape returned by an auth provider.
- Variables:
kind – Provider identifier (kept as
objectso the protocol does not couple submission to the auth subpackage’s enum).label – Human-readable provider name.
configured – Whether the provider’s required settings are present.
available – Whether a session can currently be established.
subject – Subject DN (or equivalent identity string), if known.
expires_on – Expiry date for the underlying credential, if known.
- class AuthProviderProbe(*args, **kwargs)[source]¶
Bases:
ProtocolNarrow submission-facing auth-provider surface.
- describe()[source]¶
Return an
AuthProviderDescriptionLikedescribing the active auth provider.- Return type:
- class DeadlineWindowChecker(*args, **kwargs)[source]¶
Bases:
ProtocolNarrow surface over
aeat.domain.deadlinesfor the preflight gate.
- class ModeloFinding(**data)[source]¶
Bases:
BaseModelMinimal finding record consumed by the preflight gate.
Distinct from
aeat.application.filing.ModeloValidationFinding, which carries the validator’s full provenance graph; the submission engine reads onlyseverityto decide whether the draft is blocked.- Variables:
severity – The finding severity;
ERRORblocks submission.message – Multilingual finding message.
- Parameters:
severity (BaseSeverity)
message (str)
- severity: BaseSeverity¶
- message: str¶
- class ModeloDraftStatus(*values)[source]¶
Bases:
StrEnumLifecycle status of a modelo draft, spanning preparation and submission.
The state machine carries a draft from creation through validation, operator approval, submission, and the AEAT-side terminal states. The preflight engine consumes only
APROBADOandAPROBACION_CADUCADAon its happy path; the broader filing / submission stack consumes the full lifecycle. Member names and values mirror the AEAT Sede labels per ADR A7.2.- Variables:
BORRADOR – New draft, not yet validated.
VALIDADO – Validation rules executed without errors.
LISTO_PARA_PRESENTAR – Draft fully prepared for an attempt.
APROBADO – Operator-approved for submission.
APROBACION_CADUCADA – Approval timestamp aged out.
PRESENTADA – A submission attempt is recorded.
ACEPTADA – AEAT acknowledged the filing.
RECHAZADA – AEAT rejected the filing.
ENMENDADO – Superseded by an amendment record.
ANULADO – Operator cancelled before submission.
- BORRADOR¶
- VALIDADO¶
- LISTO_PARA_PRESENTAR¶
- APROBADO¶
- APROBACION_CADUCADA¶
- PRESENTADA¶
- ACEPTADA¶
- RECHAZADA¶
- ENMENDADO¶
- ANULADO¶
- class ModeloDraftLike(*args, **kwargs)[source]¶
Bases:
ProtocolNarrow surface over a filing draft.
aeat.application.filing.ModeloDraftstructurally conforms to this Protocol so the engine can accept either the real draft or any Protocol-conforming hand-rolled class in tests.Attributes are declared as read-only properties so pyright treats them covariantly and frozen pydantic models satisfy the protocol without invariance errors.
- property profile_tax_id: SubjectTaxId¶
- class ModeloDraftLoader(*args, **kwargs)[source]¶
Bases:
ProtocolLoads a
ModeloDraftLikefrom a draft path on disk.- load(_draft_path, /)[source]¶
Load and return the
ModeloDraftLikeatdraft_path.- Return type:
- Parameters:
_draft_path (Path)
- class SubmissionRepositoryProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolNarrow domain-facing repository contract for the submission engine.
The concrete
SubmissionRepositorylives in the persistence adapter and inherits from the adapter-layerSecureBoundRepository. This Protocol captures only the surface the engine consumes so the domain depends inward on this port, and the application layer constructs the concrete repository and injects it intoSubmissionEngine.- load(record_id, /)[source]¶
Load a persisted
ModeloPresentadoby id, or return None if absent.- Return type:
- Parameters:
record_id (str)
- iter_submissions()[source]¶
Yield every persisted submission in lexicographic id order.
- Return type:
- Returns:
Iterator over
ModeloPresentadorecords.