use thiserror::Error;
#[derive(Debug, Error)]
pub enum WebullError {
#[error("Authentication error: {0}")]
AuthenticationError(String),
#[error("API error: {code} - {message}")]
ApiError {
code: String,
message: String
},
#[error("Rate limit exceeded")]
RateLimitExceeded,
#[error("Network error: {0}")]
NetworkError(#[from] reqwest::Error),
#[error("Invalid request: {0}")]
InvalidRequest(String),
#[error("Serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
#[error("MFA required")]
MfaRequired,
#[error("Unauthorized")]
Unauthorized,
#[error("Unknown error: {0}")]
Unknown(String),
}
pub type WebullResult<T> = Result<T, WebullError>;