use std::io::Error as IoError;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("CBOR encoding error: {0}")]
CborEncode(#[from] minicbor::encode::Error<IoError>),
#[error("CBOR encoding error: {0}")]
CborEncodeInfallible(#[from] minicbor::encode::Error<std::convert::Infallible>),
#[error("CBOR decode error: {0}")]
CborDecode(#[from] minicbor::decode::Error),
#[error("Invalid token format: {0}")]
InvalidFormat(String),
#[error("Invalid algorithm: {0}")]
InvalidAlgorithm(String),
#[error("Signature verification failed. The token's signature does not match the expected signature")]
SignatureVerification,
#[error("Missing required claim: {0}. The token does not contain a required claim")]
MissingClaim(String),
#[error("Token expired. The token's expiration time (exp) is in the past")]
Expired,
#[error("Token not yet valid. The token's not-before time (nbf) is in the future")]
NotYetValid,
#[error("Invalid issuer. The token's issuer (iss) does not match the expected issuer")]
InvalidIssuer,
#[error("Invalid audience. The token's audience (aud) does not match the expected audience")]
InvalidAudience,
#[error("Invalid claim value: {0}")]
InvalidClaimValue(String),
#[error("Invalid URI claim: {0}")]
InvalidUriClaim(String),
#[error("Invalid method claim: {0}")]
InvalidMethodClaim(String),
#[error("Invalid renewal claim: {0}")]
InvalidRenewalClaim(String),
#[error("Token replay violation: {0}")]
ReplayViolation(String),
#[error("Other error: {0}")]
Other(String),
}