//! Error types

use thiserror::Error;

/// FiberLB error type
#[derive(Debug, Error)]
pub enum Error {
    /// Resource not found
    #[error("resource not found: {0}")]
    NotFound(String),

    /// Resource already exists
    #[error("resource already exists: {0}")]
    AlreadyExists(String),

    /// Invalid configuration
    #[error("invalid configuration: {0}")]
    InvalidConfig(String),

    /// Backend unavailable
    #[error("backend unavailable: {0}")]
    BackendUnavailable(String),

    /// Health check failed
    #[error("health check failed: {0}")]
    HealthCheckFailed(String),

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

    /// Permission denied
    #[error("permission denied: {0}")]
    PermissionDenied(String),

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

/// Result type with FiberLB error
pub type Result<T> = std::result::Result<T, Error>;
