cadrumo.application.modelo.maritime_preview module¶
Application service for active-profile maritime exemption previews.
This module backs the aeat app modelo work preview-maritime-exemption CLI
surface. It reads the active profile’s maritime_worker.* facts, normalises
them into cadrumo.domain.renta.maritime_exemption.MaritimeWorkerFacts, delegates legal
pathway selection and typed observation creation to
cadrumo.application.calculations.maritime_exemption_service.resolve_maritime_exemption(), and returns a
ModeloMaritimeExemptionPreview for transport rendering.
The RETMAR mandatory-filing completeness gate is handled here rather than in
the CLI transport. When the legal resolver raises
cadrumo.domain.renta.maritime_exemption.ProfileCompletenessError, the service preserves the
original profile facts and reruns the calculation with only
retmar_registered cleared, allowing the CLI to emit both the warning and the
same observation payload shape used by non-warning previews.
See also
cadrumo.entrypoints.cli._modelo_maritime_cli:Serves the CLI command that serialises this preview into operator payloads.
cadrumo.application.calculations.maritime_exemption_service.resolve_maritime_exemption():Legal application service that produces the typed observations.
cadrumo.domain.renta.maritime_exemption.MaritimeWorkerFacts:Closed profile fact carrier consumed by the maritime selectors.
cadrumo.domain.renta.maritime_exemption.ProfileCompletenessError:Warning-class gate used for RETMAR mandatory-filing disclosure.
- class ModeloMaritimeExemptionPreview(facts, result, retmar_warning_error=None)[source]¶
Bases:
objectResolved active-profile maritime preview returned to the CLI renderer.
- Variables:
facts – Original
MaritimeWorkerFactsread from the active profile. These facts are preserved even when RETMAR warning handling reruns the calculation with a cleared flag.result –
MaritimeExemptionResultcontaining typed observations and the derived casilla-value view.retmar_warning_error – Optional
ProfileCompletenessErrorfor the CLI to translate intoretmar_warningwhile still emitting observations.
- Parameters:
facts (MaritimeWorkerFacts)
result (MaritimeExemptionResult)
retmar_warning_error (ProfileCompletenessError | None)
Read
retmar_mandatory_filingfrom this preview, never fromresult: on the warning path the result was computed from cleared facts and its copy of that answer is false regardless of the truth.-
facts:
MaritimeWorkerFacts¶
-
result:
MaritimeExemptionResult¶
-
retmar_warning_error:
ProfileCompletenessError|None¶
- property retmar_mandatory_filing: bool¶
Whether RETMAR registration makes this filing mandatory.
Read from
factsrather than fromresult, and that is the whole point of the property. On the warning pathresultwas computed from facts with the RETMAR flag deliberately cleared, so its own copy of this answer is false whether or not the worker is registered. Asking here, through the service’s one determination, keeps the two paths agreeing and keeps the answer out of the renderer that was previously reconstructing it.
- maritime_facts_from_active_profile()[source]¶
Build
MaritimeWorkerFactsfrom the active workflow profile.The profile store exposes encrypted fact values as raw strings, so this adapter narrows the closed literal fields accepted by
MaritimeWorkerFactsand converts absent or falsy boolean facts toFalse. It does not evaluate legal eligibility; the returned facts are passed unchanged to the maritime exemption resolver.See also
cadrumo.application.user_profile.projections.fact_value():Reads a stored profile fact by dotted path.
cadrumo.application.workflow.persistence.workflow_state_repository():Supplies the active profile record.
- Return type:
- preview_maritime_exemption_for_active_profile(*, annual_salary, qualifying_days, gross_navigation_income, operation=None)[source]¶
Resolve the active profile maritime exemption preview.
annual_salaryandqualifying_daysare required only when the active facts trigger Art. 7.p) eligibility.gross_navigation_incomeis required only when the active facts trigger the REBECA pathway. The resolver owns those eligibility checks and raises the domain validation errors for missing inputs.RETMAR registration is a non-blocking warning for this preview: the first resolver call records the
ProfileCompletenessError, then the calculation is rerun withretmar_registered=Falseso the operator still receives the observation payload. The returnedModeloMaritimeExemptionPreviewkeeps the original facts, the rerun result, and the warning error for CLI translation.- Parameters:
annual_salary (
Decimal|None) – Optional gross annual salary in EUR for Art. 7.p).qualifying_days (
int|None) – Optional days worked outside Spanish territory for Art. 7.p).gross_navigation_income (
Decimal|None) – Optional gross navigation income in EUR for REBECA.operation (
PinnedAuthorityOperation|None) – Optional caller-held generation-pinned registry operation.
- Return type:
- Returns:
ModeloMaritimeExemptionPreviewcarrying original facts, resolved observations, and an optional RETMAR warning error.
See also
cadrumo.application.calculations.maritime_exemption_service.resolve_maritime_exemption():Performs DA 41, RETMAR, Art. 7.p), and REBECA resolution.
cadrumo.application.calculations.maritime_exemption_service.MaritimeExemptionResult:Typed observation carrier stored on the preview.