1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::types::collection::{Collection, RecordError};
18use jacquard_common::types::string::{AtUri, Cid, Datetime};
19use jacquard_common::types::uri::{RecordUri, UriError};
20use jacquard_common::xrpc::XrpcResp;
21use jacquard_derive::{IntoStatic, lexicon};
22use jacquard_lexicon::lexicon::LexiconDoc;
23use jacquard_lexicon::schema::LexiconSchema;
24
25#[allow(unused_imports)]
26use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
27use serde::{Serialize, Deserialize};
28use crate::net_anisota::beta::game::progress;
29#[lexicon]
32#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
33#[serde(
34 rename_all = "camelCase",
35 rename = "net.anisota.beta.game.progress",
36 tag = "$type"
37)]
38pub struct Progress<'a> {
39 #[serde(skip_serializing_if = "Option::is_none")]
41 #[serde(borrow)]
42 pub card_uri: Option<CowStr<'a>>,
43 pub created_at: Datetime,
45 #[serde(skip_serializing_if = "Option::is_none")]
47 #[serde(borrow)]
48 pub current_stamina: Option<CowStr<'a>>,
49 pub level: i64,
51 #[serde(skip_serializing_if = "Option::is_none")]
52 #[serde(borrow)]
53 pub metadata: Option<progress::Metadata<'a>>,
54 #[serde(skip_serializing_if = "Option::is_none")]
56 pub previous_level: Option<i64>,
57 #[serde(borrow)]
59 pub progress_percentage: CowStr<'a>,
60 #[serde(skip_serializing_if = "Option::is_none")]
62 #[serde(borrow)]
63 pub related_log_uris: Option<Vec<CowStr<'a>>>,
64 #[serde(skip_serializing_if = "Option::is_none")]
66 #[serde(borrow)]
67 pub session_id: Option<CowStr<'a>>,
68 #[serde(skip_serializing_if = "Option::is_none")]
70 #[serde(borrow)]
71 pub session_uri: Option<CowStr<'a>>,
72 #[serde(skip_serializing_if = "Option::is_none")]
73 #[serde(borrow)]
74 pub stats: Option<progress::Stats<'a>>,
75 pub total_xp: i64,
77 #[serde(skip_serializing_if = "Option::is_none")]
79 #[serde(borrow)]
80 pub trigger_source: Option<CowStr<'a>>,
81 #[serde(skip_serializing_if = "Option::is_none")]
83 pub xp_gained_since_last_save: Option<i64>,
84 pub xp_to_next_level: i64,
86}
87
88#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
91#[serde(rename_all = "camelCase")]
92pub struct ProgressGetRecordOutput<'a> {
93 #[serde(skip_serializing_if = "Option::is_none")]
94 #[serde(borrow)]
95 pub cid: Option<Cid<'a>>,
96 #[serde(borrow)]
97 pub uri: AtUri<'a>,
98 #[serde(borrow)]
99 pub value: Progress<'a>,
100}
101
102#[lexicon]
105#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
106#[serde(rename_all = "camelCase")]
107pub struct Metadata<'a> {
108 #[serde(skip_serializing_if = "Option::is_none")]
110 #[serde(borrow)]
111 pub client_version: Option<CowStr<'a>>,
112 #[serde(skip_serializing_if = "Option::is_none")]
114 #[serde(borrow)]
115 pub platform: Option<CowStr<'a>>,
116}
117
118#[lexicon]
121#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
122#[serde(rename_all = "camelCase")]
123pub struct Stats<'a> {
124 #[serde(skip_serializing_if = "Option::is_none")]
126 pub daily_rewards_claimed: Option<i64>,
127 #[serde(skip_serializing_if = "Option::is_none")]
129 pub items_collected: Option<i64>,
130 #[serde(skip_serializing_if = "Option::is_none")]
132 pub last_post_read_date: Option<Datetime>,
133 #[serde(skip_serializing_if = "Option::is_none")]
135 pub posts_read_today: Option<i64>,
136 #[serde(skip_serializing_if = "Option::is_none")]
138 pub posts_read_total: Option<i64>,
139 #[serde(skip_serializing_if = "Option::is_none")]
141 pub posts_viewed: Option<i64>,
142 #[serde(skip_serializing_if = "Option::is_none")]
144 pub shuffles_performed: Option<i64>,
145 #[serde(skip_serializing_if = "Option::is_none")]
147 pub specimens_collected: Option<i64>,
148}
149
150impl<'a> Progress<'a> {
151 pub fn uri(
152 uri: impl Into<CowStr<'a>>,
153 ) -> Result<RecordUri<'a, ProgressRecord>, UriError> {
154 RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
155 }
156}
157
158#[derive(Debug, Serialize, Deserialize)]
161pub struct ProgressRecord;
162impl XrpcResp for ProgressRecord {
163 const NSID: &'static str = "net.anisota.beta.game.progress";
164 const ENCODING: &'static str = "application/json";
165 type Output<'de> = ProgressGetRecordOutput<'de>;
166 type Err<'de> = RecordError<'de>;
167}
168
169impl From<ProgressGetRecordOutput<'_>> for Progress<'_> {
170 fn from(output: ProgressGetRecordOutput<'_>) -> Self {
171 use jacquard_common::IntoStatic;
172 output.value.into_static()
173 }
174}
175
176impl Collection for Progress<'_> {
177 const NSID: &'static str = "net.anisota.beta.game.progress";
178 type Record = ProgressRecord;
179}
180
181impl Collection for ProgressRecord {
182 const NSID: &'static str = "net.anisota.beta.game.progress";
183 type Record = ProgressRecord;
184}
185
186impl<'a> LexiconSchema for Progress<'a> {
187 fn nsid() -> &'static str {
188 "net.anisota.beta.game.progress"
189 }
190 fn def_name() -> &'static str {
191 "main"
192 }
193 fn lexicon_doc() -> LexiconDoc<'static> {
194 lexicon_doc_net_anisota_beta_game_progress()
195 }
196 fn validate(&self) -> Result<(), ConstraintError> {
197 {
198 let value = &self.level;
199 if *value < 1i64 {
200 return Err(ConstraintError::Minimum {
201 path: ValidationPath::from_field("level"),
202 min: 1i64,
203 actual: *value,
204 });
205 }
206 }
207 if let Some(ref value) = self.previous_level {
208 if *value < 1i64 {
209 return Err(ConstraintError::Minimum {
210 path: ValidationPath::from_field("previous_level"),
211 min: 1i64,
212 actual: *value,
213 });
214 }
215 }
216 {
217 let value = &self.total_xp;
218 if *value < 0i64 {
219 return Err(ConstraintError::Minimum {
220 path: ValidationPath::from_field("total_xp"),
221 min: 0i64,
222 actual: *value,
223 });
224 }
225 }
226 if let Some(ref value) = self.xp_gained_since_last_save {
227 if *value < 0i64 {
228 return Err(ConstraintError::Minimum {
229 path: ValidationPath::from_field("xp_gained_since_last_save"),
230 min: 0i64,
231 actual: *value,
232 });
233 }
234 }
235 {
236 let value = &self.xp_to_next_level;
237 if *value < 0i64 {
238 return Err(ConstraintError::Minimum {
239 path: ValidationPath::from_field("xp_to_next_level"),
240 min: 0i64,
241 actual: *value,
242 });
243 }
244 }
245 Ok(())
246 }
247}
248
249impl<'a> LexiconSchema for Metadata<'a> {
250 fn nsid() -> &'static str {
251 "net.anisota.beta.game.progress"
252 }
253 fn def_name() -> &'static str {
254 "metadata"
255 }
256 fn lexicon_doc() -> LexiconDoc<'static> {
257 lexicon_doc_net_anisota_beta_game_progress()
258 }
259 fn validate(&self) -> Result<(), ConstraintError> {
260 Ok(())
261 }
262}
263
264impl<'a> LexiconSchema for Stats<'a> {
265 fn nsid() -> &'static str {
266 "net.anisota.beta.game.progress"
267 }
268 fn def_name() -> &'static str {
269 "stats"
270 }
271 fn lexicon_doc() -> LexiconDoc<'static> {
272 lexicon_doc_net_anisota_beta_game_progress()
273 }
274 fn validate(&self) -> Result<(), ConstraintError> {
275 if let Some(ref value) = self.daily_rewards_claimed {
276 if *value < 0i64 {
277 return Err(ConstraintError::Minimum {
278 path: ValidationPath::from_field("daily_rewards_claimed"),
279 min: 0i64,
280 actual: *value,
281 });
282 }
283 }
284 if let Some(ref value) = self.items_collected {
285 if *value < 0i64 {
286 return Err(ConstraintError::Minimum {
287 path: ValidationPath::from_field("items_collected"),
288 min: 0i64,
289 actual: *value,
290 });
291 }
292 }
293 if let Some(ref value) = self.posts_read_today {
294 if *value < 0i64 {
295 return Err(ConstraintError::Minimum {
296 path: ValidationPath::from_field("posts_read_today"),
297 min: 0i64,
298 actual: *value,
299 });
300 }
301 }
302 if let Some(ref value) = self.posts_read_total {
303 if *value < 0i64 {
304 return Err(ConstraintError::Minimum {
305 path: ValidationPath::from_field("posts_read_total"),
306 min: 0i64,
307 actual: *value,
308 });
309 }
310 }
311 if let Some(ref value) = self.posts_viewed {
312 if *value < 0i64 {
313 return Err(ConstraintError::Minimum {
314 path: ValidationPath::from_field("posts_viewed"),
315 min: 0i64,
316 actual: *value,
317 });
318 }
319 }
320 if let Some(ref value) = self.shuffles_performed {
321 if *value < 0i64 {
322 return Err(ConstraintError::Minimum {
323 path: ValidationPath::from_field("shuffles_performed"),
324 min: 0i64,
325 actual: *value,
326 });
327 }
328 }
329 if let Some(ref value) = self.specimens_collected {
330 if *value < 0i64 {
331 return Err(ConstraintError::Minimum {
332 path: ValidationPath::from_field("specimens_collected"),
333 min: 0i64,
334 actual: *value,
335 });
336 }
337 }
338 Ok(())
339 }
340}
341
342pub mod progress_state {
343
344 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
345 #[allow(unused)]
346 use ::core::marker::PhantomData;
347 mod sealed {
348 pub trait Sealed {}
349 }
350 pub trait State: sealed::Sealed {
352 type ProgressPercentage;
353 type XpToNextLevel;
354 type Level;
355 type CreatedAt;
356 type TotalXp;
357 }
358 pub struct Empty(());
360 impl sealed::Sealed for Empty {}
361 impl State for Empty {
362 type ProgressPercentage = Unset;
363 type XpToNextLevel = Unset;
364 type Level = Unset;
365 type CreatedAt = Unset;
366 type TotalXp = Unset;
367 }
368 pub struct SetProgressPercentage<S: State = Empty>(PhantomData<fn() -> S>);
370 impl<S: State> sealed::Sealed for SetProgressPercentage<S> {}
371 impl<S: State> State for SetProgressPercentage<S> {
372 type ProgressPercentage = Set<members::progress_percentage>;
373 type XpToNextLevel = S::XpToNextLevel;
374 type Level = S::Level;
375 type CreatedAt = S::CreatedAt;
376 type TotalXp = S::TotalXp;
377 }
378 pub struct SetXpToNextLevel<S: State = Empty>(PhantomData<fn() -> S>);
380 impl<S: State> sealed::Sealed for SetXpToNextLevel<S> {}
381 impl<S: State> State for SetXpToNextLevel<S> {
382 type ProgressPercentage = S::ProgressPercentage;
383 type XpToNextLevel = Set<members::xp_to_next_level>;
384 type Level = S::Level;
385 type CreatedAt = S::CreatedAt;
386 type TotalXp = S::TotalXp;
387 }
388 pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>);
390 impl<S: State> sealed::Sealed for SetLevel<S> {}
391 impl<S: State> State for SetLevel<S> {
392 type ProgressPercentage = S::ProgressPercentage;
393 type XpToNextLevel = S::XpToNextLevel;
394 type Level = Set<members::level>;
395 type CreatedAt = S::CreatedAt;
396 type TotalXp = S::TotalXp;
397 }
398 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
400 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
401 impl<S: State> State for SetCreatedAt<S> {
402 type ProgressPercentage = S::ProgressPercentage;
403 type XpToNextLevel = S::XpToNextLevel;
404 type Level = S::Level;
405 type CreatedAt = Set<members::created_at>;
406 type TotalXp = S::TotalXp;
407 }
408 pub struct SetTotalXp<S: State = Empty>(PhantomData<fn() -> S>);
410 impl<S: State> sealed::Sealed for SetTotalXp<S> {}
411 impl<S: State> State for SetTotalXp<S> {
412 type ProgressPercentage = S::ProgressPercentage;
413 type XpToNextLevel = S::XpToNextLevel;
414 type Level = S::Level;
415 type CreatedAt = S::CreatedAt;
416 type TotalXp = Set<members::total_xp>;
417 }
418 #[allow(non_camel_case_types)]
420 pub mod members {
421 pub struct progress_percentage(());
423 pub struct xp_to_next_level(());
425 pub struct level(());
427 pub struct created_at(());
429 pub struct total_xp(());
431 }
432}
433
434pub struct ProgressBuilder<'a, S: progress_state::State> {
436 _state: PhantomData<fn() -> S>,
437 _fields: (
438 Option<CowStr<'a>>,
439 Option<Datetime>,
440 Option<CowStr<'a>>,
441 Option<i64>,
442 Option<progress::Metadata<'a>>,
443 Option<i64>,
444 Option<CowStr<'a>>,
445 Option<Vec<CowStr<'a>>>,
446 Option<CowStr<'a>>,
447 Option<CowStr<'a>>,
448 Option<progress::Stats<'a>>,
449 Option<i64>,
450 Option<CowStr<'a>>,
451 Option<i64>,
452 Option<i64>,
453 ),
454 _lifetime: PhantomData<&'a ()>,
455}
456
457impl<'a> Progress<'a> {
458 pub fn new() -> ProgressBuilder<'a, progress_state::Empty> {
460 ProgressBuilder::new()
461 }
462}
463
464impl<'a> ProgressBuilder<'a, progress_state::Empty> {
465 pub fn new() -> Self {
467 ProgressBuilder {
468 _state: PhantomData,
469 _fields: (
470 None,
471 None,
472 None,
473 None,
474 None,
475 None,
476 None,
477 None,
478 None,
479 None,
480 None,
481 None,
482 None,
483 None,
484 None,
485 ),
486 _lifetime: PhantomData,
487 }
488 }
489}
490
491impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
492 pub fn card_uri(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
494 self._fields.0 = value.into();
495 self
496 }
497 pub fn maybe_card_uri(mut self, value: Option<CowStr<'a>>) -> Self {
499 self._fields.0 = value;
500 self
501 }
502}
503
504impl<'a, S> ProgressBuilder<'a, S>
505where
506 S: progress_state::State,
507 S::CreatedAt: progress_state::IsUnset,
508{
509 pub fn created_at(
511 mut self,
512 value: impl Into<Datetime>,
513 ) -> ProgressBuilder<'a, progress_state::SetCreatedAt<S>> {
514 self._fields.1 = Option::Some(value.into());
515 ProgressBuilder {
516 _state: PhantomData,
517 _fields: self._fields,
518 _lifetime: PhantomData,
519 }
520 }
521}
522
523impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
524 pub fn current_stamina(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
526 self._fields.2 = value.into();
527 self
528 }
529 pub fn maybe_current_stamina(mut self, value: Option<CowStr<'a>>) -> Self {
531 self._fields.2 = value;
532 self
533 }
534}
535
536impl<'a, S> ProgressBuilder<'a, S>
537where
538 S: progress_state::State,
539 S::Level: progress_state::IsUnset,
540{
541 pub fn level(
543 mut self,
544 value: impl Into<i64>,
545 ) -> ProgressBuilder<'a, progress_state::SetLevel<S>> {
546 self._fields.3 = Option::Some(value.into());
547 ProgressBuilder {
548 _state: PhantomData,
549 _fields: self._fields,
550 _lifetime: PhantomData,
551 }
552 }
553}
554
555impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
556 pub fn metadata(mut self, value: impl Into<Option<progress::Metadata<'a>>>) -> Self {
558 self._fields.4 = value.into();
559 self
560 }
561 pub fn maybe_metadata(mut self, value: Option<progress::Metadata<'a>>) -> Self {
563 self._fields.4 = value;
564 self
565 }
566}
567
568impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
569 pub fn previous_level(mut self, value: impl Into<Option<i64>>) -> Self {
571 self._fields.5 = value.into();
572 self
573 }
574 pub fn maybe_previous_level(mut self, value: Option<i64>) -> Self {
576 self._fields.5 = value;
577 self
578 }
579}
580
581impl<'a, S> ProgressBuilder<'a, S>
582where
583 S: progress_state::State,
584 S::ProgressPercentage: progress_state::IsUnset,
585{
586 pub fn progress_percentage(
588 mut self,
589 value: impl Into<CowStr<'a>>,
590 ) -> ProgressBuilder<'a, progress_state::SetProgressPercentage<S>> {
591 self._fields.6 = Option::Some(value.into());
592 ProgressBuilder {
593 _state: PhantomData,
594 _fields: self._fields,
595 _lifetime: PhantomData,
596 }
597 }
598}
599
600impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
601 pub fn related_log_uris(
603 mut self,
604 value: impl Into<Option<Vec<CowStr<'a>>>>,
605 ) -> Self {
606 self._fields.7 = value.into();
607 self
608 }
609 pub fn maybe_related_log_uris(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
611 self._fields.7 = value;
612 self
613 }
614}
615
616impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
617 pub fn session_id(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
619 self._fields.8 = value.into();
620 self
621 }
622 pub fn maybe_session_id(mut self, value: Option<CowStr<'a>>) -> Self {
624 self._fields.8 = value;
625 self
626 }
627}
628
629impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
630 pub fn session_uri(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
632 self._fields.9 = value.into();
633 self
634 }
635 pub fn maybe_session_uri(mut self, value: Option<CowStr<'a>>) -> Self {
637 self._fields.9 = value;
638 self
639 }
640}
641
642impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
643 pub fn stats(mut self, value: impl Into<Option<progress::Stats<'a>>>) -> Self {
645 self._fields.10 = value.into();
646 self
647 }
648 pub fn maybe_stats(mut self, value: Option<progress::Stats<'a>>) -> Self {
650 self._fields.10 = value;
651 self
652 }
653}
654
655impl<'a, S> ProgressBuilder<'a, S>
656where
657 S: progress_state::State,
658 S::TotalXp: progress_state::IsUnset,
659{
660 pub fn total_xp(
662 mut self,
663 value: impl Into<i64>,
664 ) -> ProgressBuilder<'a, progress_state::SetTotalXp<S>> {
665 self._fields.11 = Option::Some(value.into());
666 ProgressBuilder {
667 _state: PhantomData,
668 _fields: self._fields,
669 _lifetime: PhantomData,
670 }
671 }
672}
673
674impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
675 pub fn trigger_source(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
677 self._fields.12 = value.into();
678 self
679 }
680 pub fn maybe_trigger_source(mut self, value: Option<CowStr<'a>>) -> Self {
682 self._fields.12 = value;
683 self
684 }
685}
686
687impl<'a, S: progress_state::State> ProgressBuilder<'a, S> {
688 pub fn xp_gained_since_last_save(mut self, value: impl Into<Option<i64>>) -> Self {
690 self._fields.13 = value.into();
691 self
692 }
693 pub fn maybe_xp_gained_since_last_save(mut self, value: Option<i64>) -> Self {
695 self._fields.13 = value;
696 self
697 }
698}
699
700impl<'a, S> ProgressBuilder<'a, S>
701where
702 S: progress_state::State,
703 S::XpToNextLevel: progress_state::IsUnset,
704{
705 pub fn xp_to_next_level(
707 mut self,
708 value: impl Into<i64>,
709 ) -> ProgressBuilder<'a, progress_state::SetXpToNextLevel<S>> {
710 self._fields.14 = Option::Some(value.into());
711 ProgressBuilder {
712 _state: PhantomData,
713 _fields: self._fields,
714 _lifetime: PhantomData,
715 }
716 }
717}
718
719impl<'a, S> ProgressBuilder<'a, S>
720where
721 S: progress_state::State,
722 S::ProgressPercentage: progress_state::IsSet,
723 S::XpToNextLevel: progress_state::IsSet,
724 S::Level: progress_state::IsSet,
725 S::CreatedAt: progress_state::IsSet,
726 S::TotalXp: progress_state::IsSet,
727{
728 pub fn build(self) -> Progress<'a> {
730 Progress {
731 card_uri: self._fields.0,
732 created_at: self._fields.1.unwrap(),
733 current_stamina: self._fields.2,
734 level: self._fields.3.unwrap(),
735 metadata: self._fields.4,
736 previous_level: self._fields.5,
737 progress_percentage: self._fields.6.unwrap(),
738 related_log_uris: self._fields.7,
739 session_id: self._fields.8,
740 session_uri: self._fields.9,
741 stats: self._fields.10,
742 total_xp: self._fields.11.unwrap(),
743 trigger_source: self._fields.12,
744 xp_gained_since_last_save: self._fields.13,
745 xp_to_next_level: self._fields.14.unwrap(),
746 extra_data: Default::default(),
747 }
748 }
749 pub fn build_with_data(
751 self,
752 extra_data: BTreeMap<
753 jacquard_common::deps::smol_str::SmolStr,
754 jacquard_common::types::value::Data<'a>,
755 >,
756 ) -> Progress<'a> {
757 Progress {
758 card_uri: self._fields.0,
759 created_at: self._fields.1.unwrap(),
760 current_stamina: self._fields.2,
761 level: self._fields.3.unwrap(),
762 metadata: self._fields.4,
763 previous_level: self._fields.5,
764 progress_percentage: self._fields.6.unwrap(),
765 related_log_uris: self._fields.7,
766 session_id: self._fields.8,
767 session_uri: self._fields.9,
768 stats: self._fields.10,
769 total_xp: self._fields.11.unwrap(),
770 trigger_source: self._fields.12,
771 xp_gained_since_last_save: self._fields.13,
772 xp_to_next_level: self._fields.14.unwrap(),
773 extra_data: Some(extra_data),
774 }
775 }
776}
777
778fn lexicon_doc_net_anisota_beta_game_progress() -> LexiconDoc<'static> {
779 #[allow(unused_imports)]
780 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
781 use jacquard_lexicon::lexicon::*;
782 use alloc::collections::BTreeMap;
783 LexiconDoc {
784 lexicon: Lexicon::Lexicon1,
785 id: CowStr::new_static("net.anisota.beta.game.progress"),
786 defs: {
787 let mut map = BTreeMap::new();
788 map.insert(
789 SmolStr::new_static("main"),
790 LexUserType::Record(LexRecord {
791 description: Some(
792 CowStr::new_static(
793 "Record representing a player's level progression and game statistics",
794 ),
795 ),
796 key: Some(CowStr::new_static("tid")),
797 record: LexRecordRecord::Object(LexObject {
798 required: Some(
799 vec![
800 SmolStr::new_static("level"),
801 SmolStr::new_static("totalXP"),
802 SmolStr::new_static("progressPercentage"),
803 SmolStr::new_static("xpToNextLevel"),
804 SmolStr::new_static("createdAt")
805 ],
806 ),
807 properties: {
808 #[allow(unused_mut)]
809 let mut map = BTreeMap::new();
810 map.insert(
811 SmolStr::new_static("cardUri"),
812 LexObjectProperty::String(LexString {
813 description: Some(
814 CowStr::new_static(
815 "URI of the card that was advanced when triggerSource is card_advance",
816 ),
817 ),
818 ..Default::default()
819 }),
820 );
821 map.insert(
822 SmolStr::new_static("createdAt"),
823 LexObjectProperty::String(LexString {
824 description: Some(
825 CowStr::new_static("When the progress record was created"),
826 ),
827 format: Some(LexStringFormat::Datetime),
828 ..Default::default()
829 }),
830 );
831 map.insert(
832 SmolStr::new_static("currentStamina"),
833 LexObjectProperty::String(LexString {
834 description: Some(
835 CowStr::new_static(
836 "Current stamina level when this progress was recorded (decimal string, e.g. '85.5')",
837 ),
838 ),
839 ..Default::default()
840 }),
841 );
842 map.insert(
843 SmolStr::new_static("level"),
844 LexObjectProperty::Integer(LexInteger {
845 minimum: Some(1i64),
846 ..Default::default()
847 }),
848 );
849 map.insert(
850 SmolStr::new_static("metadata"),
851 LexObjectProperty::Ref(LexRef {
852 r#ref: CowStr::new_static("#metadata"),
853 ..Default::default()
854 }),
855 );
856 map.insert(
857 SmolStr::new_static("previousLevel"),
858 LexObjectProperty::Integer(LexInteger {
859 minimum: Some(1i64),
860 ..Default::default()
861 }),
862 );
863 map.insert(
864 SmolStr::new_static("progressPercentage"),
865 LexObjectProperty::String(LexString {
866 description: Some(
867 CowStr::new_static(
868 "Progress percentage to the next level (decimal string, e.g. '75.5')",
869 ),
870 ),
871 ..Default::default()
872 }),
873 );
874 map.insert(
875 SmolStr::new_static("relatedLogUris"),
876 LexObjectProperty::Array(LexArray {
877 description: Some(
878 CowStr::new_static(
879 "URIs of related game log records that contributed to this progress",
880 ),
881 ),
882 items: LexArrayItem::String(LexString {
883 ..Default::default()
884 }),
885 ..Default::default()
886 }),
887 );
888 map.insert(
889 SmolStr::new_static("sessionId"),
890 LexObjectProperty::String(LexString {
891 description: Some(
892 CowStr::new_static(
893 "Session ID when this progress was recorded (for linking with log records)",
894 ),
895 ),
896 ..Default::default()
897 }),
898 );
899 map.insert(
900 SmolStr::new_static("sessionUri"),
901 LexObjectProperty::String(LexString {
902 description: Some(
903 CowStr::new_static(
904 "URI of the session record when this progress was recorded",
905 ),
906 ),
907 ..Default::default()
908 }),
909 );
910 map.insert(
911 SmolStr::new_static("stats"),
912 LexObjectProperty::Ref(LexRef {
913 r#ref: CowStr::new_static("#stats"),
914 ..Default::default()
915 }),
916 );
917 map.insert(
918 SmolStr::new_static("totalXP"),
919 LexObjectProperty::Integer(LexInteger {
920 minimum: Some(0i64),
921 ..Default::default()
922 }),
923 );
924 map.insert(
925 SmolStr::new_static("triggerSource"),
926 LexObjectProperty::String(LexString {
927 description: Some(
928 CowStr::new_static(
929 "What action triggered this progress save",
930 ),
931 ),
932 ..Default::default()
933 }),
934 );
935 map.insert(
936 SmolStr::new_static("xpGainedSinceLastSave"),
937 LexObjectProperty::Integer(LexInteger {
938 minimum: Some(0i64),
939 ..Default::default()
940 }),
941 );
942 map.insert(
943 SmolStr::new_static("xpToNextLevel"),
944 LexObjectProperty::Integer(LexInteger {
945 minimum: Some(0i64),
946 ..Default::default()
947 }),
948 );
949 map
950 },
951 ..Default::default()
952 }),
953 ..Default::default()
954 }),
955 );
956 map.insert(
957 SmolStr::new_static("metadata"),
958 LexUserType::Object(LexObject {
959 description: Some(
960 CowStr::new_static(
961 "Additional metadata about this progress update",
962 ),
963 ),
964 properties: {
965 #[allow(unused_mut)]
966 let mut map = BTreeMap::new();
967 map.insert(
968 SmolStr::new_static("clientVersion"),
969 LexObjectProperty::String(LexString {
970 description: Some(
971 CowStr::new_static(
972 "Version of the client when this progress was recorded",
973 ),
974 ),
975 ..Default::default()
976 }),
977 );
978 map.insert(
979 SmolStr::new_static("platform"),
980 LexObjectProperty::String(LexString {
981 description: Some(
982 CowStr::new_static(
983 "Platform where the level up occurred (web, mobile, etc.)",
984 ),
985 ),
986 ..Default::default()
987 }),
988 );
989 map
990 },
991 ..Default::default()
992 }),
993 );
994 map.insert(
995 SmolStr::new_static("stats"),
996 LexUserType::Object(LexObject {
997 description: Some(
998 CowStr::new_static("Game-specific statistics and metrics"),
999 ),
1000 properties: {
1001 #[allow(unused_mut)]
1002 let mut map = BTreeMap::new();
1003 map.insert(
1004 SmolStr::new_static("dailyRewardsClaimed"),
1005 LexObjectProperty::Integer(LexInteger {
1006 minimum: Some(0i64),
1007 ..Default::default()
1008 }),
1009 );
1010 map.insert(
1011 SmolStr::new_static("itemsCollected"),
1012 LexObjectProperty::Integer(LexInteger {
1013 minimum: Some(0i64),
1014 ..Default::default()
1015 }),
1016 );
1017 map.insert(
1018 SmolStr::new_static("lastPostReadDate"),
1019 LexObjectProperty::String(LexString {
1020 description: Some(
1021 CowStr::new_static(
1022 "Date when posts read today was last updated (for daily reset tracking)",
1023 ),
1024 ),
1025 format: Some(LexStringFormat::Datetime),
1026 ..Default::default()
1027 }),
1028 );
1029 map.insert(
1030 SmolStr::new_static("postsReadToday"),
1031 LexObjectProperty::Integer(LexInteger {
1032 minimum: Some(0i64),
1033 ..Default::default()
1034 }),
1035 );
1036 map.insert(
1037 SmolStr::new_static("postsReadTotal"),
1038 LexObjectProperty::Integer(LexInteger {
1039 minimum: Some(0i64),
1040 ..Default::default()
1041 }),
1042 );
1043 map.insert(
1044 SmolStr::new_static("postsViewed"),
1045 LexObjectProperty::Integer(LexInteger {
1046 minimum: Some(0i64),
1047 ..Default::default()
1048 }),
1049 );
1050 map.insert(
1051 SmolStr::new_static("shufflesPerformed"),
1052 LexObjectProperty::Integer(LexInteger {
1053 minimum: Some(0i64),
1054 ..Default::default()
1055 }),
1056 );
1057 map.insert(
1058 SmolStr::new_static("specimensCollected"),
1059 LexObjectProperty::Integer(LexInteger {
1060 minimum: Some(0i64),
1061 ..Default::default()
1062 }),
1063 );
1064 map
1065 },
1066 ..Default::default()
1067 }),
1068 );
1069 map
1070 },
1071 ..Default::default()
1072 }
1073}