use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("transport error: {0}")]
    Transport(#[from] reqwest::Error),
    #[error("billing api {status}: {code}")]
    Api {
        status: u16,
        code: String,
        body: Option<serde_json::Value>,
    },
    #[error("billing api throttled; retry after {retry_after:?}s")]
    Throttled { retry_after: Option<u64> },
    #[error("decode response: {0}")]
    Decode(#[from] serde_json::Error),
}
