1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: net.anisota.beta.game.pack
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8///Beta version: Record tracking daily pack openings and streak information
9#[jacquard_derive::lexicon]
10#[derive(
11 serde::Serialize,
12 serde::Deserialize,
13 Debug,
14 Clone,
15 PartialEq,
16 Eq,
17 jacquard_derive::IntoStatic
18)]
19#[serde(rename_all = "camelCase")]
20pub struct Pack<'a> {
21 ///When the record was created
22 pub created_at: jacquard_common::types::string::Datetime,
23 ///When the record was last modified
24 #[serde(skip_serializing_if = "std::option::Option::is_none")]
25 pub last_modified: std::option::Option<jacquard_common::types::string::Datetime>,
26 ///When daily pack was last opened
27 pub last_open_time: jacquard_common::types::string::Datetime,
28 ///Longest daily pack opening streak achieved
29 #[serde(skip_serializing_if = "std::option::Option::is_none")]
30 pub longest_streak: std::option::Option<i64>,
31 ///History of the last few pack openings
32 #[serde(skip_serializing_if = "std::option::Option::is_none")]
33 #[serde(borrow)]
34 pub pack_history: std::option::Option<
35 Vec<crate::net_anisota::beta::game::pack::PackHistoryEntry<'a>>,
36 >,
37 ///Current daily pack opening streak count
38 pub streak: i64,
39 ///Total number of times daily packs have been opened
40 pub total_opens: i64,
41}
42
43/// Typed wrapper for GetRecord response with this collection's record type.
44#[derive(
45 serde::Serialize,
46 serde::Deserialize,
47 Debug,
48 Clone,
49 PartialEq,
50 Eq,
51 jacquard_derive::IntoStatic
52)]
53#[serde(rename_all = "camelCase")]
54pub struct PackGetRecordOutput<'a> {
55 #[serde(skip_serializing_if = "std::option::Option::is_none")]
56 #[serde(borrow)]
57 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
58 #[serde(borrow)]
59 pub uri: jacquard_common::types::string::AtUri<'a>,
60 #[serde(borrow)]
61 pub value: Pack<'a>,
62}
63
64/// Marker type for deserializing records from this collection.
65pub struct PackRecord;
66impl jacquard_common::xrpc::XrpcResp for PackRecord {
67 const NSID: &'static str = "net.anisota.beta.game.pack";
68 const ENCODING: &'static str = "application/json";
69 type Output<'de> = PackGetRecordOutput<'de>;
70 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
71}
72
73impl jacquard_common::types::collection::Collection for Pack<'_> {
74 const NSID: &'static str = "net.anisota.beta.game.pack";
75 type Record = PackRecord;
76}
77
78impl From<PackGetRecordOutput<'_>> for Pack<'_> {
79 fn from(output: PackGetRecordOutput<'_>) -> Self {
80 use jacquard_common::IntoStatic;
81 output.value.into_static()
82 }
83}
84
85///A single pack opening entry in the history
86#[jacquard_derive::lexicon]
87#[derive(
88 serde::Serialize,
89 serde::Deserialize,
90 Debug,
91 Clone,
92 PartialEq,
93 Eq,
94 jacquard_derive::IntoStatic
95)]
96#[serde(rename_all = "camelCase")]
97pub struct PackHistoryEntry<'a> {
98 ///Items received from this pack
99 #[serde(skip_serializing_if = "std::option::Option::is_none")]
100 #[serde(borrow)]
101 pub items_received: std::option::Option<
102 Vec<crate::net_anisota::beta::game::pack::ReceivedItem<'a>>,
103 >,
104 ///When this pack was opened
105 #[serde(skip_serializing_if = "std::option::Option::is_none")]
106 pub open_time: std::option::Option<jacquard_common::types::string::Datetime>,
107 ///Streak count at time of opening
108 #[serde(skip_serializing_if = "std::option::Option::is_none")]
109 pub streak_count: std::option::Option<i64>,
110}
111
112///An item received from a pack opening
113#[jacquard_derive::lexicon]
114#[derive(
115 serde::Serialize,
116 serde::Deserialize,
117 Debug,
118 Clone,
119 PartialEq,
120 Eq,
121 jacquard_derive::IntoStatic
122)]
123#[serde(rename_all = "camelCase")]
124pub struct ReceivedItem<'a> {
125 ///ID of the item received
126 #[serde(skip_serializing_if = "std::option::Option::is_none")]
127 #[serde(borrow)]
128 pub item_id: std::option::Option<jacquard_common::CowStr<'a>>,
129 ///Quantity received
130 #[serde(skip_serializing_if = "std::option::Option::is_none")]
131 pub quantity: std::option::Option<i64>,
132 ///Rarity of the item
133 #[serde(skip_serializing_if = "std::option::Option::is_none")]
134 #[serde(borrow)]
135 pub rarity: std::option::Option<jacquard_common::CowStr<'a>>,
136}