app_store_server_library/models/
status.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
7#[serde(from = "i64", into = "i64")]
8pub enum Status {
9 Active,
10 Expired,
11 BillingRetry,
12 BillingGracePeriod,
13 Revoked,
14
15 NotSupported(i64),
18}
19
20impl Status {
21 pub fn raw_value(&self) -> i64 {
22 i64::from(self.clone())
23 }
24}
25
26impl From<i64> for Status {
27 fn from(value: i64) -> Self {
28 match value {
29 1 => Status::Active,
30 2 => Status::Expired,
31 3 => Status::BillingRetry,
32 4 => Status::BillingGracePeriod,
33 5 => Status::Revoked,
34 other => Status::NotSupported(other),
35 }
36 }
37}
38
39impl From<Status> for i64 {
40 fn from(value: Status) -> Self {
41 match value {
42 Status::Active => 1,
43 Status::Expired => 2,
44 Status::BillingRetry => 3,
45 Status::BillingGracePeriod => 4,
46 Status::Revoked => 5,
47 Status::NotSupported(other) => other,
48 }
49 }
50}