//! Error types for API Gateway configuration management

use thiserror::Error;

/// Configuration management errors
#[derive(Debug, Error)]
pub enum GatewayConfigError {
    #[error("Database error: {0}")]
    Database(#[from] sqlx::Error),

    #[error("Redis error: {0}")]
    Redis(#[from] redis::RedisError),

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

    #[error("Configuration not found: {service_scope}/{key}")]
    NotFound { service_scope: String, key: String },

    #[error("Serialization error: {0}")]
    Serialization(#[from] serde_json::Error),

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

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

/// Result type for configuration operations
pub type GatewayConfigResult<T> = Result<T, GatewayConfigError>;
