Source code for cadrumo.domain.iva._component_rows
"""Generic adapter for registry-projected IVA component rows.Concrete category/kind rows, legal references, labels, and ordering belong tothe canonical registry. This private module retains only the mechanicalconversion boundary used by callers that already queried that registry."""from__future__importannotationsfromcollections.abcimportMappingfrom.componentsimportIvaCategoryComponents,IvaComponentVocabulary,IvaCuotaSettlement
[docs]defcomponent_row_from_registry(payload:Mapping[str,object],*,cuota_settlement_no_token:IvaCuotaSettlement|None=None,component_vocabulary:IvaComponentVocabulary|None=None,)->IvaCategoryComponents:"""Validate one registry-projected component row as the typed model."""context:dict[str,object]|None=Noneifcuota_settlement_no_tokenisnotNoneorcomponent_vocabularyisnotNone:context={}ifcuota_settlement_no_tokenisnotNone:context["cuota_settlement_no_token"]=cuota_settlement_no_tokenifcomponent_vocabularyisnotNone:context["component_vocabulary"]=component_vocabularyreturnIvaCategoryComponents.model_validate(dict(payload),context=context)