1use chrono::NaiveDateTime;
2use serde::Serialize;
3
4#[derive(Debug, Clone, Serialize)]
6pub struct Match {
7 pub id: u32,
8 pub header: MatchHeader,
9 pub streams: Vec<MatchStream>,
10 pub vods: Vec<MatchStream>,
11 pub games: Vec<MatchGame>,
12 pub head_to_head: Vec<HeadToHeadMatch>,
13 pub past_matches: Vec<TeamPastMatches>,
14 pub performance: Option<MatchPerformance>,
15 pub economy: Option<MatchEconomy>,
16}
17
18#[derive(Debug, Clone, Serialize)]
20pub struct MatchHeader {
21 pub event_icon: String,
22 pub event_title: String,
23 pub event_series_name: String,
24 pub event_id: u32,
25 pub event_slug: String,
26 pub date: NaiveDateTime,
27 pub patch: String,
28 pub format: String,
29 pub status: String,
30 pub note: String,
31 pub teams: Vec<MatchHeaderTeam>,
32}
33
34#[derive(Debug, Clone, Serialize)]
36pub struct MatchHeaderTeam {
37 pub id: u32,
38 pub slug: String,
39 pub href: String,
40 pub name: String,
41 pub score: Option<u8>,
42 pub icon: String,
43}
44
45#[derive(Debug, Clone, Serialize)]
47pub struct MatchStream {
48 pub name: String,
49 pub link: String,
50}
51
52#[derive(Debug, Clone, Serialize)]
54pub struct MatchGame {
55 pub map: String,
56 pub picked_by: Option<u32>,
57 pub duration: Option<String>,
58 pub teams: Vec<MatchGameTeam>,
59 pub rounds: Vec<MatchGameRound>,
60}
61
62#[derive(Debug, Clone, Serialize)]
64pub struct MatchGameTeam {
65 pub name: String,
66 pub score: Option<u8>,
67 pub score_t: Option<u8>,
68 pub score_ct: Option<u8>,
69 pub is_winner: bool,
70 pub players: Vec<MatchGamePlayer>,
71}
72
73#[derive(Debug, Clone, Serialize)]
75pub struct MatchGameRound {
76 pub round: u8,
77 pub winning_team: u32,
78 pub winning_site: String,
79}
80
81#[derive(Debug, Clone, Serialize)]
83pub struct HeadToHeadMatch {
84 pub match_id: u32,
85 pub match_slug: String,
86 pub event_name: String,
87 pub event_series: String,
88 pub event_icon: String,
89 pub team1_score: u8,
90 pub team2_score: u8,
91 pub winner_index: u8,
92 pub date: String,
93}
94
95#[derive(Debug, Clone, Serialize)]
97pub struct TeamPastMatches {
98 pub team_id: u32,
99 pub matches: Vec<PastMatch>,
100}
101
102#[derive(Debug, Clone, Serialize)]
104pub struct PastMatch {
105 pub match_id: u32,
106 pub match_slug: String,
107 pub score_for: u8,
108 pub score_against: u8,
109 pub is_win: bool,
110 pub opponent_name: String,
111 pub opponent_logo: String,
112 pub date: String,
113}
114
115#[derive(Debug, Clone, Serialize)]
117pub struct MatchPerformance {
118 pub kill_matrix: Vec<KillMatrixEntry>,
119 pub player_performances: Vec<PlayerPerformance>,
120}
121
122#[derive(Debug, Clone, Serialize)]
124pub struct KillMatrixEntry {
125 pub killer_id: u32,
126 pub victim_id: u32,
127 pub kills: u16,
128 pub deaths: u16,
129}
130
131#[derive(Debug, Clone, Serialize)]
133pub struct PlayerPerformance {
134 pub player_id: u32,
135 pub player_name: String,
136 pub multi_kills_2k: u8,
137 pub multi_kills_3k: u8,
138 pub multi_kills_4k: u8,
139 pub multi_kills_5k: u8,
140 pub clutch_1v1: u8,
141 pub clutch_1v2: u8,
142 pub clutch_1v3: u8,
143 pub clutch_1v4: u8,
144 pub clutch_1v5: u8,
145 pub econ_rating: u16,
146 pub plants: u8,
147 pub defuses: u8,
148}
149
150#[derive(Debug, Clone, Serialize)]
152pub struct MatchEconomy {
153 pub teams: Vec<TeamEconomy>,
154}
155
156#[derive(Debug, Clone, Serialize)]
158pub struct TeamEconomy {
159 pub team_name: String,
160 pub pistol_won: u8,
161 pub eco_rounds: u8,
162 pub eco_won: u8,
163 pub semi_eco_rounds: u8,
164 pub semi_eco_won: u8,
165 pub semi_buy_rounds: u8,
166 pub semi_buy_won: u8,
167 pub full_buy_rounds: u8,
168 pub full_buy_won: u8,
169}
170
171#[derive(Debug, Clone, Serialize)]
173pub struct MatchGamePlayer {
174 pub nation: String,
175 pub id: u32,
176 pub name: String,
177 pub slug: String,
178 pub agent: String,
179 pub rating: Option<f32>,
180 pub acs: Option<u16>,
181 pub kills: Option<u16>,
182 pub deaths: Option<u16>,
183 pub assists: Option<u16>,
184 pub kd_diff: Option<i16>,
185 pub kast: Option<f32>,
186 pub adr: Option<f32>,
187 pub hs_pct: Option<f32>,
188 pub first_kills: Option<u16>,
189 pub first_deaths: Option<u16>,
190 pub fk_diff: Option<i16>,
191}