use thiserror::Error;
pub type Result<T> = std::result::Result<T, FlightRadarError>;
#[derive(Debug, Error)]
pub enum FlightRadarError {
#[error("http client error: {0}")]
Http(#[from] reqwest::Error),
#[error("url parse error: {0}")]
UrlParse(#[from] url::ParseError),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("cloudflare blocked request (status {status}): {body}")]
Cloudflare { status: u16, body: String },
#[error("unexpected status {status}: {body}")]
UnexpectedStatus { status: u16, body: String },
#[error("invalid input: {0}")]
InvalidInput(&'static str),
#[error("invalid payload: {0}")]
InvalidPayload(String),
#[error("login failed: {message}")]
LoginError { message: String },
#[error("airport not found for code: {code}")]
AirportNotFound { code: String },
}