use async_trait::async_trait;
use modkit_db::secure::DBRunner;
use modkit_macros::domain_model;
use modkit_security::AccessScope;
use uuid::Uuid;
use crate::domain::error::DomainError;
use crate::infra::db::entity::chat_vector_store::Model as VectorStoreModel;
#[domain_model]
pub struct InsertVectorStoreParams {
pub id: Uuid,
pub tenant_id: Uuid,
pub chat_id: Uuid,
pub provider: String,
}
#[async_trait]
pub trait VectorStoreRepository: Send + Sync {
async fn insert<C: DBRunner>(
&self,
runner: &C,
scope: &AccessScope,
params: InsertVectorStoreParams,
) -> Result<VectorStoreModel, DomainError>;
async fn cas_set_vector_store_id<C: DBRunner>(
&self,
runner: &C,
scope: &AccessScope,
id: Uuid,
vector_store_id: &str,
) -> Result<u64, DomainError>;
async fn find_by_chat<C: DBRunner>(
&self,
runner: &C,
scope: &AccessScope,
chat_id: Uuid,
) -> Result<Option<VectorStoreModel>, DomainError>;
async fn delete<C: DBRunner>(
&self,
runner: &C,
scope: &AccessScope,
id: Uuid,
) -> Result<u64, DomainError>;
async fn find_by_chat_system<C: DBRunner>(
&self,
runner: &C,
chat_id: Uuid,
) -> Result<Option<VectorStoreModel>, DomainError>;
async fn delete_system<C: DBRunner>(&self, runner: &C, id: Uuid) -> Result<u64, DomainError>;
}