use std::io;
use http::uri::InvalidUri;
use crate::{model::StatusCode, parser::IppParseError};
#[allow(clippy::large_enum_variant)]
#[derive(Debug, thiserror::Error)]
pub enum IppError {
#[error(transparent)]
HttpError(#[from] http::Error),
#[error(transparent)]
#[cfg(feature = "async-client")]
AsyncClientError(#[from] reqwest::Error),
#[error("HTTP request error: {0}")]
RequestError(u16),
#[error(transparent)]
IoError(#[from] io::Error),
#[error("IPP status error: {0}")]
StatusError(StatusCode),
#[error("Printer not ready")]
PrinterNotReady,
#[error(transparent)]
ParseError(#[from] IppParseError),
#[error("Missing attribute in response")]
MissingAttribute,
#[error("Invalid attribute type")]
InvalidAttributeType,
#[error(transparent)]
InvalidUri(#[from] InvalidUri),
#[error(transparent)]
#[cfg(feature = "client")]
ClientError(#[from] ureq::Error),
#[error(transparent)]
#[cfg(any(feature = "async-client-tls", feature = "client-tls"))]
TlsError(#[from] native_tls::Error),
}