Source code for cadrumo.application.filing._producer_snapshot_m390
"""Annual Modelo 390 filing arrivals owned by the producer snapshot."""from__future__importannotationsfromcollections.abcimportMappingfromdecimalimportDecimalfrompydanticimportBaseModel,model_validatorfrom...core.errors.hierarchyimportpydantic_validation_boundaryfrom...core.filing_projection_refimport(M390ActivityField,M390DifferentiatedDeductionProjectionField,M390ProrrataActivityProjectionField,M390RegimenSimplificadoActivityField,M390RegimenSimplificadoCohort,M390RegimenSimplificadoModuleValue,M390RepresentativeField,M390RepresentativeKind,)from...core.modelsimportSTRICT_FROZEN_CONFIGfrom...core.periodimportPeriod,StandardPeriodCodefrom...domain.calculations.registry.schema_referencesimportSourceReferencetypeM390ProjectionScalar=str|Decimal|None
[docs]classM390RegimenSimplificadoModuleValueArrival(BaseModel):"""One source-shaped module pair on a non-agricultural activity row."""model_config=STRICT_FROZEN_CONFIGslot:intmodule_order:intvalues:Mapping[M390RegimenSimplificadoModuleValue,M390ProjectionScalar]
[docs]classM390FilingFacts(BaseModel):"""Complete source-shaped repeated-row arrivals for one annual Modelo 390 filing. Row values remain addressed by the closed core projection references. This layer therefore owns value arrival only; a semantic map later supplies the export-record coordinate without introducing a second M390 selector. """model_config=STRICT_FROZEN_CONFIGperiod:Periodregistry_revision_id:strrecord_design:SourceReferenceactivity_rows:tuple[M390ActivityValueArrival,...]=()representative_rows:tuple[M390RepresentativeValueArrival,...]=()regimen_simplificado_activity_rows:tuple[M390RegimenSimplificadoActivityValueArrival,...]=()regimen_simplificado_module_rows:tuple[M390RegimenSimplificadoModuleValueArrival,...]=()prorrata_activity_rows:tuple[M390ProrrataActivityValueArrival,...]=()differentiated_deduction_rows:tuple[M390DifferentiatedDeductionValueArrival,...]=()@model_validator(mode="after")@pydantic_validation_boundarydef_require_annual_period(self)->M390FilingFacts:ifself.period.standard_codeisnotStandardPeriodCode.ANNUAL:raiseValueError("M390 repeated-row filing facts require the annual 0A period")returnself