//! Configuration for persistent vector index.

use crate::vector_index::HnswVectorIndex;
use std::path::PathBuf;

/// Configuration for persistent vector index.
#[derive(Debug, Clone)]
pub struct PersistentVectorIndexConfig {
    /// Directory to store index files.
    pub data_dir: PathBuf,

    /// Dimension of vectors in this index.
    pub dimension: usize,

    /// Hot window duration in seconds (default: 24h).
    /// Vectors older than this may be moved to cold storage.
    pub hot_window_secs: u64,

    /// Interval between checkpoint attempts in seconds (default: 1h).
    pub checkpoint_interval_secs: u64,

    /// Maximum number of neighbors to connect during HNSW construction.
    pub max_nb_connection: usize,

    /// Search width during HNSW construction.
    pub ef_construction: usize,
}

impl Default for PersistentVectorIndexConfig {
    fn default() -> Self {
        Self {
            data_dir: PathBuf::from("vector_index"),
            dimension: 128,
            hot_window_secs: 86400,         // 24 hours
            checkpoint_interval_secs: 3600, // 1 hour
            max_nb_connection: 16,
            ef_construction: HnswVectorIndex::DEFAULT_EF_CONSTRUCTION,
        }
    }
}
