1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
use serde_json;
use super::Note;
#[derive(Serialize, Deserialize)]
#[serde(tag = "event")]
pub enum JamEvent {
#[serde(rename = "line up")]
Lineup {
skater: String,
start_in_box: bool,
position: Position,
},
#[serde(rename = "pack lap")]
PackLap {
timestamp: Option<Timestamp>,
count: Option<u8>,
},
#[serde(rename = "penalty")]
Penalty {
timestamp: Option<Timestamp>,
skater: String,
penalty: String,
severity: Option<PenaltySeverity>,
rescinded: Option<bool>,
involved: Option<Vec<Involved>>,
cue: Option<String>,
},
#[serde(rename = "pass")]
Pass {
timestamp: Option<Timestamp>,
completed: Option<bool>,
number: u8,
points: Option<u8>,
skater: Option<String>,
ghost_points: Option<Vec<GhostPoint>>
},
#[serde(rename = "star pass")]
StarPass {
timestamp: Option<Timestamp>,
skater: Option<String>,
team: Option<String>,
completed: Option<bool>,
failure: Option<String>,
},
#[serde(rename = "lead")]
Lead {
timestamp: Option<Timestamp>,
skater: String,
},
#[serde(rename = "lost lead")]
LostLead {
timestamp: Option<Timestamp>,
skater: String,
},
#[serde(rename = "call")]
Call {
timestamp: Option<Timestamp>,
skater: Option<String>,
team: Option<String>,
official: Option<String>,
},
#[serde(rename = "enter box")]
EnterBox {
timestamp: Option<Timestamp>,
skater: String,
duration: Option<serde_json::Number>,
substitute: Option<Substitute>,
notes: Option<Vec<Note>>
},
#[serde(rename = "exit box", rename_all = "kebab-case")]
ExitBox {
timestamp: Option<Timestamp>,
skater: String,
duration: Option<serde_json::Number>,
premature: Option<PrematureExitReason>,
no_skater: Option<bool>
},
#[serde(rename = "box time")]
BoxTime { },
#[serde(rename = "injury")]
Injury {
timestamp: Option<Timestamp>,
skater: String,
},
#[serde(rename = "note")]
Note {
note: String,
author: Option<String>,
date: Option<String>,
notes: Note,
},
#[serde(rename = "leave track", rename_all = "kebab-case")]
LeaveTrack {
timestamp: Option<Timestamp>,
skater: String,
reason: Option<LeaveTrackReason>,
opposing_pass: u8,
},
#[serde(rename = "return track", rename_all = "kebab-case")]
ReturnTrack {
timestamp: Option<Timestamp>,
skater: String,
opposing_pass: u8,
},
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum Position { Jammer, Pivot, Blocker }
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum PenaltySeverity { No, Minor, Major, Expulsion }
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum PrematureExitReason { Official, Skater, Rescinded, Mistake }
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum LeaveTrackReason { Penalty, Injury, Malfuction, Other }
#[derive(Serialize, Deserialize)]
pub struct GhostPoint {
pub skater: Option<String>,
pub ghost_point: GhostPointType,
}
#[derive(Serialize, Deserialize)]
pub enum GhostPointType { L, J, B, P, N, O, G }
#[derive(Serialize, Deserialize)]
pub struct Involved {
pub skater: String,
#[serde(default)]
pub notes: Vec<Note>,
}
#[derive(Serialize, Deserialize)]
pub struct Substitute {
pub skater: String,
pub reason: String,
}
#[derive(Serialize, Deserialize)]
pub struct Jam {
pub number: u16,
pub timestamp: Option<Timestamp>,
pub duration: Option<u16>,
pub events: Vec<JamEvent>,
pub notes: Vec<Note>,
}
#[derive(Serialize, Deserialize)]
pub struct Timeout {
pub timeout: TeamType,
#[serde(default)]
pub notes: Vec<Note>,
pub injury: Option<String>,
pub duration: u32,
pub timestamp: Option<Timestamp>,
pub review: Option<String>,
pub resolution: Option<String>,
pub retained: Option<bool>,
}
#[derive(Serialize, Deserialize)]
#[serde(untagged)]
pub enum ClockEvent {
Note(Note),
Jam(Jam),
Timeout(Timeout),
}
#[derive(Serialize, Deserialize)]
pub enum TeamType { Home, Away, Officials }
#[derive(Serialize, Deserialize, Default)]
pub struct Period {
pub timestamp: Option<Timestamp>,
pub end: Option<Timestamp>,
pub jams: Vec<ClockEvent>
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum Timestamp {
Wall(String),
Epoch(serde_json::Number),
Period(String),
Seconds(serde_json::Number),
Jam(serde_json::Number),
}