Source code for cadrumo.application.live.filed_data_ports
"""Application-owned ports for live filed-declaration acquisition.The filed-data use case coordinates register walks and persistence, but it doesnot know how an authenticated Sede page is opened or how a browser adaptercaptures one row. Those transport details are supplied through this module'ssmall structural ports by an outer composition root."""from__future__importannotationsfromcollections.abcimportCallable,SequencefromcontextlibimportAbstractAsyncContextManagerfromtypingimportTYPE_CHECKING,Protocolfrom...core.periodimportPeriodfrom.filed_observation_portsimport(FiledDeclarationProtocol,FiledObservationArtefactProtocol,FiledObservationProtocol,)ifTYPE_CHECKING:from...domain.calculations.registry.schemaimportModeloRevision
[docs]classFiledRegisterDeclarationProtocol(FiledDeclarationProtocol,Protocol):"""Full register-row view needed by listing and capture orchestration."""@propertydefejercicio(self)->int:"""Return the filing year carried by the register row."""...@propertydeftipo_solicitud(self)->str|None:"""Return the optional AEAT request type text."""...@propertydefobservaciones(self)->str|None:"""Return optional register observations text."""...@propertydefjustificante_link_text(self)->str|None:"""Return the receipt-link label when AEAT exposed one."""...@propertydefarchive_link_text(self)->str|None:"""Return the submitted-file link label when AEAT exposed one."""...@propertydefdeclaration_copy_link_text(self)->str|None:"""Return the declaration-copy link label when AEAT exposed one."""...@propertydefjustificante_cell_index(self)->int:"""Return the register cell containing the receipt link."""...@propertydefarchive_cell_index(self)->int|None:"""Return the register cell containing the submitted-file link."""...@propertydefdeclaration_copy_cell_index(self)->int|None:"""Return the register cell containing the declaration-copy link."""...
[docs]classFiledDeclarationAvailabilityProtocol(Protocol):"""One modelo and the years the external register offered for it."""@propertydefmodelo(self)->str:"""Return the offered modelo code."""...@propertydefejercicios(self)->Sequence[int]:"""Return offered filing years in register order."""...
[docs]classFiledDeclarationAvailabilityReportProtocol(Protocol):"""Read-only offered-option report returned by the acquisition port."""@propertydefitems(self)->Sequence[FiledDeclarationAvailabilityProtocol]:"""Return one offered-year record per register modelo option."""...@propertydefoffered_pairs(self)->tuple[tuple[str,int],...]:"""Return the offered ``(modelo, ejercicio)`` pairs."""...
[docs]classFiledDataRegisterPort(Protocol):"""Authenticated register session used by one filed-data operation."""@propertydefwalk_timeout_ms(self)->int:"""Return the configured timeout for one register walk."""...
[docs]asyncdefwalk(self,*,modelo:str,ejercicio:int)->tuple[FiledRegisterDeclarationProtocol,...]:"""Read one modelo/year register result."""...
[docs]asyncdefcapture_observation(self,declaration:FiledRegisterDeclarationProtocol,*,artefact_sink:FiledArtefactSink|None=None,)->FiledObservationProtocol:"""Capture one register row's evidence through the authenticated session."""...
[docs]classFiledDataCapturePort(Protocol):"""Outer-composed Sede capability for filed-data acquisition."""
[docs]defopen_register(self,*,operation:str)->AbstractAsyncContextManager[FiledDataRegisterPort]:"""Open one reusable register session for a walk or capture sweep."""...
[docs]asyncdefdiscover_availability(self,*,operation:str,)->FiledDeclarationAvailabilityReportProtocol:"""Read the register's offered modelo/year options."""...
[docs]asyncdefcapture_source_observations(self,revision:ModeloRevision,*,filing_year:int,period:Period,artefact_sink:FiledArtefactSink|None=None,operation:str,)->tuple[FiledObservationProtocol,...]:"""Capture registry-selected previous-filing and relation sources. Core types: :class:`~cadrumo.domain.calculations.registry.schema.ModeloRevision`. """...