use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use crate::error::AiResult;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MemoryEntry {
    pub key: String,
    pub value: String,
    pub importance: i32,
    pub last_used_at: Option<String>,
}
#[async_trait]
pub trait MemoryProvider: Send + Sync {
    fn name(&self) -> &'static str;
    async fn save(
        &self,
        session_id: Uuid,
        key: &str,
        value: &str,
        importance: i32,
    ) -> AiResult<()>;
    async fn recall(
        &self,
        session_id: Uuid,
        query: &str,
        limit: usize,
    ) -> AiResult<Vec<MemoryEntry>>;
    async fn forget(&self, session_id: Uuid, key: &str) -> AiResult<()>;
    async fn prefetch(
        &self,
        _session_id: Uuid,
        _query: &str,
    ) -> AiResult<Vec<MemoryEntry>> {
        Ok(Vec::new())
    }
    async fn build_context_block(&self, _session_id: Uuid) -> AiResult<String> {
        Ok(String::new())
    }
    async fn setup(&self) -> AiResult<()> {
        Ok(())
    }
}
