//! # edifact-mapper
//!
//! EDIFACT to BO4E bidirectional conversion for the German energy market.
//!
//! This crate provides a high-level [`Mapper`] API that loads precompiled
//! [`DataBundle`] files and exposes [`ConversionService`] and [`MappingEngine`]
//! instances for specific format versions, message variants, and PIDs.
//!
//! # Quick Start
//!
//! ```ignore
//! use edifact_mapper::{DataDir, Mapper};
//!
//! // Auto-detect data directory ($EDIFACT_DATA_DIR or ~/.edifact/data)
//! let mapper = Mapper::from_data_dir(DataDir::auto())?;
//!
//! // Or explicit path with eager loading
//! let mapper = Mapper::from_data_dir(
//!     DataDir::path("/opt/edifact/data").eager(&["FV2504"])
//! )?;
//!
//! // Get a conversion service for EDIFACT parsing + MIG assembly
//! let cs = mapper.conversion_service("FV2504", "UTILMD_Strom")?;
//!
//! // Get a mapping engine for a specific PID
//! let engine = mapper.engine("FV2504", "UTILMD_Strom", "55001")?;
//! ```
//!
//! # Mid-level Access
//!
//! For advanced use cases, key types from internal crates are re-exported:
//!
//! - [`ConversionService`] — tokenize EDIFACT input and assemble MIG trees
//! - [`MappingEngine`] — convert between MIG trees and BO4E JSON
//! - [`DataBundle`] / [`VariantCache`] — precompiled mapping data
//! - [`edifact_parser`] — standalone EDIFACT parser (no BO4E dependency)

mod conditional_validation;
pub mod data_dir;
pub mod error;
pub mod evaluator_factory;
pub mod mapper;
mod tree_to_segments;

pub use conditional_validation::validate_with_conditions;
pub use data_dir::DataDir;
pub use error::MapperError;
pub use mapper::{
    Bo4eResult, EdifactParty, InterchangeEnvelope, InterchangeMessage, Mapper, MessageMetadata,
};

// Re-export key types from internal crates for mid-level access.
pub use mig_assembly::assembler::AssembledTree;
pub use mig_assembly::ConversionService;
pub use mig_bo4e::engine::{DataBundle, VariantCache};
pub use mig_bo4e::MappingEngine;

// Re-export PID validation types.
pub use mig_bo4e::pid_validation::{PidValidationError, ValidationReport};

// Re-export reverse pipeline types for BO4E → EDIFACT conversion.
pub use edifact_primitives::EdifactDelimiters;
pub use mig_assembly::disassembler::Disassembler;
pub use mig_assembly::pid_filter::filter_mig_for_pid;
pub use mig_assembly::renderer::render_edifact;
pub use mig_bo4e::model::{MappedMessage, MappedTransaktion};

// Re-export the parser for standalone use.
pub use edifact_parser;
