use std::time::Duration;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid request: {0}")]
Validation(String),
#[error("http error: {0}")]
Http(#[from] reqwest::Error),
#[error("unexpected HTTP status {status} from {method}")]
Status { method: &'static str, status: u16 },
#[error("cannot create task: [{code}] {description}")]
CreateTask { code: String, description: String },
#[error("cannot get task result: [{code}] {description}")]
GetResult { code: String, description: String },
#[error("cannot get balance: [{code}] {description}")]
GetBalance { code: String, description: String },
#[error("malformed API response: {0}")]
MalformedResponse(String),
#[error("failed to get a solution within {0:?}")]
Timeout(Duration),
#[error("unsupported client proxy type: {0}")]
UnsupportedProxyType(String),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
}