Source code for cadrumo.domain.calculations.registry.applicability_routes
"""Tax-route primitives for modelo applicability."""from__future__importannotationsfromenumimportStrEnum,autofrom...contribuyente.entity_typeimport(EntityType,entity_type_attribution_entity_token,entity_type_legal_entity_token,entity_type_natural_person_token,)__all__=["TaxRoute","tax_route_for_entity_type"]
[docs]classTaxRoute(StrEnum):"""The tax branch a taxpayer profile routes to."""IRPF="irpf"IMPUESTO_SOCIEDADES="impuesto_sociedades"ATTRIBUTION_PASS_THROUGH=auto()INCOMPLETE="incomplete"
[docs]deftax_route_for_entity_type(entity_type:EntityType)->TaxRoute:"""Resolve the tax route against the registry-declared entity tokens."""ifentity_type==entity_type_natural_person_token():returnTaxRoute.IRPFifentity_type==entity_type_legal_entity_token():returnTaxRoute.IMPUESTO_SOCIEDADESifentity_type==entity_type_attribution_entity_token():returnTaxRoute.ATTRIBUTION_PASS_THROUGHraiseValueError(f"entity type {entity_type!r} has no declared tax route")