use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("transport: {0}")]
    Transport(#[from] reqwest::Error),

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

    #[error("api error {code}: {message}")]
    Api {
        code: i64,
        message: String,
        data: Option<serde_json::Value>,
    },

    #[error("invalid response: {0}")]
    Invalid(String),
}
