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