//! DYF Python Bindings - Density Yields Features
//!
//! Exposes Rust modules to Python via PyO3:
//! - DensityClassifier: PCA-based LSH density analysis
//! - Louvain: community detection on weighted graphs
//! - DyfFile: DYF2 file format read/write/append

use pyo3::prelude::*;

mod density_bindings;
mod louvain_bindings;
mod format_bindings;

#[cfg(feature = "gpu")]
mod gpu_bindings;

use density_bindings::{
    PyDensityClassifier, PyDensityReport, PyBridgeAnalysis, PyBridgePersistence,
    PyMultiResolutionAnalysis,
    PyBitDepthStats, py_analyze_bit_depths, py_select_optimal_bit_depth,
};
use louvain_bindings::{
    py_louvain_communities, py_louvain_from_centroids, py_build_knn_graph,
};
use format_bindings::PyDyfFile;

/// DYF - Density Yields Features using PCA-based LSH
#[pymodule]
fn _core(m: &Bound<'_, PyModule>) -> PyResult<()> {
    // Density classifier
    m.add_class::<PyDensityClassifier>()?;
    m.add_class::<PyDensityReport>()?;
    m.add_class::<PyBridgeAnalysis>()?;
    m.add_class::<PyBridgePersistence>()?;
    m.add_class::<PyMultiResolutionAnalysis>()?;
    m.add_class::<PyBitDepthStats>()?;
    m.add_function(wrap_pyfunction!(py_analyze_bit_depths, m)?)?;
    m.add_function(wrap_pyfunction!(py_select_optimal_bit_depth, m)?)?;

    // Louvain community detection
    m.add_function(wrap_pyfunction!(py_louvain_communities, m)?)?;
    m.add_function(wrap_pyfunction!(py_louvain_from_centroids, m)?)?;
    m.add_function(wrap_pyfunction!(py_build_knn_graph, m)?)?;

    // DYF2 file format
    m.add_class::<PyDyfFile>()?;

    // GPU compute (optional)
    #[cfg(feature = "gpu")]
    {
        use gpu_bindings::{PyGpuContext, PyGpuTreeRouter, py_gpu_power_iteration, py_gpu_hash_batch};
        m.add_class::<PyGpuContext>()?;
        m.add_class::<PyGpuTreeRouter>()?;
        m.add_function(wrap_pyfunction!(py_gpu_power_iteration, m)?)?;
        m.add_function(wrap_pyfunction!(py_gpu_hash_batch, m)?)?;
    }

    Ok(())
}
