use crate::engine::shared_error::SharedAuthError;
#[derive(Debug, Clone, thiserror::Error, PartialEq, Eq)]
pub enum AuthError {
#[error(transparent)]
Jose(#[from] SharedAuthError),
#[error("M17: exp claim missing")]
ExpMissing,
#[error("M18: token expired")]
Expired,
#[error("M19: exp exceeds upper bound")]
ExpUpperBound,
#[error("M20: aud claim missing")]
AudMissing,
#[error("M21/M22: aud value does not match expected audience")]
AudMismatch,
#[error("M23: iss missing or does not match pinned issuer")]
IssMismatch,
#[error("M24: iat claim missing")]
IatMissing,
#[error("M24/M25: iat is in the future beyond 60s leeway")]
IatFuture,
#[error("M26: nbf is in the future — token not yet valid")]
NotYetValid,
#[error("M27: jti claim missing")]
JtiMissing,
#[error("M28: sub claim missing")]
SubMissing,
#[error("M28a: client_id claim missing")]
ClientIdMissing,
#[error("M29: cat does not match expected token type")]
TokenTypeMismatch,
#[error("M30: numeric claim is not a JSON integer")]
InvalidNumericType,
#[error("M39: sub is not a valid ULID")]
SubFormatInvalid,
#[error("M40: account_type outside whitelist")]
AccountTypeInvalid,
#[error("M41: caps is not a JSON array of strings")]
CapsShapeInvalid,
#[error("M42: scopes is not a JSON array of strings")]
ScopesShapeInvalid,
#[error("M42: scopes exceeds 256-entry cap")]
ScopesTooLong,
#[error("M43: dlg_depth invalid (non-integer, negative, or > 4)")]
DlgDepthInvalid,
#[error("M44: admin claim requires active_ppnum in admin band")]
AdminBandRejected,
#[error("M45: unknown claim '{0}'")]
UnknownClaim(String),
#[error("M35: jti replayed within TTL")]
JtiReplayed,
#[error("M35: replay cache substrate unavailable")]
ReplayCacheUnavailable,
#[error("M36: session revoked (user_sessions row absent)")]
SessionRevoked,
#[error("M36: session lookup substrate unavailable")]
SessionLookupUnavailable,
#[error("session_version stale: token < current epoch")]
SessionVersionStale,
#[error("session_version lookup substrate unavailable")]
SessionVersionLookupUnavailable,
}