//! Semantic module for AiFastDb
//!
//! Provides semantic deduplication and conflict detection capabilities.
//!
//! # Overview
//!
//! The semantic module enables intelligent pre-ingest checking to:
//! - Detect semantically similar content (deduplication)
//! - Identify logical conflicts between memories
//! - Provide actionable recommendations for handling duplicates/conflicts
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │                    TypeScript Layer                         │
//! │  - onDuplicate callback                                     │
//! │  - onConflict callback                                      │
//! │  - Decision logic (Gemma 3 integration)                     │
//! └─────────────────────────────────────────────────────────────┘
//!                              │
//!                              ▼
//! ┌─────────────────────────────────────────────────────────────┐
//! │                     Rust Core Layer                         │
//! │  ┌─────────────────┐  ┌─────────────────┐                   │
//! │  │ SemanticChecker │  │  HNSW Index     │                   │
//! │  │                 │◄─┤  (Vector Search)│                   │
//! │  │ - pre_ingest()  │  └─────────────────┘                   │
//! │  │ - quick_check() │                                        │
//! │  └────────┬────────┘                                        │
//! │           │                                                 │
//! │           ▼                                                 │
//! │  ┌─────────────────┐  ┌─────────────────┐                   │
//! │  │ Text Similarity │  │ Conflict Rules  │                   │
//! │  │ (Jaccard/Edit)  │  │ (Temporal/Logic)│                   │
//! │  └─────────────────┘  └─────────────────┘                   │
//! └─────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Usage
//!
//! ```rust,ignore
//! use aifastdb_core::semantic::{SemanticChecker, SemanticCheckerConfig, CheckResult};
//!
//! // Create a checker with custom config
//! let config = SemanticCheckerConfig::new()
//!     .with_similarity_threshold(0.85)
//!     .with_top_k(10);
//! let checker = SemanticChecker::with_config(config);
//!
//! // Perform pre-ingest check
//! let result = checker.pre_ingest_check(&new_node, &hnsw_index, &doc_store)?;
//!
//! match result {
//!     CheckResult::Safe => {
//!         // Proceed with insertion
//!     }
//!     CheckResult::DuplicateSuspect(candidates) => {
//!         // Handle duplicates (merge, skip, etc.)
//!     }
//!     CheckResult::ConflictSuspect(candidates) => {
//!         // Handle conflicts (deprecate old, keep both, etc.)
//!     }
//!     CheckResult::Mixed { duplicates, conflicts } => {
//!         // Handle both
//!     }
//! }
//! ```

pub mod types;
pub mod checker;
pub mod projector;

// Re-export main types
pub use types::{
    CheckResult,
    DuplicateCandidate,
    ConflictCandidate,
    DuplicateReason,
    ConflictType,
    DuplicateAction,
    ConflictAction,
    SemanticCheckerConfig,
    SemanticError,
};

pub use checker::SemanticChecker;

// Semantic Projector (BriLLM SiFu inspired)
pub use projector::{
    SemanticProjection,
    RandomProjector,
    PcaProjector,
    AnchorProjector,
    morton_code_3d,
    save_projector,
    load_projector,
    SEMANTIC_AXES_DIM,
};
