//! # Temporal Fusion Transformer for Ultra-Low Latency Financial Forecasting
//!
//! Re-exports TFT components from the main TFT module for use in the transformers
//! module. This provides a bridge between the transformer architecture and the
//! specialized TFT implementation.
//!
//! ## Key Features
//!
//! - **Variable Selection Networks**: Automatic feature importance scoring
//! - **Gated Residual Networks**: Non-linear processing with skip connections
//! - **Multi-Head Attention**: Temporal pattern recognition
//! - **Quantile Prediction**: Risk-aware probabilistic forecasts
//! - **Static/Historical/Future Variables**: Multi-modal input processing
//! - **Ultra-Low Latency**: Optimized for HFT inference (<50μs)

// Re-export TFT components for use in transformers module
pub use crate::tft::{
    TFTConfig, TFTState, TFTMetadata, MultiHorizonPrediction,
    TemporalFusionTransformer, GatedResidualNetwork, GRNStack,
    VariableSelectionNetwork, TemporalSelfAttention, QuantileLayer
};

#[cfg(test)]
mod tests {
    use super::*;
    use anyhow::Result;

    #[test]
    fn test_tft_config_defaults() {
        let config = TFTConfig::default();
        assert_eq!(config.hidden_dim, 128);
        assert_eq!(config.num_heads, 8);
        assert_eq!(config.prediction_horizon, 10);
        assert_eq!(config.num_quantiles, 9);
    }

    #[test]
    fn test_tft_creation() -> Result<()> {
        let config = TFTConfig {
            input_dim: 10,
            hidden_dim: 32,
            num_heads: 4,
            num_quantiles: 5,
            prediction_horizon: 5,
            sequence_length: 20,
            num_static_features: 2,
            num_known_features: 3,
            num_unknown_features: 5,
            ..Default::default()
        };

        let tft = TemporalFusionTransformer::new(config)
            .map_err(|_| anyhow::anyhow!("Failed to create TFT"))?;
        assert_eq!(tft.metadata.input_dim, 10);
        assert_eq!(tft.metadata.output_dim, 5);
        Ok(())
    }

    #[test]
    fn test_tft_state_creation() -> Result<()> {
        let config = TFTConfig {
            hidden_dim: 32,
            sequence_length: 20,
            num_heads: 4,
            ..Default::default()
        };

        let state = TFTState::zeros(&config)
            .map_err(|_| anyhow::anyhow!("Failed to create state"))?;
        assert!(state.last_update == 0);
        Ok(())
    }
}