1#[cfg(feature = "serde")]
2use serde::{Deserialize, Serialize};
3use strum_macros::{AsRefStr, Display, EnumIter, EnumString, IntoStaticStr};
4use crate::lcu::chat::LoL;
5use crate::lcu::consts::QueueId;
6
7#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8#[derive(
9EnumString,
10EnumIter,
11Display,
12AsRefStr,
13IntoStaticStr,
14Debug,
15Copy,
16Clone,
17Ord,
18PartialOrd,
19Eq,
20PartialEq,
21)]
22pub enum EventType {
23 Create,
24 Update,
25 Delete,
26 #[cfg_attr(feature = "serde", serde(other))]
27 Other,
28}
29
30#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
31#[derive(
32EnumString,
33EnumIter,
34Display,
35AsRefStr,
36IntoStaticStr,
37Debug,
38Copy,
39Clone,
40Ord,
41PartialOrd,
42Eq,
43PartialEq,
44)]
45pub enum SearchState {
46 Searching,
47 Canceled,
48 #[serde(rename(deserialize = "Found", serialize = "Found"))]
49 Found,
50 #[cfg_attr(feature = "serde", serde(other))]
51 Other,
52}
53
54#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
55#[derive(
56EnumString,
57EnumIter,
58Display,
59AsRefStr,
60IntoStaticStr,
61Debug,
62Copy,
63Clone,
64Ord,
65PartialOrd,
66Eq,
67PartialEq,
68)]
69pub enum GameFlowPhase {
70 Lobby,
71 Matchmaking,
72 ReadyCheck,
73 ChampSelect,
74 GameStart,
75 InProgress,
76 PreEndOfGame,
77 EndOfGame,
78 WaitingForStats,
79 TerminatedInError,
80 None,
81}
82
83#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
84#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
85#[derive(
86EnumString,
87EnumIter,
88Display,
89AsRefStr,
90IntoStaticStr,
91Debug,
92Copy,
93Clone,
94Ord,
95PartialOrd,
96Eq,
97PartialEq,
98)]
99pub enum Availability {
100 Chat,
101 Away,
102 Dnd,
103 Offline,
104}
105
106pub type LobbyEvent = super::lcu::lobby::Lobby;
107pub type FriendEvent = super::lcu::chat::Friend;
108
109#[derive(Debug, Clone)]
110#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
111#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
112pub enum LeagueEventKind {
113 Queue(Option<QueueEvent>),
114 Lobby(Option<LobbyEvent>),
115 Friend(Option<FriendEvent>),
116 GameFlow(Option<GameFlowEvent>),
117 ChampSelect
119}
120
121#[derive(Debug, Default, Clone)]
122#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
123#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
124pub struct LeagueEvent {
125 pub kind: Option<LeagueEventKind>,
126 pub event_type: Option<EventType>,
127 pub uri: Option<String>,
128}
129
130#[derive(Debug, Default, Clone)]
131#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
132#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
133pub struct GameFlowEvent {
134 #[serde(skip)]
135 pub game_client: Option<GameClientData>,
136 pub game_data: Option<GameData>,
137 pub game_dodge: Option<DodgeData>,
138 pub map: Option<GameFlowMapData>,
139 pub phase: Option<GameFlowPhase>,
140}
141
142#[derive(Debug, Default, Clone)]
143#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
144#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
145pub struct GameFlowMapData {
146 #[serde(skip)]
147 pub categorized_content_bundles: Option<ContentBundles>,
148 pub description: Option<String>,
149 pub game_mode: Option<String>,
150 pub game_mode_name: Option<String>,
151 pub game_mode_short_name: Option<String>,
152 pub game_mutator: Option<String>,
153 pub id: Option<i32>,
154 #[serde(rename = "isRGM")]
155 pub is_rgm: Option<bool>,
156 pub map_string_id: Option<String>,
157 pub platform_id: Option<String>,
158 pub platform_name: Option<String>,
159 #[serde(skip)]
160 pub properties: Option<GameFlowProperties>,
161 pub suppress_runes_masteries_perks: Option<bool>,
162}
163#[derive(Debug, Default, Clone)]
164#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
165#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
166pub struct GameData {
167 pub game_id: Option<i64>,
168 pub game_name: Option<String>,
169 pub is_custom_game: Option<bool>,
170 pub password: Option<String>,
171 #[serde(skip)]
172 pub player_champion_selections: Option<PlayerChampionSelections>,
173 pub queue: Option<QueueData>,
174 pub spectators_allowed: Option<bool>,
175}
176
177#[derive(Debug, Default, Clone)]
178#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
179#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
180pub struct QueueData {
181 pub allowable_premade_sizes: Option<Vec<i32>>,
182 pub are_free_champions_allowed: Option<bool>,
183 pub asset_mutator: Option<String>,
184 pub category: Option<String>,
185 pub champions_required_to_play: Option<i32>,
186 pub description: Option<String>,
187 pub game_mode: Option<String>,
188 #[serde(skip)]
189 pub game_type_config: Option<GameTypeConfig>,
190 pub id: Option<i64>,
191 pub is_ranked: Option<bool>,
192 pub is_team_builder_managed: Option<bool>,
193 pub is_team_only: Option<bool>,
194 pub last_toggled_off_time: Option<i64>,
195 pub last_toggled_on_time: Option<i64>,
196 pub map_id: Option<i64>,
197 pub max_level: Option<i64>,
198 pub max_summoner_level_for_first_win_of_the_day: Option<i64>,
199 pub maximum_participant_list_size: Option<i32>,
200 pub min_level: Option<i64>,
201 pub minimum_participant_list_size: Option<i32>,
202 pub name: Option<String>,
203 pub num_players_per_team: Option<i64>,
204 pub queue_availability: Option<String>,
205 #[serde(skip)]
206 pub queue_rewards: Option<QueueRewards>,
207 pub removal_from_game_allowed: Option<bool>,
208 pub removal_from_game_delay_minutes: Option<i64>,
209 pub short_name: Option<String>,
210 pub show_position_selector: Option<bool>,
211 pub spectator_enabled: Option<bool>,
212 #[serde(rename = "type")]
213 pub queue_type: Option<String>
214}
215
216
217
218#[derive(Debug, Default, Clone)]
219#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
220#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
221pub struct GameClientData {
222
223}
224
225#[derive(Debug, Default, Clone)]
226#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
227#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
228pub struct GameTypeConfig {
229
230}
231
232#[derive(Debug, Default, Clone)]
233#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
234#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
235pub struct QueueRewards {
236
237}
238
239#[derive(Debug, Default, Clone)]
240#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
241#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
242pub struct ContentBundles {
243
244}
245#[derive(Debug, Default, Clone)]
246#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
247#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
248pub struct GameFlowProperties {
249
250}
251
252#[derive(Debug, Default, Clone)]
253#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
254#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
255pub struct PlayerChampionSelections {
256
257}
258
259#[derive(Debug, Default, Clone)]
260#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
261#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
262pub struct QueueEvent {
263 pub dodge_data: Option<DodgeData>,
264 pub errors: Option<Vec<String>>,
265 pub estimated_queue_time: Option<f64>,
266 pub is_currently_in_queue: Option<bool>,
267 pub lobby_id: Option<String>,
268 pub low_priority_data: Option<LowPriorityData>,
269 pub queue_id: Option<QueueId>,
270 pub ready_check: Option<ReadyCheck>,
271 pub search_state: Option<SearchState>,
272 pub time_in_queue: Option<f64>,
273}
274
275#[derive(Debug, Clone)]
276#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
277#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
278pub struct DodgeData {
279 pub dodger_id: Option<i64>,
280 pub phase: Option<String>,
281 pub state: Option<String>,
282}
283
284
285#[derive(Debug, Clone)]
286#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
287#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
288pub struct LowPriorityData {
289 pub busted_leaver_access_token: Option<String>,
290 pub penalized_summoner_ids: Option<Vec<i64>>,
291 pub penalty_time: Option<f64>,
292 pub penalty_time_remaining: Option<f64>,
293 pub reason: Option<String>
294}
295
296#[derive(Debug, Clone)]
297#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
298#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
299pub struct ReadyCheck {
300 pub decliner_ids: Option<Vec<i64>>,
301 pub dodge_warning: Option<String>,
302 pub player_response: Option<String>,
303 pub state: Option<String>,
304 pub suppress_ux: Option<bool>,
305 pub timer: Option<f64>,
306}