use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
#[serde(from = "i64", into = "i64")]
pub enum RevocationReason {
RefundedDueToIssue,
RefundedForOtherReason,
NotSupported(i64),
}
impl From<i64> for RevocationReason {
fn from(value: i64) -> Self {
match value {
1 => RevocationReason::RefundedDueToIssue,
0 => RevocationReason::RefundedForOtherReason,
other => RevocationReason::NotSupported(other),
}
}
}
impl From<RevocationReason> for i64 {
fn from(value: RevocationReason) -> Self {
match value {
RevocationReason::RefundedDueToIssue => 1,
RevocationReason::RefundedForOtherReason => 0,
RevocationReason::NotSupported(other) => other,
}
}
}