use second_brain_core::{
    kuzu_store::KuzuStore,
    schema::{Memory, MemoryType},
    store::Store,
};

#[test]
fn delete_plants_tombstone() {
    let store = KuzuStore::in_memory("test-machine".to_string()).unwrap();
    let memory = Memory::new(
        "tombstone test memory".to_string(),
        MemoryType::Semantic,
        "test".to_string(),
        String::new(),
    );
    let id = memory.id;
    store.store_memory(&memory).unwrap();

    store.delete_memory(id).unwrap();

    assert!(
        store.tombstone_exists(id).unwrap(),
        "tombstone must exist after delete"
    );
    assert!(
        store.get_memory(id).unwrap().is_none(),
        "memory must not be retrievable after delete"
    );
}

#[test]
fn live_memory_has_no_tombstone() {
    let store = KuzuStore::in_memory("test-machine".to_string()).unwrap();
    let memory = Memory::new(
        "live memory".to_string(),
        MemoryType::Semantic,
        "test".to_string(),
        String::new(),
    );
    let id = memory.id;
    store.store_memory(&memory).unwrap();

    assert!(
        !store.tombstone_exists(id).unwrap(),
        "live memory must not have a tombstone"
    );
}
