use async_trait::async_trait;
use flowy_error::FlowyResult;
pub use langchain_rust::schemas::Document as LangchainDocument;
use std::error::Error;
use uuid::Uuid;

pub mod multi_source_retriever;
pub mod sqlite_retriever;

#[async_trait]
pub trait AFRetriever: Send + Sync + 'static {
  fn get_rag_ids(&self) -> Vec<&str>;
  fn set_rag_ids(&mut self, new_rag_ids: Vec<String>);

  async fn retrieve_documents(&self, query: &str)
  -> Result<Vec<LangchainDocument>, Box<dyn Error>>;
}

#[async_trait]
pub trait MultipleSourceRetrieverStore: Send + Sync {
  fn retriever_name(&self) -> &'static str;
  async fn read_documents(
    &self,
    workspace_id: &Uuid,
    query: &str,
    limit: usize,
    rag_ids: &[String],
    score_threshold: f32,
    full_search: bool,
  ) -> FlowyResult<Vec<LangchainDocument>>;
}
