aeat.application.wizard._models module¶
Descriptor models for the schema-driven wizard.
The five strict frozen pydantic v2 records below compose a closed,
declarative description of an operator-facing configuration flow.
WizardFlow is a tuple of WizardSection``s; a section is a tuple
of ``WizardQuestion``s; each question binds zero-or-one
``profile_key to the profile registry, declares exactly one
WizardWidget kind, and carries the prompt copy and the optional
WizardCondition that gates its visibility. The descriptor is the
single source of truth: the runtime, the Typer command factory, and
the compile_profile_keys projection all read off these records.
- class WizardWidget(*values)[source]¶
Bases:
StrEnumClosed taxonomy of input primitives the wizard runtime supports.
- TEXT¶
- SECRET¶
- CONFIRM¶
- SELECT¶
- CHECKBOX¶
- PATH¶
- INTEGER¶
- class WizardCondition(**data)[source]¶
Bases:
BaseModelSingle-clause predicate naming one earlier question.
The predicate names an earlier question by id and tests its canonical-token answer (
"true"/"false"for booleans, raw string for SELECT/TEXT, comma-joined token set for CHECKBOX). Exactly one of two clause kinds is set:equals— the answer must equal this literal token. Used for SELECT and CONFIRM gates (entity-type == "legal_entity").contains— the answer, split on commas into a token set, must contain this literal token. Used for CHECKBOX gates (irpf-income-categoriesincludesactividad_economica).
- question_id: str¶
- equals: str | None¶
- contains: str | None¶
- class WizardVisibility(**data)[source]¶
Bases:
BaseModelDisjunction of
WizardConditionclauses.A question is visible when any clause is satisfied. A single- clause visibility is the common case; a multi-clause visibility expresses “asked when A or B” (e.g.
activityis collected for a legal entity or for a natural person who declared an economic activity).- Parameters:
any_of (tuple[WizardCondition, ...])
- any_of: tuple[WizardCondition, ...]¶
- class WizardChoice(**data)[source]¶
Bases:
BaseModelOne entry in a SELECT or CHECKBOX widget’s closed-set choices.
- Parameters:
value (str)
label (Translatable)
description (Translatable | None)
- value: str¶
- label: tr¶
- description: tr | None¶
- class WizardQuestion(**data)[source]¶
Bases:
BaseModelOne operator-facing question in a wizard flow.
- Parameters:
id (str)
profile_key (str | None)
widget (WizardWidget)
prompt (Translatable)
help (Translatable | None)
choices (tuple[WizardChoice, ...])
default (str | None)
required (bool)
visible_when (WizardCondition | WizardVisibility | None)
answer_type (type[str] | type[bool] | type[int] | type[Path])
- id: str¶
- profile_key: str | None¶
- widget: WizardWidget¶
- prompt: tr¶
- help: tr | None¶
- choices: tuple[WizardChoice, ...]¶
- default: str | None¶
- required: bool¶
- visible_when: WizardCondition | WizardVisibility | None¶
- answer_type: type[str] | type[bool] | type[int] | type[Path]¶
- class WizardSection(**data)[source]¶
Bases:
BaseModelOne grouped sequence of questions inside a flow.
- Parameters:
id (str)
title (Translatable)
questions (tuple[WizardQuestion, ...])
- id: str¶
- title: tr¶
- questions: tuple[WizardQuestion, ...]¶
- class WizardFlow(**data)[source]¶
Bases:
BaseModelThe top-level descriptor for a single wizard surface.
- Parameters:
id (str)
title (Translatable)
description (Translatable)
sections (tuple[WizardSection, ...])
answers_model (type[BaseModel])
- id: str¶
- title: tr¶
- description: tr¶
- sections: tuple[WizardSection, ...]¶
- answers_model: type[BaseModel]¶
- iter_conditions(visible_when)[source]¶
Return every
WizardConditionclause in avisible_when.Normalises the three shapes
visible_whencan take —None(no gate), a bareWizardCondition(single clause), or aWizardVisibility(OR of clauses) — into a flat tuple so consumers iterate one uniform sequence.- Return type:
- Parameters:
visible_when (WizardCondition | WizardVisibility | None)