"""Typed axes for the IRNR (non-resident income tax) treaty surface.Registry-owned axes governing the Modelo 210 IRNR rate-resolution path arerepresented here by opaque string types. Their membership is projected at thedomain boundary rather than enumerated in this core module:* :class:`TipoRentaIrnr` — the income-type axis an IRNR filer tags each item with. It keys the TRLIRNR baseline rate table, the treaty override rows, and the Art. 25.1.b pension tariff branch. It was previously a free-text casilla value with no enum home, which forced adjacent verification work to route a categorical-equality predicate around the untyped axis.* :class:`ConvenioOverrideKind` — an opaque token projected from the governed ``irnr.convenio.override`` fact. Keeping the token typed lets consumers make the "más favorable" / limitation-of-benefits decision without duplicating the catalogue's value set here.Both IRNR axes are consumed by the cross-cutting ``irnr.convenio.override``authored fact and its :class:`~domain.calculations.registry.convenio.ConvenioAuthority`projection. The registry TOML stays free-form (a plain string token); theloader hydrates typed tokens at the boundary."""from__future__importannotationsfromenumimportStrEnumfromtypingimportSelffrompydanticimportGetCoreSchemaHandlerfrompydantic_coreimportCoreSchema,core_schemafrom.errors.hierarchyimportCoreValidationError,pydantic_validation_boundaryfrom.registry_tokenimportStrictRegistryToken
[docs]classTipoRentaIrnr(StrictRegistryToken):"""Opaque IRNR income-type token projected from governed fact 0080. The value set and its Modelo 210 code projection belong to the dated facts catalogue. This wire type deliberately carries no Python member list; callers must obtain instances through the typed registry resolver. """__slots__=()_projection_source="registry"
[docs]classM210PayerMode(StrictRegistryToken):"""Opaque Modelo 210 payer-mode token projected from the registry. The selected detail catalogue owns payer-mode membership, descriptions, and the code-35 applicability rule. This core type carries only the typed wire token; callers must obtain values through the registry projection. """__slots__=()_projection_source="registry"
[docs]classM210GrossIncomeSourceMode(StrEnum):"""Authority selected for Modelo 210 ``rendimientos_integros`` on one revision."""MANUAL="manual"LEDGER="ledger"
[docs]classConvenioOverrideKind(str):"""Opaque treaty-override token projected from ``irnr.convenio.override``. The governed catalogue owns the available override values. Keeping this type opaque prevents a second, closed Python taxonomy from drifting away from that catalogue; registry consumers must receive their token through ``from_registry``. """__slots__=()def__new__(cls,value:str,*,_registry_validated:bool=False)->Self:"""Construct only when called by the registry projection boundary."""ifnot_registry_validated:raiseTypeError("ConvenioOverrideKind tokens must be projected from the registry")ifnotisinstance(value,str)ornotvalue:raiseValueError("ConvenioOverrideKind token must be a non-empty string")returnstr.__new__(cls,value)
[docs]@classmethoddeffrom_registry(cls,value:str)->Self:"""Construct the typed value from its canonical registry token."""returncls(value,_registry_validated=True)
@classmethoddef_require_registry_token(cls,value:object)->Self:ifisinstance(value,cls):returnvalueraiseCoreValidationError("ConvenioOverrideKind must be projected from the governed registry")@classmethoddef__get_pydantic_core_schema__(cls,_source_type:object,_handler:GetCoreSchemaHandler,)->CoreSchema:"""Accept only a projected token and serialize it as text."""returncore_schema.no_info_plain_validator_function(pydantic_validation_boundary(cls._require_registry_token),json_schema_input_schema=core_schema.str_schema(),serialization=core_schema.to_string_ser_schema(),)@propertydefvalue(self)->str:"""Return the canonical wire token."""returnstr(self)@propertydefname(self)->str:"""Return the canonical token for diagnostics."""returnstr(self)