use tokio::sync::oneshot; use uuid::Uuid; use kordophone_db::models::{Conversation, Message}; use crate::daemon::settings::Settings; pub type Reply = oneshot::Sender; #[derive(Debug)] pub enum Event { /// Get the version of the daemon. GetVersion(Reply), /// Asynchronous event for syncing the conversation list with the server. SyncConversationList(Reply<()>), /// Asynchronous event for syncing all conversations with the server. SyncAllConversations(Reply<()>), /// Asynchronous event for syncing a single conversation with the server. SyncConversation(String, Reply<()>), /// Returns all known conversations from the database. /// Parameters: /// - limit: The maximum number of conversations to return. (-1 for no limit) /// - offset: The offset into the conversation list to start returning conversations from. GetAllConversations(i32, i32, Reply>), /// Returns all known settings from the database. GetAllSettings(Reply), /// Update settings in the database. UpdateSettings(Settings, Reply<()>), /// Returns all messages for a conversation from the database. /// Parameters: /// - conversation_id: The ID of the conversation to get messages for. /// - last_message_id: (optional) The ID of the last message to get. If None, all messages are returned. GetMessages(String, Option, Reply>), /// Enqueues a message to be sent to the server. /// Parameters: /// - conversation_id: The ID of the conversation to send the message to. /// - text: The text of the message to send. /// - reply: The outgoing message ID (not the server-assigned message ID). SendMessage(String, String, Reply), /// Delete all conversations from the database. DeleteAllConversations(Reply<()>), }