assignmentlib/dto/
qti.rs

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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
use serde::{Deserialize, Serialize};
use uuid::Uuid;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename = "qti-assessment-item")]
pub struct AssessmentItem {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@title")]
    pub title: String,
    #[serde(rename = "@adaptive")]
    pub adaptive: bool,
    #[serde(rename = "@time-dependent")]
    pub time_dependent: bool,
    #[serde(rename = "qti-response-declaration")]
    pub response_declaration: Vec<ResponseDeclaration>,
    #[serde(rename = "qti-outcome-declaration")]
    pub outcome_declaration: OutcomeDeclaration,
    #[serde(rename = "qti-item-body")]
    pub item_body: ItemBody,
    #[serde(rename = "qti-response-processing")]
    pub response_processing: Option<ResponseProcessing>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
// #[serde(rename = "qti-response-declaration")]
pub struct ResponseDeclaration {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@cardinality")]
    pub cardinality: String,
    #[serde(rename = "@base-type")]
    pub base_type: String,
    #[serde(rename = "qti-correct-response")]
    pub correct_response: Option<CorrectResponse>,
    #[serde(rename = "qti-mapping")]
    pub mapping: Option<Mapping>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
// #[serde(rename = "qti-correct-response")]
pub struct CorrectResponse {
    #[serde(rename = "qti-value")]
    pub value: Vec<QtiValue>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
// #[serde(rename = "qti-value")]
pub struct QtiValue {
    #[serde(rename = "$value")]
    pub content: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
// #[serde(rename = "qti-mapping")]
pub struct Mapping {
    #[serde(rename = "@lower-bound")]
    pub lower_bound: Option<f32>,
    #[serde(rename = "@upper-bound")]
    pub upper_bound: Option<f32>,
    #[serde(rename = "@default-value")]
    pub default_value: Option<f32>,
    #[serde(rename = "qti-map-entry")]
    pub map_entry: Vec<MapEntry>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
// #[serde(rename = "map-entry")]
pub struct MapEntry {
    #[serde(rename = "@map-key")]
    pub map_key: String,
    #[serde(rename = "@mapped-value")]
    pub mapped_value: f32,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct OutcomeDeclaration {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@cardinality")]
    pub cardinality: String,
    #[serde(rename = "@base-type")]
    pub base_type: String,
    #[serde(rename = "qti-default-value")]
    pub default_value: Option<DefaultValue>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DefaultValue {
    #[serde(rename = "qti-value")]
    pub value: QtiValue,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ItemBody {
    #[serde(rename = "$value")]
    pub content: Option<String>,
    #[serde(rename = "qti-choice-interaction")]
    pub choice_interaction: Option<Vec<ChoiceInteraction>>,
    #[serde(rename = "qti-gap-match-interaction")]
    pub gap_interaction: Option<Vec<GapInteraction>>,
    #[serde(rename = "qti-graphic-gap-match-interaction")]
    pub graphic_gap_match_interaction: Option<Vec<GraphicGapMatchInteraction>>,
    #[serde(rename = "qti-hotspot-interaction")]
    pub hotspot_interaction: Option<Vec<HotspotInteraction>>,
    #[serde(rename = "qti-hottext-interaction")]
    pub hottext_interaction: Option<Vec<HottextInteraction>>,
    #[serde(rename = "qti-match-interaction")]
    pub match_interaction: Option<Vec<MatchInteraction>>,
    #[serde(rename = "qti-inline-choice-interaction")]
    pub inline_choice_interaction : Option<Vec<InlineChoiceInteraction>>,
    #[serde(rename = "qti-text-entry-interaction")]
    pub text_entry_interaction : Option<Vec<TextEntryInteraction>>,
    #[serde(rename = "qti-extended-text-interaction")]
    pub extended_text_interaction : Option<Vec<ExtendedTextInteraction>>,
}
// #[derive(Serialize, Deserialize, Debug, Clone)]
// pub struct P {
//     #[serde(rename = "$value")]
//     pub content : String
// }

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ChoiceInteraction {
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "@shuffle")]
    pub shuffle: Option<String>,
    #[serde(rename = "@max-choices")]
    pub max_choices: f32,
    #[serde(rename = "qti-prompt")]
    pub prompt: Prompt,
    #[serde(rename = "qti-simple-choice")]
    pub simple_choice: Vec<SimpleChoice>,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GapInteraction {

    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "@class")]
    pub class: Option<String>,
    #[serde(rename = "@data-choices-container-width")]
    pub data_choices_container_width: Option<f32>,
    #[serde(rename = "qti-prompt")]
    pub prompt: Prompt,
    #[serde(rename = "qti-gap-text")]
    pub gap_text: Vec<GapText>,
    #[serde(rename = "qti-gap")]
    pub gap: Vec<Gap>,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
enum AnyName {
    #[serde(other)]
    Text
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GapText {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@match-max")]
    pub match_max: f32,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Gap {
    #[serde(rename = "@uid")]
    pub uid: Uuid,
    #[serde(rename = "@identifier")]
    pub identifier: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GraphicGapMatchInteraction
{
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "data-choices-container-width")]
    pub data_choices_container_width: Option<f32>,
    #[serde(rename = "qti-gap-img")]
    pub gap_img: Vec<GapImg>,
    #[serde(rename = "qti-associable-hotspot")]
    pub associable_hotspot: Vec<AssociableHotspot>,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GapImg {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@match-max")]
    pub match_max: f32,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AssociableHotspot {
    #[serde(rename = "@uid")]
    pub uid: Uuid,
    #[serde(rename = "@coords")]
    pub coords: String,
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@match-max")]
    pub match_max: f32,
    #[serde(rename = "@shape")]
    pub shape: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct HotspotInteraction {
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
    #[serde(rename = "@class")]
    pub class: Option<String>,
    #[serde(rename = "@max-choices")]
    pub max_choices: f32,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "qti-hotspot-choice")]
    pub hotspot_choice: Vec<HotspotChoice>,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct HotspotChoice {
    #[serde(rename = "@coords")]
    pub coords: String,
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@shape")]
    pub shape: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct HottextInteraction {
    #[serde(rename = "@class")]
    pub class: Option<String>,
    #[serde(rename = "@max-choices")]
    pub max_choices: f32,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
    #[serde(rename = "qti-hottext")]
    pub hottext: Vec<Hottext>,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Hottext {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MatchInteraction {
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
    #[serde(rename = "@max-associations")]
    pub max_associations: f32,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "@shuffle")]
    pub shuffle: Option<String>,
    #[serde(rename = "qti-simple-match-set")]
    pub simple_match_set: Vec<SimpleMatchSet>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SimpleMatchSet {
    #[serde(rename = "qti-simple-associable-choice")]
    pub simple_associable_choice: Vec<SimpleAssociableChoice>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SimpleAssociableChoice {
    #[serde(rename = "@uid")]
    pub uid: Uuid,
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@match-max")]
    pub match_max: f32,
    #[serde(rename = "@id")]
    pub id: Option<String>,
    #[serde(rename = "@aria-label")]
    pub aria_label: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct InlineChoiceInteraction {
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
    #[serde(rename = "@class")]
    pub class: Option<String>,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "@shuffle")]
    pub shuffle: Option<String>,
    #[serde(rename = "qti-inline-choice")]
    pub inline_choice : Vec<InlineChoice>,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct InlineChoice {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "$value")]
    pub content: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TextEntryInteraction {
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
    #[serde(rename = "@class")]
    pub class: Option<String>,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "@shuffle")]
    pub shuffle: Option<String>,
    #[serde(rename = "@expected-length")]
    pub expected_length : i32,
    #[serde(rename = "@pattern-mask")]
    pub pattern_mask : Option<String>,
    #[serde(rename = "@data-patternmask-message")]
    pub data_patternmask_message : Option<String>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ExtendedTextInteraction {
    #[serde(rename = "@class")]
    pub class: Option<String>,
    #[serde(rename = "@response-identifier")]
    pub response_identifier: String,
    #[serde(rename = "@shuffle")]
    pub shuffle: Option<String>,
    #[serde(rename = "@expected-length")]
    pub expected_length : i32,
    #[serde(rename = "@format")]
    pub format : Option<String>,
    pub pattern_mask : Option<String>,
    #[serde(rename = "@data-patternmask-message")]
    pub data_patternmask_message : Option<String>,
    #[serde(rename = "qti-prompt")]
    pub prompt: Option<Prompt>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Prompt {
    #[serde(rename = "$value")]
    pub content: Option<String>,
    #[serde(rename = "@id")]
    pub id: Option<String>,
    // #[serde(rename = "em")]
    // pub em : Option<Em>,
}

// #[derive(Serialize, Deserialize, Debug, Clone)]
// pub struct Em {
//     #[serde(rename = "$value")]
//     content : String
// }
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SimpleChoice {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "@fixed")]
    pub fixed: Option<bool>,
    #[serde(rename = "$value")]
    pub content: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ResponseProcessing {
    #[serde(rename = "@template")]
    pub template: Option<String>,
    #[serde(rename = "qti-response-condition")]
    pub response_condition: Option<ResponseCondition>,

}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ResponseCondition {
    #[serde(rename = "qti-response-if")]
    pub response_if: ResponseIf,
    #[serde(rename = "qti-response-else")]
    pub response_else: ResponseElse,

}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ResponseIf {
    #[serde(rename = "qti-is-null")]
    pub is_null: IsNull,
    #[serde(rename = "qti-set-outcome-value")]
    pub set_outcome_value: SetOutcomeValue,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IsNull {
    #[serde(rename = "qti-variable")]
    pub variable: Variable,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Variable {
    #[serde(rename = "@identifier")]
    pub identifier: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SetOutcomeValue {
    #[serde(rename = "@identifier")]
    pub identifier: String,
    #[serde(rename = "qti-map-response")]
    pub map_response : Option<MapResponse>,
    #[serde(rename = "qti-base-value")]
    pub base_value : Option<BaseValue>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MapResponse {
    #[serde(rename = "@identifier")]
    pub identifier: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BaseValue {
    #[serde(rename = "@base-type")]
    pub base_type : String,
    #[serde(rename = "$value")]
    pub content: String,

}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ResponseElse {
    #[serde(rename = "qti-set-outcome-value")]
    pub set_outcome_value: SetOutcomeValue,
}