use thiserror::Error;
#[derive(Debug, Error)]
pub enum BindingError {
#[error("base64 decode error: {0}")]
Base64Decode(#[from] base64::DecodeError),
#[error("DEFLATE decompression error: {0}")]
DeflateError(String),
#[error("URL decode error: {0}")]
UrlDecodeError(String),
#[error("missing SAML parameter: {0}")]
MissingSamlParam(&'static str),
#[error("duplicate SAML parameter: {0}")]
DuplicateSamlParam(&'static str),
#[error("invalid SAML parameters: {0}")]
InvalidSamlParams(String),
#[error("invalid artifact: {0}")]
InvalidArtifact(String),
#[error("artifact already consumed")]
ArtifactAlreadyConsumed,
#[error("artifact not found")]
ArtifactNotFound,
#[error("RelayState exceeds 80-byte limit (got {0} bytes)")]
RelayStateTooLong(usize),
#[error("RelayState failed sanitization: {0}")]
RelayStateUnsafe(String),
#[error("signature verification failed: {0}")]
SignatureVerificationFailed(String),
#[error("destination mismatch: expected {expected}, got {actual}")]
DestinationMismatch { expected: String, actual: String },
#[error("SOAP fault: {faultcode} - {faultstring}")]
SoapFault {
faultcode: String,
faultstring: String,
detail: Option<String>,
},
#[error("HTTP error: status {0}")]
HttpError(u16),
#[error("XML error: {0}")]
XmlError(#[from] crate::xml::error::XmlError),
#[error("crypto error: {0}")]
CryptoError(#[from] crate::crypto::CryptoError),
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[error("message too large: {0} bytes")]
MessageTooLarge(usize),
#[error("invalid SOAP envelope: {0}")]
InvalidSoapEnvelope(String),
}