1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: net.anisota.beta.game.inventory
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 representing an item in a player's game inventory
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 Inventory<'a> {
21 ///When the item was acquired
22 pub acquired_at: jacquard_common::types::string::Datetime,
23 ///When the record was created
24 pub created_at: jacquard_common::types::string::Datetime,
25 ///Unique identifier for the item from gameItems.json
26 #[serde(borrow)]
27 pub item_id: jacquard_common::CowStr<'a>,
28 ///Display name of the item
29 #[serde(skip_serializing_if = "std::option::Option::is_none")]
30 #[serde(borrow)]
31 pub item_name: std::option::Option<jacquard_common::CowStr<'a>>,
32 ///Type category of the item (consumable, tool, equipment, etc.)
33 #[serde(skip_serializing_if = "std::option::Option::is_none")]
34 #[serde(borrow)]
35 pub item_type: std::option::Option<jacquard_common::CowStr<'a>>,
36 ///Base value of the item in game currency
37 #[serde(skip_serializing_if = "std::option::Option::is_none")]
38 pub item_value: std::option::Option<i64>,
39 ///When the record was last modified
40 #[serde(skip_serializing_if = "std::option::Option::is_none")]
41 pub last_modified: std::option::Option<jacquard_common::types::string::Datetime>,
42 ///URI of the game.log record that documents the acquisition of this item
43 #[serde(skip_serializing_if = "std::option::Option::is_none")]
44 #[serde(borrow)]
45 pub log_record_uri: std::option::Option<jacquard_common::CowStr<'a>>,
46 ///Maximum stack size for this item
47 #[serde(skip_serializing_if = "std::option::Option::is_none")]
48 pub max_stack: std::option::Option<i64>,
49 ///Additional item-specific data (stats, attributes, enchantments, etc.)
50 #[serde(skip_serializing_if = "std::option::Option::is_none")]
51 #[serde(borrow)]
52 pub metadata: std::option::Option<jacquard_common::types::value::Data<'a>>,
53 ///Number of items in the stack
54 pub quantity: i64,
55 ///Rarity level of the item
56 #[serde(skip_serializing_if = "std::option::Option::is_none")]
57 #[serde(borrow)]
58 pub rarity: std::option::Option<jacquard_common::CowStr<'a>>,
59 ///How the item was acquired
60 #[serde(skip_serializing_if = "std::option::Option::is_none")]
61 #[serde(borrow)]
62 pub source: std::option::Option<jacquard_common::CowStr<'a>>,
63 #[serde(skip_serializing_if = "std::option::Option::is_none")]
64 #[serde(borrow)]
65 pub source_details: std::option::Option<
66 crate::net_anisota::beta::game::inventory::SourceDetails<'a>,
67 >,
68 ///Whether this item can be stacked with others of the same type
69 #[serde(skip_serializing_if = "std::option::Option::is_none")]
70 pub stackable: std::option::Option<bool>,
71}
72
73/// Typed wrapper for GetRecord response with this collection's record type.
74#[derive(
75 serde::Serialize,
76 serde::Deserialize,
77 Debug,
78 Clone,
79 PartialEq,
80 Eq,
81 jacquard_derive::IntoStatic
82)]
83#[serde(rename_all = "camelCase")]
84pub struct InventoryGetRecordOutput<'a> {
85 #[serde(skip_serializing_if = "std::option::Option::is_none")]
86 #[serde(borrow)]
87 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
88 #[serde(borrow)]
89 pub uri: jacquard_common::types::string::AtUri<'a>,
90 #[serde(borrow)]
91 pub value: Inventory<'a>,
92}
93
94/// Marker type for deserializing records from this collection.
95pub struct InventoryRecord;
96impl jacquard_common::xrpc::XrpcResp for InventoryRecord {
97 const NSID: &'static str = "net.anisota.beta.game.inventory";
98 const ENCODING: &'static str = "application/json";
99 type Output<'de> = InventoryGetRecordOutput<'de>;
100 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
101}
102
103impl jacquard_common::types::collection::Collection for Inventory<'_> {
104 const NSID: &'static str = "net.anisota.beta.game.inventory";
105 type Record = InventoryRecord;
106}
107
108impl From<InventoryGetRecordOutput<'_>> for Inventory<'_> {
109 fn from(output: InventoryGetRecordOutput<'_>) -> Self {
110 use jacquard_common::IntoStatic;
111 output.value.into_static()
112 }
113}
114
115///Additional details about how the item was acquired
116#[jacquard_derive::lexicon]
117#[derive(
118 serde::Serialize,
119 serde::Deserialize,
120 Debug,
121 Clone,
122 PartialEq,
123 Eq,
124 jacquard_derive::IntoStatic
125)]
126#[serde(rename_all = "camelCase")]
127pub struct SourceDetails<'a> {
128 ///URI of the game card that provided this item
129 #[serde(skip_serializing_if = "std::option::Option::is_none")]
130 #[serde(borrow)]
131 pub game_card_uri: std::option::Option<jacquard_common::CowStr<'a>>,
132 ///ID of the quest that rewarded this item
133 #[serde(skip_serializing_if = "std::option::Option::is_none")]
134 #[serde(borrow)]
135 pub quest_id: std::option::Option<jacquard_common::CowStr<'a>>,
136 ///Daily reward streak when item was acquired
137 #[serde(skip_serializing_if = "std::option::Option::is_none")]
138 pub reward_streak: std::option::Option<i64>,
139}