1use std::collections::HashMap;
2
3#[cfg(feature = "python")]
4use pyo3::{pyclass, pymethods};
5#[cfg(feature = "python")]
6use skyblock_repo_macros::PyStr;
7use serde::{Deserialize, Serialize};
8use serde_json::Value;
9
10use crate::models::recipe::SkyblockRecipe;
11
12#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
13#[serde(rename_all = "camelCase")]
14#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
15pub struct SkyblockItem {
16 #[serde(default)]
17 pub internal_id: String,
18 pub name: Option<String>,
19 pub category: Option<String>,
20 pub source: Option<String>,
21 pub npc_value: Option<f64>,
22 pub lore: Option<String>,
23 pub flags: Option<ItemFlags>,
24 pub data: Option<ItemResponse>,
26 pub template_data: Option<ItemTemplate>,
27 #[serde(default)]
28 pub recipes: Vec<SkyblockRecipe>,
29}
30
31#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone)]
32#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
33pub struct ItemFlags {
34 pub tradable: bool,
35 pub bazaarable: bool,
36 pub auctionable: bool,
37 pub reforgeable: bool,
38 pub enchantable: bool,
39 pub museumable: bool,
40 pub soulboundable: bool,
41 pub sackable: bool,
42}
43
44#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
45#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
46pub struct ItemResponse {
47 pub id: Option<String>,
48 pub material: Option<String>,
49 pub color: Option<String>,
51 pub durability: Option<i32>,
52 pub skin: Option<ItemSkin>,
53 pub name: Option<String>,
54 pub category: Option<String>,
55 pub tier: Option<String>,
56 #[serde(default)]
57 pub unstackable: bool,
58 #[serde(default)]
59 pub glowing: bool,
60 pub npc_sell_price: Option<f64>,
61 #[serde(default)]
62 pub can_auction: bool,
63 #[serde(default)]
64 pub can_trade: bool,
65 #[serde(default)]
66 pub can_place: bool,
67 #[serde(default)]
68 pub gemstone_slots: Vec<ItemGemstoneSlot>,
69 #[serde(default)]
70 pub requirements: Vec<ItemRequirement>,
71 #[serde(default)]
72 pub museum: bool,
73 pub museum_data: Option<ItemMuseumData>,
74 pub stats: Option<std::collections::HashMap<String, f64>>,
75 pub generator_tier: Option<i32>,
76 pub dungeon_item_conversion_cost: Option<DungeonItemConversionCost>,
77 #[serde(default)]
78 pub upgrade_costs: Vec<Vec<UpgradeCosts>>,
79 #[serde(default)]
80 pub catacombs_requirements: Vec<CatacombsRequirements>,
81 #[serde(default)]
82 pub hide_from_viewrecipe_command: bool,
83 #[serde(default)]
84 pub salvagable_from_recipe: bool,
85 pub item_specific: Option<Value>,
86}
87
88#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
89#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
90pub struct ItemSkin {
91 pub value: Option<String>,
92 pub signature: Option<String>,
93}
94
95#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
96#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
97pub struct ItemGemstoneSlot {
98 pub slot_type: Option<String>,
99 #[serde(default)]
100 pub costs: Vec<ItemGemstoneSlotCosts>,
101}
102
103#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
104#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
105pub struct ItemGemstoneSlotCosts {
106 pub r#type: ItemGemstoneSlotCostsType,
107 pub item_id: Option<String>,
108 pub coins: Option<i32>,
109}
110
111#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
112#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
113#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
114pub enum ItemGemstoneSlotCostsType {
115 Coins,
116 Item,
117}
118
119#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
120#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
121pub struct ItemRequirement {
122 pub r#type: String,
123 pub skill: Option<String>,
124 pub level: Option<i32>,
125}
126
127#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
128#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
129pub struct ItemMuseumData {
130 pub donation_xp: i32,
131 #[serde(default)]
132 pub parent: HashMap<String, String>,
133 pub r#type: Option<String>,
134 pub armor_set_donation_xp: Option<HashMap<String, i32>>,
135 pub game_stage: Option<String>,
136}
137
138#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
139#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
140pub struct DungeonItemConversionCost {
141 pub essence_type: Option<String>,
142 pub amount: Option<i32>,
143}
144
145#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
146#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
147pub struct UpgradeCosts {
148 pub r#type: Option<String>,
149 pub essence_type: Option<String>,
150 pub item_id: Option<String>,
151 pub amount: Option<i32>,
152}
153
154#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
155#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
156pub struct CatacombsRequirements {
157 pub r#type: Option<String>,
158 pub dungeon_type: Option<String>,
159 pub level: Option<i32>,
160}
161
162#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
163#[cfg_attr(feature = "python", pyclass, derive(PyStr))]
164pub struct ItemTemplate {
165 pub name: Option<String>,
166 pub tradable: Option<String>,
167 pub auctionable: Option<String>,
168 pub bazaarable: Option<String>,
169 pub enchantable: Option<String>,
170 pub museumable: Option<String>,
171 pub reforgeable: Option<String>,
172 pub soulboundable: Option<String>,
173 pub sackable: Option<String>,
174 pub category: Option<String>,
175 pub lore: Option<String>,
176}