use thiserror::Error;
#[derive(Debug, Error)]
pub enum ClientError {
#[error("connection not open")]
NotConnected,
#[error("already connected")]
AlreadyConnected,
#[error("WebSocket error: {0}")]
WebSocket(#[from] tokio_tungstenite::tungstenite::Error),
#[error("rifts protocol error: {0}")]
Protocol(#[from] crate::error::RiftError),
#[error("handshake failed: {0}")]
Handshake(String),
#[error("heartbeat timeout — {0} consecutive pongs missed")]
HeartbeatTimeout(u32),
#[error("max reconnect attempts ({0}) exceeded")]
MaxReconnect(u32),
#[error("command timed out after {0}ms")]
CommandTimeout(u64),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, ClientError>;