use thiserror::Error;
#[derive(Debug, Error)]
pub enum ClobError {
#[error("HTTP request failed: {0}")]
HttpError(#[from] reqwest::Error),
#[error("JSON serialization/deserialization error: {0}")]
JsonError(#[from] serde_json::Error),
#[error("Invalid configuration: {0}")]
InvalidConfig(String),
#[error("Authentication error: {0}")]
AuthError(String),
#[error("Signing error: {0}")]
SigningError(String),
#[error("Invalid order parameters: {0}")]
InvalidOrder(String),
#[error("API error: {status} - {message}")]
ApiError { status: u16, message: String },
#[error("Order validation failed: {0}")]
ValidationError(String),
#[error("Missing API credentials. Call set_api_creds() first.")]
MissingCredentials,
#[error("Invalid private key: {0}")]
InvalidPrivateKey(String),
#[error("Chain ID {0} not supported")]
UnsupportedChain(u64),
#[error("Invalid address: {0}")]
InvalidAddress(String),
#[error("Price calculation error: {0}")]
PriceCalculationError(String),
#[error("Orderbook error: {0}")]
OrderbookError(String),
#[error("Hex encoding/decoding error: {0}")]
HexError(#[from] hex::FromHexError),
#[error("Base64 encoding/decoding error: {0}")]
Base64Error(#[from] base64::DecodeError),
}
pub type Result<T> = std::result::Result<T, ClobError>;