//! Column family name constants for RocksDB.
//!
//! Each column family stores a specific type of data in the blockchain database.

/// Block headers column family.
pub const HEADERS: &str = "headers";

/// Block bodies (transactions) column family.
pub const BLOCKS: &str = "blocks";

/// Individual transactions column family.
pub const TRANSACTIONS: &str = "transactions";

/// UTXO set column family.
pub const UTXOS: &str = "utxos";

/// Block relations (parents/children) column family.
pub const RELATIONS: &str = "relations";

/// GHOSTDAG data column family.
pub const GHOSTDAG: &str = "ghostdag";

/// Metadata (tips, pruning point, chain state) column family.
pub const METADATA: &str = "metadata";

/// Smart contracts bytecode column family.
pub const CONTRACTS: &str = "contracts";

/// Smart contract state column family.
pub const CONTRACT_STATE: &str = "contract_state";

/// Returns all column family names.
pub fn all() -> Vec<&'static str> {
    vec![
        HEADERS,
        BLOCKS,
        TRANSACTIONS,
        UTXOS,
        RELATIONS,
        GHOSTDAG,
        METADATA,
        CONTRACTS,
        CONTRACT_STATE,
    ]
}

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

    #[test]
    fn test_all_column_families_unique() {
        let cfs = all();
        let unique: std::collections::HashSet<_> = cfs.iter().collect();
        assert_eq!(cfs.len(), unique.len());
    }

    #[test]
    fn test_column_family_count() {
        assert_eq!(all().len(), 9);
    }
}
