cadrumo.domain.user_profile.setup_answers module

Canonical typed-answer model for the user-profile setup flow.

SetupAnswers is the authoritative typed-answers model for the wizard setup flow. It lives with the user-profile domain because its fields are the typed vocabulary of a profile, while the application wizard only renders and persists those answers.

This module owns typed answer validation and the stable output-language profile path. It does not own prompt rendering, profile persistence, secure storage, deadline scheduling, or registry semantics. The registry-aware reverse projection is defined by cadrumo.domain.deadlines.setup_answer_projection.

The application layer declares the SETUP_FLOW descriptor and consumes this model directly. Downstream profile construction, including taxpayer_profile_from_mapping, therefore stays aligned with wizard canonical-token parsing without importing application modules directly.

Domain taxonomy types (EntityType, IVARegime, etc.) are imported from their defining domain modules at module load time. Keeping those finite imports here makes this model domain-owned and removes the former core-to-domain lazy import cycle.

PROFILE_OUTPUT_LANGUAGE_PATH: Final[str]

Dotted profile-record path for the setup flow’s output-language answer.

class SetupAnswers(**data)[source]

Bases: BaseModel

Typed answers collected by the setup flow.

Canonical home is cadrumo.domain.user_profile.setup_answers. The application wizard and deadline domain import SetupAnswers from here; no layer needs to cross into the application boundary.

The model stores canonical answer tokens and typed taxonomy values for the setup flow. It is not the persisted profile record and it is not the deadline-engine taxpayer profile; those are produced downstream by wizard persistence and deadline profile projection. Where validators allow the empty string, the value means undeclared/no answer rather than false, zero, or a default legal fact.

Field annotations use Any for taxonomy union types because the setup flow carries typed enum members alongside the blank undeclared sentinel. That Any is not a loose schema: validators enforce the same invariants, reject values outside the declared enum / blank-string set, and raise ProfileAnswerTypeError.

Parameters:

data (Any)

tax_id: str
name: str
surnames: str
legal_name: str
activity: str

Free-text actividad económica / epígrafe IAE description.

address_postcode: OptionalSpanishPostcode

Optional Spanish postcode for the taxpayer’s activity/contact address.

activity_start_date: str

Optional ISO-8601 censo alta date for the economic activity.

taxation_type: Any
output_language: OutputLanguage
entity_type: Any
legal_entity_form: Any
incn_prior_12_months: str

Optional INCN as a canonical decimal string.

new_entity_first_two_profit_periods: Any

Optional three-state bool for LIS Art. 29 new-entity rate.

ley_49_2002_option_declared: Any

Optional three-state bool for the governed special-regime option.

ley_49_2002_option_date: str

ISO-8601 date declared for the governed special-regime option.

ley_49_2002_renunciation_declared: Any

Optional three-state bool for governed special-regime renunciation.

ley_49_2002_renunciation_date: str

ISO-8601 date declared for governed special-regime renunciation.

irpf_income_categories: str

Comma-separated set of IrpfIncomeCategory tokens.

declaration_roles: str

Comma-separated set of ThirdPartyDeclarationRole tokens.

taxpayer_sex: Any
taxpayer_marital_status: Any
taxpayer_marriage_date: str

ISO-8601 date when the current marriage began.

taxpayer_birth_date: str
taxpayer_disability_grade: Any
taxpayer_death_date: str
spouse_tax_id: str
spouse_name: str
spouse_surnames: str
spouse_birth_date: str
spouse_sex: Any
spouse_disability_grade: Any
spouse_non_resident_irpf: bool
spouse_eu_eea_resident: bool
spouse_eu_eea_country: str
family_descendants_eu_eea_deduction: bool
family_minor_children_in_unit: bool
situacion_familiar: Any

Art. 82 LIRPF family situation governing conjunta eligibility.

unidad_familiar_descendientes_exclusivos: Any

Custodia compartida progenitor claiming the monoparental unidad familiar.

iva_regime: Any
iva_roi_enrolled: Any
iva_oss_enrolled: Any
iva_group_member_enrolled: Any
iva_group_dominant_entity_enrolled: Any
iva_sii_enrolled: Any
iva_redeme_enrolled: Any
iva_intracommunity_operations_exceed_50000_eur: Any
iva_m303_regime_composition: str
iva_cash_accounting_regime_enrolled: Any
iva_voluntary_sii_enrolled: Any
iva_hydrocarbon_deposit_advance_payment_deduction_entitled: Any
enrollment_large_company: bool
enrollment_public_administration_budget_gt_6000000: bool
has_employees: bool
colegio_concertado: Any
pays_professionals_with_retencion: bool
professional_income_withholding_ge_70pct: bool
art109_activity_income_withholding_ge_70pct: bool
pays_rent_with_retencion: bool
pays_capital_income_with_retencion: bool
modelo_111_no_retenciones_periods: str
irpf_estimation_regime: Any
irpf_activity_kind: Any
objective_estimation_modulos_iae_epigraph: str
objective_estimation_modulos_module_1_units: str
objective_estimation_modulos_module_2_units: str
objective_estimation_modulos_module_3_units: str
objective_estimation_modulos_module_4_units: str
objective_estimation_modulos_module_5_units: str
objective_estimation_modulos_module_6_units: str
objective_estimation_modulos_module_7_units: str
irpf_special_regime: Any

IRPF special-regime axis. Blank for the general regime.

irpf_special_regime_start_date: str

ISO-8601 opt-in election date for the special regime.

does_intracomunitario: bool
third_party_transactions_above_347_threshold: bool
bienes_extranjero_above_threshold: bool
monedas_virtuales_extranjero_above_threshold: bool
tax_residence_ccaa: Any
tax_residence_jurisdiction_scope: str
fiscal_residency: Any

Fiscal residency category.

country_of_fiscal_residence: str

ISO 3166-1 alpha-2 code of the country of fiscal residence.

representante_fiscal_nif: str

NIF/NIE of the fiscal representative in Spain.

representante_fiscal_nombre: str

Full name of the fiscal representative in Spain.

llm_vision: bool
google_export: bool
notes: str