//! Client event system — real-time notifications from the SDK.

/// Events emitted by the SDK to the UI layer.
#[derive(Debug, Clone)]
pub enum ClientEvent {
    /// Successfully connected to the server.
    Connected,

    /// Disconnected from the server.
    Disconnected { reason: String },

    /// Registration succeeded.
    Registered { username: String },

    /// Login succeeded.
    LoggedIn { username: String },

    /// Logged out.
    LoggedOut { username: String },

    /// Authentication succeeded.
    Authenticated { username: String },

    /// A new message was received in a conversation.
    MessageReceived {
        conversation_id: [u8; 16],
        sender_key: Vec<u8>,
        sender_name: Option<String>,
        body: String,
        timestamp_ms: u64,
    },

    /// A message was sent successfully.
    MessageSent {
        conversation_id: [u8; 16],
        seq: u64,
    },

    /// A new conversation was created or discovered.
    ConversationCreated {
        conversation_id: [u8; 16],
        display_name: String,
    },

    /// A member was added to a group conversation.
    MemberAdded {
        conversation_id: [u8; 16],
        member_key: Vec<u8>,
    },

    /// A member was removed from a group conversation.
    MemberRemoved {
        conversation_id: [u8; 16],
        member_key: Vec<u8>,
    },

    /// Server-push event received.
    PushEvent {
        event_type: u16,
        payload: Vec<u8>,
    },

    /// An error occurred in the background.
    Error { message: String },
}
