use std::collections::HashMap;
use std::time::SystemTime;
use revolt_result::Result;
use crate::{AppendMessage, FieldsMessage, Message, MessageQuery, PartialMessage};
#[cfg(feature = "mongodb")]
mod mongodb;
mod reference;
#[async_trait]
pub trait AbstractMessages: Sync + Send {
async fn insert_message(&self, message: &Message) -> Result<()>;
async fn fetch_message(&self, id: &str) -> Result<Message>;
async fn fetch_messages(&self, query: MessageQuery) -> Result<Vec<Message>>;
async fn fetch_messages_by_id(&self, ids: &[String]) -> Result<Vec<Message>>;
async fn update_message(&self, id: &str, message: &PartialMessage, remove: Vec<FieldsMessage>) -> Result<()>;
async fn append_message(&self, id: &str, append: &AppendMessage) -> Result<()>;
async fn add_reaction(&self, id: &str, emoji: &str, user: &str) -> Result<()>;
async fn remove_reaction(&self, id: &str, emoji: &str, user: &str) -> Result<()>;
async fn clear_reaction(&self, id: &str, emoji: &str) -> Result<()>;
async fn delete_message(&self, id: &str) -> Result<()>;
async fn delete_messages(&self, channel: &str, ids: &[String]) -> Result<()>;
async fn delete_messages_by_author_since(
&self,
channels: &[String],
author: &str,
since: SystemTime
) -> Result<HashMap<String, Vec<String>>>;
}