#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BridgeErrorKind {
    Validation,
    Unauthorized,
    Conflict,
    NotFound,
    Transport,
    Rejected,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BridgeError {
    pub kind: BridgeErrorKind,
    pub message: String,
}

impl BridgeError {
    pub fn validation(message: impl Into<String>) -> Self {
        Self {
            kind: BridgeErrorKind::Validation,
            message: message.into(),
        }
    }

    pub fn transport(message: impl Into<String>) -> Self {
        Self {
            kind: BridgeErrorKind::Transport,
            message: message.into(),
        }
    }

    pub fn unauthorized(message: impl Into<String>) -> Self {
        Self {
            kind: BridgeErrorKind::Unauthorized,
            message: message.into(),
        }
    }

    pub fn conflict(message: impl Into<String>) -> Self {
        Self {
            kind: BridgeErrorKind::Conflict,
            message: message.into(),
        }
    }

    pub fn not_found(message: impl Into<String>) -> Self {
        Self {
            kind: BridgeErrorKind::NotFound,
            message: message.into(),
        }
    }

    pub fn rejected(message: impl Into<String>) -> Self {
        Self {
            kind: BridgeErrorKind::Rejected,
            message: message.into(),
        }
    }
}

pub type BridgeResult<T> = Result<T, BridgeError>;
