"""Validated AEAT modelo identifier value object.:class:`ModeloCode` enforces the three-digit identifier shape used by modelowork units and registry lookups, raising :class:`ModeloValidationError` beforefiling-grade availability is resolved from registry snapshots."""from__future__importannotationsfrompydanticimportGetCoreSchemaHandlerfrompydantic_coreimportcore_schemafrom._errorsimportModeloValidationError
[docs]classModeloCode(str):"""Three-digit AEAT modelo identifier. This type validates identifier shape only. Filing-grade availability is resolved from registry snapshots. """def__new__(cls,value:str)->ModeloCode:raw=str(value)iflen(raw)!=3ornotraw.isdigit():raiseModeloValidationError(f"modelo code must be a three-digit string, got {value!r}")returnstr.__new__(cls,raw)@classmethoddef__get_pydantic_core_schema__(cls,source_type:type[object],handler:GetCoreSchemaHandler,)->core_schema.CoreSchema:delsource_type,handlerreturncore_schema.no_info_after_validator_function(cls,core_schema.str_schema())