//! Feature Engineering for Foxhunt ML models
//!
//! Core feature extractors: technical indicators, price patterns, volume analysis,
//! microstructure proxies, OFI (Order Flow Imbalance), normalization, and more.

#![allow(clippy::module_name_repetitions)]
#![allow(clippy::integer_division)]
#![deny(
    clippy::unwrap_used,
    clippy::expect_used,
    clippy::panic
)]
#![allow(clippy::shadow_reuse, clippy::shadow_same, clippy::shadow_unrelated)] // Tensor ops: let x = x.relu() is idiomatic
#![allow(clippy::non_ascii_literal)] // Math symbols in ML documentation and error messages
#![allow(clippy::partial_pub_fields)] // ML config structs: some fields are pub API, some internal
#![allow(clippy::same_name_method)] // Intentional: inherent methods shadow trait defaults for ML-specific behavior
#![allow(clippy::indexing_slicing)] // Tensor/matrix indexing with bounds guaranteed by construction
#![allow(clippy::similar_names)] // ML naming: min_val/max_val, state/states are conventional

// Re-export core types at crate root for internal use
pub use ml_core::MLError;
pub use ml_core::types::OHLCVBar;

// Public modules (21 total)
pub mod adx_features;
pub mod alternative_bars;
pub mod bar_resampler;
pub mod barrier_optimization;
pub mod bouchaud_features;
pub mod config;
pub mod ewma;
pub mod feature_extraction;
pub mod frac_diff_adapter;
pub mod hawkes_mle;
pub mod lob_pca;
pub mod mbp10_loader;
pub mod microprice;
pub mod microstructure;
pub mod microstructure_features;
pub mod pin_estimator;
pub mod normalization;
pub mod ofi_calculator;
pub mod order_events;
pub mod pipeline;
pub mod position_features;
pub mod predecoded;
pub mod price_features;
pub mod regime_adx;
pub mod return_moments;
pub mod seasonality_events;
pub mod spread_decomposition;
pub mod statistical_features;
pub mod trend_scanning;
pub mod time_features;
pub mod trades_loader;
pub mod types;
pub mod alpha_pipeline;
pub mod snapshot_pipeline;
pub mod volume_features;

// Re-exports
pub use config::{FeatureConfig, FeatureGroup, FeatureIndices, FeaturePhase};
pub use alternative_bars::{
    DollarBarSampler, ImbalanceBarSampler, RunBarSampler, TickBarSampler, VolumeBarSampler,
};
pub use barrier_optimization::{BarrierOptimizer, BarrierParams, OptimizationResult};
pub use ewma::{AdaptiveThreshold, EWMACalculator};
pub use price_features::PriceFeatureExtractor;
pub use volume_features::VolumeFeatureExtractor;
pub use adx_features::AdxFeatureExtractor;
pub use regime_adx::RegimeADXFeatures;
pub use microstructure_features::{
    BuySellImbalance, HighLowSpread, InterArrivalTime, KyleLambda, MicrostructureFeature,
    MultiLevelKyleLambda, PriceImpact, TickCount, VarianceRatio, VolumeWeightedSpread,
};
pub use frac_diff_adapter::FracDiffF64;
pub use return_moments::ReturnMoments;
pub use microprice::{
    cartea_adjusted_microprice, multilevel_microprice, stoikov_microprice, MicropriceFeatures,
};
pub use spread_decomposition::SpreadDecomposition;
pub use trend_scanning::TrendScanner;
pub use bouchaud_features::BouchaudFeatures;
pub use lob_pca::OnlineLobPca;
pub use seasonality_events::{
    event_stage_encoding, SeasonalityAndEventFeatures, SeasonalityResidual,
};
pub use hawkes_mle::{hawkes_log_likelihood, HawkesEstimator};
pub use pin_estimator::PinEstimator;
pub use order_events::{EventType, OrderEventCounters};
pub use alpha_pipeline::{extract_alpha_features, ALPHA_FEATURE_DIM};
pub use snapshot_pipeline::{extract_snapshot_features, SnapshotRow, SNAPSHOT_FEATURE_DIM};
pub use time_features::TimeFeatureExtractor;
pub use statistical_features::StatisticalFeatureExtractor;
pub use normalization::{FeatureNormalizer, NormalizationStats, RingBuffer};
pub use pipeline::{FeatureExtractionPipeline, PipelinePerformance};
pub use position_features::PositionFeatures;
pub use ofi_calculator::{
    compute_ofi_per_bar_parallel, compute_ofi_per_bar_sequential, OFICalculator, OFIFeatures,
    PerBarOfiInputs, DEFAULT_OFI_PARALLEL_WARMUP_BARS, PER_BAR_OFI_DIM,
};
pub use mbp10_loader::{
    extract_trades_from_dbn_file, extract_trades_from_snapshots, get_recent_snapshots,
    get_snapshots_for_timestamp, imbalance_bars_parallel, imbalance_bars_sequential,
    load_mbp10_snapshots_sync, mbp10_to_imbalance_bars, Mbp10Trade,
    DEFAULT_IMBALANCE_BAR_MIN_BARS_PER_TASK,
};
pub use trades_loader::{build_volume_bars, filter_front_month, get_trades_for_bar, load_trades_sync, DbnTrade, DEFAULT_VOLUME_BAR_SIZE};
pub use bar_resampler::BarResampler;
