use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum DownloadError {
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("ZIP error: {0}")]
Zip(#[from] zip::result::ZipError),
#[error("unknown service code: {0}")]
UnknownService(String),
#[error("file not found: {url}")]
NotFound { url: String },
#[error("server error {status} for {url}")]
ServerError { status: u16, url: String },
#[error("incomplete download: expected {expected} bytes, got {actual}")]
IncompleteDownload { expected: u64, actual: u64 },
#[error("failed to create cache directory: {path}")]
CacheDirectoryError { path: PathBuf },
#[error("invalid configuration: {0}")]
InvalidConfig(String),
}
pub type Result<T> = std::result::Result<T, DownloadError>;