//! Client error types

use thiserror::Error;

/// Result type for client operations
pub type Result<T> = std::result::Result<T, ClientError>;

/// Client error
#[derive(Error, Debug)]
pub enum ClientError {
    /// Connection error
    #[error("Connection error: {0}")]
    Connection(String),

    /// RPC error
    #[error("RPC error: {0}")]
    Rpc(#[from] tonic::Status),

    /// Transport error
    #[error("Transport error: {0}")]
    Transport(#[from] tonic::transport::Error),

    /// Key not found
    #[error("Key not found: {0}")]
    KeyNotFound(String),

    /// Watch error
    #[error("Watch error: {0}")]
    Watch(String),

    /// Internal error
    #[error("Internal error: {0}")]
    Internal(String),

    /// Compare-and-set conflict
    #[error("Conflict: {0}")]
    Conflict(String),
}
