use async_trait::async_trait;
use thiserror::Error;
use crate::tools::store::ToolStore;
use super::{StoreFilter, StoreValue};
#[derive(Error, Debug)]
pub enum StoreError {
#[error("Store operation error: {0}")]
OperationError(String),
#[error("Vector index error: {0}")]
VectorIndexError(String),
#[error("Filter error: {0}")]
FilterError(String),
#[error("Embedding error: {0}")]
EmbeddingError(String),
}
#[async_trait]
pub trait EnhancedToolStore: ToolStore {
async fn get_with_metadata(&self, namespace: &[&str], key: &str) -> Option<StoreValue>;
async fn put_with_metadata(&self, namespace: &[&str], key: &str, value: StoreValue);
async fn search(
&self,
namespace: &[&str],
query: Option<&str>,
filter: Option<&StoreFilter>,
limit: usize,
) -> Result<Vec<StoreValue>, StoreError>;
async fn search_by_filter(
&self,
namespace: &[&str],
filter: &StoreFilter,
limit: usize,
) -> Result<Vec<StoreValue>, StoreError> {
self.search(namespace, None, Some(filter), limit).await
}
}