use async_trait::async_trait;
use crate::error::GradatumError;
use crate::identity::{ContentHash, NoteId};
use crate::index::NoteRecord;
use crate::note::Note;
use crate::scope::VaultId;
use crate::status::NoteStatus;
#[async_trait]
pub trait DocumentStore: Send + Sync {
async fn write_note(&self, note: &Note) -> Result<(), GradatumError>;
async fn get_content_hash(&self, id: NoteId) -> Result<Option<ContentHash>, GradatumError>;
async fn get_note(
&self,
tenant_id: &str,
note_id_ulid: &str,
) -> Result<Option<NoteRecord>, GradatumError>;
async fn list_by_status(
&self,
vault_id: &VaultId,
status: NoteStatus,
) -> Result<Vec<NoteId>, GradatumError>;
async fn downgrade_note(
&self,
note_id: &NoteId,
reason: &str,
replaced_by: Option<&NoteId>,
) -> Result<(), GradatumError>;
async fn patch_note_status(
&self,
note_id: &NoteId,
status: Option<&str>,
status_reason: Option<&str>,
replaced_by: Option<&NoteId>,
) -> Result<(), GradatumError>;
async fn upsert_note_title(&self, note_id: &NoteId, title: &str) -> Result<(), GradatumError>;
async fn mark_forgotten(
&self,
vault_id: &str,
note_id: &str,
by: Option<&str>,
) -> Result<(), GradatumError>;
async fn unmark_forgotten(&self, vault_id: &str, note_id: &str) -> Result<(), GradatumError>;
async fn list_forgotten(
&self,
vault_id: &str,
limit: usize,
cursor: Option<&str>,
) -> Result<Vec<(String, Option<String>, String, i64, Option<String>)>, GradatumError>;
async fn count_forgotten(&self, vault_id: &str) -> Result<usize, GradatumError>;
}