//! AiFastDb Python Bindings
//!
//! This crate provides Python bindings for AiFastDb via PyO3.
//! The Python package is structured as:
//!
//! ```text
//! aifastdb/
//! ├── __init__.py       # Pure Python wrapper (re-exports from _native)
//! ├── __init__.pyi      # Type stubs for IDE autocomplete
//! └── _native/          # Compiled Rust extension module
//!     ├── database      # AiFastDb core database
//!     ├── social_graph  # SocialGraphV2 bindings
//!     ├── federation    # Federation bindings
//!     ├── types         # Shared types
//!     └── errors        # Exception types
//! ```

use pyo3::prelude::*;

mod errors;
mod types;
mod database;
mod social_graph;
mod federation;
mod perception;
mod concurrent;
mod sifu;
#[cfg(feature = "llm-gateway")]
mod llm;

/// AiFastDb Python extension module.
///
/// This is the native Rust extension loaded as `aifastdb._native`.
/// Public Python API is re-exported from `aifastdb.__init__`.
#[pymodule]
fn _native(m: &Bound<'_, PyModule>) -> PyResult<()> {
    // Register version
    m.add("__version__", env!("CARGO_PKG_VERSION"))?;

    // Register exception types
    errors::register_exceptions(m)?;

    // Register shared types
    types::register_types(m)?;

    // Register database classes (AiFastDb, Collection)
    database::register_database(m)?;

    // Register SocialGraphV2 class (phase-25)
    social_graph::register_social_graph(m)?;

    // Register Federation & DocumentStore classes (phase-27)
    federation::register_federation(m)?;

    // Register Perception / Embedding / Reasoning classes (phase-28)
    perception::register_perception(m)?;

    // Register ConcurrentDocumentStore & VectorIndex (phase-30)
    concurrent::register_concurrent(m)?;

    // Register SiFu signal propagation engine (phase-51)
    sifu::register_sifu(m)?;

    // Register LLM Gateway (phase-81, conditional)
    #[cfg(feature = "llm-gateway")]
    llm::register_llm(m)?;

    Ok(())
}
