use thiserror::Error;
#[derive(Error, Debug)]
pub enum WeChatError {
#[error("HTTP request failed: {0}")]
Http(String),
#[error("Reqwest error: {0}")]
Reqwest(#[from] reqwest::Error),
#[error("JSON serialization/deserialization failed: {0}")]
Json(#[from] serde_json::Error),
#[error("WeChat API error: {code} - {message}")]
Api { code: i32, message: String },
#[error("Invalid configuration: {0}")]
Config(String),
#[error("Authentication failed: {0}")]
Auth(String),
#[error("Signature verification failed")]
Signature,
#[error("Encryption/Decryption failed: {0}")]
Crypto(String),
#[error("Invalid parameter: {0}")]
InvalidParam(String),
#[error("Other error: {0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, WeChatError>;