use crate::fact::{MemoFact, MemoryTier};

const ARCHIVE_THRESHOLD: f32 = 0.2;

/// Move facts below confidence threshold to DormantArchive tier.
pub fn archive_low_confidence(facts: &mut Vec<MemoFact>, archive: &mut Vec<MemoFact>) {
    let mut dormant = Vec::new();
    facts.retain(|f| {
        if f.confidence < ARCHIVE_THRESHOLD {
            dormant.push(f.clone());
            false
        } else {
            true
        }
    });
    for mut f in dormant {
        f.tier = MemoryTier::Dormant;
        archive.push(f);
    }
}
