//! TOML form parser and executor
//!
//! Parses form definitions from TOML files and executes them interactively.
//!
//! This module is organized into focused submodules:
//! - `types`: Form data structures (FormDefinition, FieldDefinition, DisplayItem, etc.)
//! - `parser`: TOML parsing and file loading
//! - `executor`: Form execution logic
//! - `conditions`: Conditional expression evaluation
//! - `fragments`: Fragment and include handling
//! - `translation`: i18n translation support

mod conditions;
mod executor;
mod fragments;
mod parser;
mod translation;
mod types;

// Re-export public types
pub use types::{
    DisplayItem, DisplayMode, FieldDefinition, FieldType, FormDefinition, FormElement,
    SelectOption, WhenFalse,
};

// Re-export public functions - parser
pub use parser::{load_form, load_from_file, load_from_ncl, parse_toml};

// Re-export public functions - executor (async backend paths, always available)
pub use executor::{
    execute_with_backend, execute_with_backend_complete, execute_with_backend_from_dir,
    execute_with_backend_i18n, execute_with_backend_i18n_with_defaults,
    execute_with_backend_two_phase, execute_with_backend_two_phase_with_defaults,
    recompute_visible_elements, render_display_item,
};

// Re-export legacy sync paths (CLI-only: use InquireBackend directly)
#[cfg(feature = "cli")]
pub use executor::{execute, execute_with_base_dir, load_and_execute_from_file};

// Re-export public functions - conditions
pub use conditions::{
    evaluate_condition, identify_selector_fields, should_load_fragment, value_to_string,
};

// Re-export public functions - fragments
pub use fragments::{expand_includes, load_fragment_form};
