// src/lib.rs

pub mod canvas;
pub mod editor;
pub mod data_provider;

// Only include suggestions module if feature is enabled
#[cfg(feature = "suggestions")]
pub mod suggestions;

// Only include validation module if feature is enabled
#[cfg(feature = "validation")]
pub mod validation;

// First-class textarea module and exports
#[cfg(feature = "textarea")]
pub mod textarea;

// Only include computed module if feature is enabled
#[cfg(feature = "computed")]
pub mod computed;

#[cfg(feature = "cursor-style")]
pub use canvas::CursorManager;

// ===================================================================
// NEW API: Library-owned state pattern
// ===================================================================

// Main API exports
pub use editor::FormEditor;
pub use data_provider::DataProvider;
#[cfg(feature = "suggestions")]
pub use data_provider::{SuggestionsProvider, SuggestionItem};

// UI state (read-only access for users)
pub use canvas::state::EditorState;
pub use canvas::modes::AppMode;

// Actions and results (for users who want to handle actions manually)
pub use canvas::actions::{CanvasAction, ActionResult};

// Validation exports (only when validation feature is enabled)
#[cfg(feature = "validation")]
pub use validation::{
    ValidationConfig, ValidationResult, ValidationError,
    CharacterLimits, ValidationConfigBuilder, ValidationState,
    ValidationSummary, PatternFilters, PositionFilter, PositionRange, CharacterFilter, 
    DisplayMask,  // Simple display mask instead of complex ReservedCharacters
    // Feature 4: custom formatting exports
    CustomFormatter, FormattingResult, PositionMapper, DefaultPositionMapper,
};

// Computed exports (only when computed feature is enabled)
#[cfg(feature = "computed")]
pub use computed::{ComputedProvider, ComputedContext, ComputedState};

// Theming and GUI
#[cfg(feature = "gui")]
pub use canvas::theme::{CanvasTheme, DefaultCanvasTheme};

#[cfg(feature = "gui")]
pub use canvas::gui::{render_canvas, render_canvas_default};

#[cfg(feature = "gui")]
pub use canvas::gui::render_canvas_with_options;

#[cfg(feature = "gui")]
pub use canvas::gui::{CanvasDisplayOptions, OverflowMode};

#[cfg(all(feature = "gui", feature = "suggestions"))]
pub use suggestions::gui::render_suggestions_dropdown;


#[cfg(feature = "textarea")]
pub use textarea::{TextArea, TextAreaProvider, TextAreaState, TextAreaEditor};
