1pub mod begin;
9pub mod get_config;
10pub mod get_state;
11
12
13#[allow(unused_imports)]
14use alloc::collections::BTreeMap;
15
16#[allow(unused_imports)]
17use core::marker::PhantomData;
18use jacquard_common::CowStr;
19
20#[allow(unused_imports)]
21use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
22use jacquard_common::types::string::Datetime;
23use jacquard_derive::{IntoStatic, lexicon, open_union};
24use jacquard_lexicon::lexicon::LexiconDoc;
25use jacquard_lexicon::schema::LexiconSchema;
26
27#[allow(unused_imports)]
28use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
29use serde::{Serialize, Deserialize};
30use crate::app_bsky::ageassurance;
31#[derive(Debug, Clone, PartialEq, Eq, Hash)]
34pub enum Access<'a> {
35 Unknown,
36 None,
37 Safe,
38 Full,
39 Other(CowStr<'a>),
40}
41
42impl<'a> Access<'a> {
43 pub fn as_str(&self) -> &str {
44 match self {
45 Self::Unknown => "unknown",
46 Self::None => "none",
47 Self::Safe => "safe",
48 Self::Full => "full",
49 Self::Other(s) => s.as_ref(),
50 }
51 }
52}
53
54impl<'a> From<&'a str> for Access<'a> {
55 fn from(s: &'a str) -> Self {
56 match s {
57 "unknown" => Self::Unknown,
58 "none" => Self::None,
59 "safe" => Self::Safe,
60 "full" => Self::Full,
61 _ => Self::Other(CowStr::from(s)),
62 }
63 }
64}
65
66impl<'a> From<String> for Access<'a> {
67 fn from(s: String) -> Self {
68 match s.as_str() {
69 "unknown" => Self::Unknown,
70 "none" => Self::None,
71 "safe" => Self::Safe,
72 "full" => Self::Full,
73 _ => Self::Other(CowStr::from(s)),
74 }
75 }
76}
77
78impl<'a> AsRef<str> for Access<'a> {
79 fn as_ref(&self) -> &str {
80 self.as_str()
81 }
82}
83
84impl<'a> core::fmt::Display for Access<'a> {
85 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
86 write!(f, "{}", self.as_str())
87 }
88}
89
90impl<'a> serde::Serialize for Access<'a> {
91 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
92 where
93 S: serde::Serializer,
94 {
95 serializer.serialize_str(self.as_str())
96 }
97}
98
99impl<'de, 'a> serde::Deserialize<'de> for Access<'a>
100where
101 'de: 'a,
102{
103 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
104 where
105 D: serde::Deserializer<'de>,
106 {
107 let s = <&'de str>::deserialize(deserializer)?;
108 Ok(Self::from(s))
109 }
110}
111
112impl jacquard_common::IntoStatic for Access<'_> {
113 type Output = Access<'static>;
114 fn into_static(self) -> Self::Output {
115 match self {
116 Access::Unknown => Access::Unknown,
117 Access::None => Access::None,
118 Access::Safe => Access::Safe,
119 Access::Full => Access::Full,
120 Access::Other(v) => Access::Other(v.into_static()),
121 }
122 }
123}
124
125#[lexicon]
128#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
129#[serde(rename_all = "camelCase")]
130pub struct Config<'a> {
131 #[serde(borrow)]
133 pub regions: Vec<ageassurance::ConfigRegion<'a>>,
134}
135
136#[lexicon]
139#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
140#[serde(rename_all = "camelCase")]
141pub struct ConfigRegion<'a> {
142 #[serde(borrow)]
144 pub country_code: CowStr<'a>,
145 pub min_access_age: i64,
147 #[serde(skip_serializing_if = "Option::is_none")]
149 #[serde(borrow)]
150 pub region_code: Option<CowStr<'a>>,
151 #[serde(borrow)]
153 pub rules: Vec<ConfigRegionRulesItem<'a>>,
154}
155
156
157#[open_union]
158#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
159#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
160pub enum ConfigRegionRulesItem<'a> {
161 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleDefault")]
162 ConfigRegionRuleDefault(Box<ageassurance::ConfigRegionRuleDefault<'a>>),
163 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge")]
164 ConfigRegionRuleIfDeclaredOverAge(
165 Box<ageassurance::ConfigRegionRuleIfDeclaredOverAge<'a>>,
166 ),
167 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge")]
168 ConfigRegionRuleIfDeclaredUnderAge(
169 Box<ageassurance::ConfigRegionRuleIfDeclaredUnderAge<'a>>,
170 ),
171 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge")]
172 ConfigRegionRuleIfAssuredOverAge(
173 Box<ageassurance::ConfigRegionRuleIfAssuredOverAge<'a>>,
174 ),
175 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge")]
176 ConfigRegionRuleIfAssuredUnderAge(
177 Box<ageassurance::ConfigRegionRuleIfAssuredUnderAge<'a>>,
178 ),
179 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan")]
180 ConfigRegionRuleIfAccountNewerThan(
181 Box<ageassurance::ConfigRegionRuleIfAccountNewerThan<'a>>,
182 ),
183 #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan")]
184 ConfigRegionRuleIfAccountOlderThan(
185 Box<ageassurance::ConfigRegionRuleIfAccountOlderThan<'a>>,
186 ),
187}
188
189#[lexicon]
192#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
193#[serde(rename_all = "camelCase")]
194pub struct ConfigRegionRuleDefault<'a> {
195 #[serde(borrow)]
196 pub access: ageassurance::Access<'a>,
197}
198
199#[lexicon]
202#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
203#[serde(rename_all = "camelCase")]
204pub struct ConfigRegionRuleIfAccountNewerThan<'a> {
205 #[serde(borrow)]
206 pub access: ageassurance::Access<'a>,
207 pub date: Datetime,
209}
210
211#[lexicon]
214#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
215#[serde(rename_all = "camelCase")]
216pub struct ConfigRegionRuleIfAccountOlderThan<'a> {
217 #[serde(borrow)]
218 pub access: ageassurance::Access<'a>,
219 pub date: Datetime,
221}
222
223#[lexicon]
226#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
227#[serde(rename_all = "camelCase")]
228pub struct ConfigRegionRuleIfAssuredOverAge<'a> {
229 #[serde(borrow)]
230 pub access: ageassurance::Access<'a>,
231 pub age: i64,
233}
234
235#[lexicon]
238#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
239#[serde(rename_all = "camelCase")]
240pub struct ConfigRegionRuleIfAssuredUnderAge<'a> {
241 #[serde(borrow)]
242 pub access: ageassurance::Access<'a>,
243 pub age: i64,
245}
246
247#[lexicon]
250#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
251#[serde(rename_all = "camelCase")]
252pub struct ConfigRegionRuleIfDeclaredOverAge<'a> {
253 #[serde(borrow)]
254 pub access: ageassurance::Access<'a>,
255 pub age: i64,
257}
258
259#[lexicon]
262#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
263#[serde(rename_all = "camelCase")]
264pub struct ConfigRegionRuleIfDeclaredUnderAge<'a> {
265 #[serde(borrow)]
266 pub access: ageassurance::Access<'a>,
267 pub age: i64,
269}
270
271#[lexicon]
274#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
275#[serde(rename_all = "camelCase")]
276pub struct Event<'a> {
277 #[serde(borrow)]
279 pub access: EventAccess<'a>,
280 #[serde(borrow)]
282 pub attempt_id: CowStr<'a>,
283 #[serde(skip_serializing_if = "Option::is_none")]
285 #[serde(borrow)]
286 pub complete_ip: Option<CowStr<'a>>,
287 #[serde(skip_serializing_if = "Option::is_none")]
289 #[serde(borrow)]
290 pub complete_ua: Option<CowStr<'a>>,
291 #[serde(borrow)]
293 pub country_code: CowStr<'a>,
294 pub created_at: Datetime,
296 #[serde(skip_serializing_if = "Option::is_none")]
298 #[serde(borrow)]
299 pub email: Option<CowStr<'a>>,
300 #[serde(skip_serializing_if = "Option::is_none")]
302 #[serde(borrow)]
303 pub init_ip: Option<CowStr<'a>>,
304 #[serde(skip_serializing_if = "Option::is_none")]
306 #[serde(borrow)]
307 pub init_ua: Option<CowStr<'a>>,
308 #[serde(skip_serializing_if = "Option::is_none")]
310 #[serde(borrow)]
311 pub region_code: Option<CowStr<'a>>,
312 #[serde(borrow)]
314 pub status: EventStatus<'a>,
315}
316
317#[derive(Debug, Clone, PartialEq, Eq, Hash)]
320pub enum EventAccess<'a> {
321 Unknown,
322 None,
323 Safe,
324 Full,
325 Other(CowStr<'a>),
326}
327
328impl<'a> EventAccess<'a> {
329 pub fn as_str(&self) -> &str {
330 match self {
331 Self::Unknown => "unknown",
332 Self::None => "none",
333 Self::Safe => "safe",
334 Self::Full => "full",
335 Self::Other(s) => s.as_ref(),
336 }
337 }
338}
339
340impl<'a> From<&'a str> for EventAccess<'a> {
341 fn from(s: &'a str) -> Self {
342 match s {
343 "unknown" => Self::Unknown,
344 "none" => Self::None,
345 "safe" => Self::Safe,
346 "full" => Self::Full,
347 _ => Self::Other(CowStr::from(s)),
348 }
349 }
350}
351
352impl<'a> From<String> for EventAccess<'a> {
353 fn from(s: String) -> Self {
354 match s.as_str() {
355 "unknown" => Self::Unknown,
356 "none" => Self::None,
357 "safe" => Self::Safe,
358 "full" => Self::Full,
359 _ => Self::Other(CowStr::from(s)),
360 }
361 }
362}
363
364impl<'a> core::fmt::Display for EventAccess<'a> {
365 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
366 write!(f, "{}", self.as_str())
367 }
368}
369
370impl<'a> AsRef<str> for EventAccess<'a> {
371 fn as_ref(&self) -> &str {
372 self.as_str()
373 }
374}
375
376impl<'a> serde::Serialize for EventAccess<'a> {
377 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
378 where
379 S: serde::Serializer,
380 {
381 serializer.serialize_str(self.as_str())
382 }
383}
384
385impl<'de, 'a> serde::Deserialize<'de> for EventAccess<'a>
386where
387 'de: 'a,
388{
389 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
390 where
391 D: serde::Deserializer<'de>,
392 {
393 let s = <&'de str>::deserialize(deserializer)?;
394 Ok(Self::from(s))
395 }
396}
397
398impl<'a> Default for EventAccess<'a> {
399 fn default() -> Self {
400 Self::Other(Default::default())
401 }
402}
403
404impl jacquard_common::IntoStatic for EventAccess<'_> {
405 type Output = EventAccess<'static>;
406 fn into_static(self) -> Self::Output {
407 match self {
408 EventAccess::Unknown => EventAccess::Unknown,
409 EventAccess::None => EventAccess::None,
410 EventAccess::Safe => EventAccess::Safe,
411 EventAccess::Full => EventAccess::Full,
412 EventAccess::Other(v) => EventAccess::Other(v.into_static()),
413 }
414 }
415}
416
417#[derive(Debug, Clone, PartialEq, Eq, Hash)]
420pub enum EventStatus<'a> {
421 Unknown,
422 Pending,
423 Assured,
424 Blocked,
425 Other(CowStr<'a>),
426}
427
428impl<'a> EventStatus<'a> {
429 pub fn as_str(&self) -> &str {
430 match self {
431 Self::Unknown => "unknown",
432 Self::Pending => "pending",
433 Self::Assured => "assured",
434 Self::Blocked => "blocked",
435 Self::Other(s) => s.as_ref(),
436 }
437 }
438}
439
440impl<'a> From<&'a str> for EventStatus<'a> {
441 fn from(s: &'a str) -> Self {
442 match s {
443 "unknown" => Self::Unknown,
444 "pending" => Self::Pending,
445 "assured" => Self::Assured,
446 "blocked" => Self::Blocked,
447 _ => Self::Other(CowStr::from(s)),
448 }
449 }
450}
451
452impl<'a> From<String> for EventStatus<'a> {
453 fn from(s: String) -> Self {
454 match s.as_str() {
455 "unknown" => Self::Unknown,
456 "pending" => Self::Pending,
457 "assured" => Self::Assured,
458 "blocked" => Self::Blocked,
459 _ => Self::Other(CowStr::from(s)),
460 }
461 }
462}
463
464impl<'a> core::fmt::Display for EventStatus<'a> {
465 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
466 write!(f, "{}", self.as_str())
467 }
468}
469
470impl<'a> AsRef<str> for EventStatus<'a> {
471 fn as_ref(&self) -> &str {
472 self.as_str()
473 }
474}
475
476impl<'a> serde::Serialize for EventStatus<'a> {
477 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
478 where
479 S: serde::Serializer,
480 {
481 serializer.serialize_str(self.as_str())
482 }
483}
484
485impl<'de, 'a> serde::Deserialize<'de> for EventStatus<'a>
486where
487 'de: 'a,
488{
489 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
490 where
491 D: serde::Deserializer<'de>,
492 {
493 let s = <&'de str>::deserialize(deserializer)?;
494 Ok(Self::from(s))
495 }
496}
497
498impl<'a> Default for EventStatus<'a> {
499 fn default() -> Self {
500 Self::Other(Default::default())
501 }
502}
503
504impl jacquard_common::IntoStatic for EventStatus<'_> {
505 type Output = EventStatus<'static>;
506 fn into_static(self) -> Self::Output {
507 match self {
508 EventStatus::Unknown => EventStatus::Unknown,
509 EventStatus::Pending => EventStatus::Pending,
510 EventStatus::Assured => EventStatus::Assured,
511 EventStatus::Blocked => EventStatus::Blocked,
512 EventStatus::Other(v) => EventStatus::Other(v.into_static()),
513 }
514 }
515}
516
517#[lexicon]
520#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
521#[serde(rename_all = "camelCase")]
522pub struct State<'a> {
523 #[serde(borrow)]
524 pub access: ageassurance::Access<'a>,
525 #[serde(skip_serializing_if = "Option::is_none")]
527 pub last_initiated_at: Option<Datetime>,
528 #[serde(borrow)]
529 pub status: ageassurance::Status<'a>,
530}
531
532#[lexicon]
535#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
536#[serde(rename_all = "camelCase")]
537pub struct StateMetadata<'a> {
538 #[serde(skip_serializing_if = "Option::is_none")]
540 pub account_created_at: Option<Datetime>,
541}
542
543#[derive(Debug, Clone, PartialEq, Eq, Hash)]
546pub enum Status<'a> {
547 Unknown,
548 Pending,
549 Assured,
550 Blocked,
551 Other(CowStr<'a>),
552}
553
554impl<'a> Status<'a> {
555 pub fn as_str(&self) -> &str {
556 match self {
557 Self::Unknown => "unknown",
558 Self::Pending => "pending",
559 Self::Assured => "assured",
560 Self::Blocked => "blocked",
561 Self::Other(s) => s.as_ref(),
562 }
563 }
564}
565
566impl<'a> From<&'a str> for Status<'a> {
567 fn from(s: &'a str) -> Self {
568 match s {
569 "unknown" => Self::Unknown,
570 "pending" => Self::Pending,
571 "assured" => Self::Assured,
572 "blocked" => Self::Blocked,
573 _ => Self::Other(CowStr::from(s)),
574 }
575 }
576}
577
578impl<'a> From<String> for Status<'a> {
579 fn from(s: String) -> Self {
580 match s.as_str() {
581 "unknown" => Self::Unknown,
582 "pending" => Self::Pending,
583 "assured" => Self::Assured,
584 "blocked" => Self::Blocked,
585 _ => Self::Other(CowStr::from(s)),
586 }
587 }
588}
589
590impl<'a> AsRef<str> for Status<'a> {
591 fn as_ref(&self) -> &str {
592 self.as_str()
593 }
594}
595
596impl<'a> core::fmt::Display for Status<'a> {
597 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
598 write!(f, "{}", self.as_str())
599 }
600}
601
602impl<'a> serde::Serialize for Status<'a> {
603 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
604 where
605 S: serde::Serializer,
606 {
607 serializer.serialize_str(self.as_str())
608 }
609}
610
611impl<'de, 'a> serde::Deserialize<'de> for Status<'a>
612where
613 'de: 'a,
614{
615 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
616 where
617 D: serde::Deserializer<'de>,
618 {
619 let s = <&'de str>::deserialize(deserializer)?;
620 Ok(Self::from(s))
621 }
622}
623
624impl jacquard_common::IntoStatic for Status<'_> {
625 type Output = Status<'static>;
626 fn into_static(self) -> Self::Output {
627 match self {
628 Status::Unknown => Status::Unknown,
629 Status::Pending => Status::Pending,
630 Status::Assured => Status::Assured,
631 Status::Blocked => Status::Blocked,
632 Status::Other(v) => Status::Other(v.into_static()),
633 }
634 }
635}
636
637impl<'a> LexiconSchema for Config<'a> {
638 fn nsid() -> &'static str {
639 "app.bsky.ageassurance.defs"
640 }
641 fn def_name() -> &'static str {
642 "config"
643 }
644 fn lexicon_doc() -> LexiconDoc<'static> {
645 lexicon_doc_app_bsky_ageassurance_defs()
646 }
647 fn validate(&self) -> Result<(), ConstraintError> {
648 Ok(())
649 }
650}
651
652impl<'a> LexiconSchema for ConfigRegion<'a> {
653 fn nsid() -> &'static str {
654 "app.bsky.ageassurance.defs"
655 }
656 fn def_name() -> &'static str {
657 "configRegion"
658 }
659 fn lexicon_doc() -> LexiconDoc<'static> {
660 lexicon_doc_app_bsky_ageassurance_defs()
661 }
662 fn validate(&self) -> Result<(), ConstraintError> {
663 Ok(())
664 }
665}
666
667impl<'a> LexiconSchema for ConfigRegionRuleDefault<'a> {
668 fn nsid() -> &'static str {
669 "app.bsky.ageassurance.defs"
670 }
671 fn def_name() -> &'static str {
672 "configRegionRuleDefault"
673 }
674 fn lexicon_doc() -> LexiconDoc<'static> {
675 lexicon_doc_app_bsky_ageassurance_defs()
676 }
677 fn validate(&self) -> Result<(), ConstraintError> {
678 Ok(())
679 }
680}
681
682impl<'a> LexiconSchema for ConfigRegionRuleIfAccountNewerThan<'a> {
683 fn nsid() -> &'static str {
684 "app.bsky.ageassurance.defs"
685 }
686 fn def_name() -> &'static str {
687 "configRegionRuleIfAccountNewerThan"
688 }
689 fn lexicon_doc() -> LexiconDoc<'static> {
690 lexicon_doc_app_bsky_ageassurance_defs()
691 }
692 fn validate(&self) -> Result<(), ConstraintError> {
693 Ok(())
694 }
695}
696
697impl<'a> LexiconSchema for ConfigRegionRuleIfAccountOlderThan<'a> {
698 fn nsid() -> &'static str {
699 "app.bsky.ageassurance.defs"
700 }
701 fn def_name() -> &'static str {
702 "configRegionRuleIfAccountOlderThan"
703 }
704 fn lexicon_doc() -> LexiconDoc<'static> {
705 lexicon_doc_app_bsky_ageassurance_defs()
706 }
707 fn validate(&self) -> Result<(), ConstraintError> {
708 Ok(())
709 }
710}
711
712impl<'a> LexiconSchema for ConfigRegionRuleIfAssuredOverAge<'a> {
713 fn nsid() -> &'static str {
714 "app.bsky.ageassurance.defs"
715 }
716 fn def_name() -> &'static str {
717 "configRegionRuleIfAssuredOverAge"
718 }
719 fn lexicon_doc() -> LexiconDoc<'static> {
720 lexicon_doc_app_bsky_ageassurance_defs()
721 }
722 fn validate(&self) -> Result<(), ConstraintError> {
723 Ok(())
724 }
725}
726
727impl<'a> LexiconSchema for ConfigRegionRuleIfAssuredUnderAge<'a> {
728 fn nsid() -> &'static str {
729 "app.bsky.ageassurance.defs"
730 }
731 fn def_name() -> &'static str {
732 "configRegionRuleIfAssuredUnderAge"
733 }
734 fn lexicon_doc() -> LexiconDoc<'static> {
735 lexicon_doc_app_bsky_ageassurance_defs()
736 }
737 fn validate(&self) -> Result<(), ConstraintError> {
738 Ok(())
739 }
740}
741
742impl<'a> LexiconSchema for ConfigRegionRuleIfDeclaredOverAge<'a> {
743 fn nsid() -> &'static str {
744 "app.bsky.ageassurance.defs"
745 }
746 fn def_name() -> &'static str {
747 "configRegionRuleIfDeclaredOverAge"
748 }
749 fn lexicon_doc() -> LexiconDoc<'static> {
750 lexicon_doc_app_bsky_ageassurance_defs()
751 }
752 fn validate(&self) -> Result<(), ConstraintError> {
753 Ok(())
754 }
755}
756
757impl<'a> LexiconSchema for ConfigRegionRuleIfDeclaredUnderAge<'a> {
758 fn nsid() -> &'static str {
759 "app.bsky.ageassurance.defs"
760 }
761 fn def_name() -> &'static str {
762 "configRegionRuleIfDeclaredUnderAge"
763 }
764 fn lexicon_doc() -> LexiconDoc<'static> {
765 lexicon_doc_app_bsky_ageassurance_defs()
766 }
767 fn validate(&self) -> Result<(), ConstraintError> {
768 Ok(())
769 }
770}
771
772impl<'a> LexiconSchema for Event<'a> {
773 fn nsid() -> &'static str {
774 "app.bsky.ageassurance.defs"
775 }
776 fn def_name() -> &'static str {
777 "event"
778 }
779 fn lexicon_doc() -> LexiconDoc<'static> {
780 lexicon_doc_app_bsky_ageassurance_defs()
781 }
782 fn validate(&self) -> Result<(), ConstraintError> {
783 Ok(())
784 }
785}
786
787impl<'a> LexiconSchema for State<'a> {
788 fn nsid() -> &'static str {
789 "app.bsky.ageassurance.defs"
790 }
791 fn def_name() -> &'static str {
792 "state"
793 }
794 fn lexicon_doc() -> LexiconDoc<'static> {
795 lexicon_doc_app_bsky_ageassurance_defs()
796 }
797 fn validate(&self) -> Result<(), ConstraintError> {
798 Ok(())
799 }
800}
801
802impl<'a> LexiconSchema for StateMetadata<'a> {
803 fn nsid() -> &'static str {
804 "app.bsky.ageassurance.defs"
805 }
806 fn def_name() -> &'static str {
807 "stateMetadata"
808 }
809 fn lexicon_doc() -> LexiconDoc<'static> {
810 lexicon_doc_app_bsky_ageassurance_defs()
811 }
812 fn validate(&self) -> Result<(), ConstraintError> {
813 Ok(())
814 }
815}
816
817pub mod config_state {
818
819 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
820 #[allow(unused)]
821 use ::core::marker::PhantomData;
822 mod sealed {
823 pub trait Sealed {}
824 }
825 pub trait State: sealed::Sealed {
827 type Regions;
828 }
829 pub struct Empty(());
831 impl sealed::Sealed for Empty {}
832 impl State for Empty {
833 type Regions = Unset;
834 }
835 pub struct SetRegions<S: State = Empty>(PhantomData<fn() -> S>);
837 impl<S: State> sealed::Sealed for SetRegions<S> {}
838 impl<S: State> State for SetRegions<S> {
839 type Regions = Set<members::regions>;
840 }
841 #[allow(non_camel_case_types)]
843 pub mod members {
844 pub struct regions(());
846 }
847}
848
849pub struct ConfigBuilder<'a, S: config_state::State> {
851 _state: PhantomData<fn() -> S>,
852 _fields: (Option<Vec<ageassurance::ConfigRegion<'a>>>,),
853 _lifetime: PhantomData<&'a ()>,
854}
855
856impl<'a> Config<'a> {
857 pub fn new() -> ConfigBuilder<'a, config_state::Empty> {
859 ConfigBuilder::new()
860 }
861}
862
863impl<'a> ConfigBuilder<'a, config_state::Empty> {
864 pub fn new() -> Self {
866 ConfigBuilder {
867 _state: PhantomData,
868 _fields: (None,),
869 _lifetime: PhantomData,
870 }
871 }
872}
873
874impl<'a, S> ConfigBuilder<'a, S>
875where
876 S: config_state::State,
877 S::Regions: config_state::IsUnset,
878{
879 pub fn regions(
881 mut self,
882 value: impl Into<Vec<ageassurance::ConfigRegion<'a>>>,
883 ) -> ConfigBuilder<'a, config_state::SetRegions<S>> {
884 self._fields.0 = Option::Some(value.into());
885 ConfigBuilder {
886 _state: PhantomData,
887 _fields: self._fields,
888 _lifetime: PhantomData,
889 }
890 }
891}
892
893impl<'a, S> ConfigBuilder<'a, S>
894where
895 S: config_state::State,
896 S::Regions: config_state::IsSet,
897{
898 pub fn build(self) -> Config<'a> {
900 Config {
901 regions: self._fields.0.unwrap(),
902 extra_data: Default::default(),
903 }
904 }
905 pub fn build_with_data(
907 self,
908 extra_data: BTreeMap<
909 jacquard_common::deps::smol_str::SmolStr,
910 jacquard_common::types::value::Data<'a>,
911 >,
912 ) -> Config<'a> {
913 Config {
914 regions: self._fields.0.unwrap(),
915 extra_data: Some(extra_data),
916 }
917 }
918}
919
920fn lexicon_doc_app_bsky_ageassurance_defs() -> LexiconDoc<'static> {
921 #[allow(unused_imports)]
922 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
923 use jacquard_lexicon::lexicon::*;
924 use alloc::collections::BTreeMap;
925 LexiconDoc {
926 lexicon: Lexicon::Lexicon1,
927 id: CowStr::new_static("app.bsky.ageassurance.defs"),
928 defs: {
929 let mut map = BTreeMap::new();
930 map.insert(
931 SmolStr::new_static("access"),
932 LexUserType::String(LexString {
933 description: Some(
934 CowStr::new_static(
935 "The access level granted based on Age Assurance data we've processed.",
936 ),
937 ),
938 ..Default::default()
939 }),
940 );
941 map.insert(
942 SmolStr::new_static("config"),
943 LexUserType::Object(LexObject {
944 description: Some(CowStr::new_static("")),
945 required: Some(vec![SmolStr::new_static("regions")]),
946 properties: {
947 #[allow(unused_mut)]
948 let mut map = BTreeMap::new();
949 map.insert(
950 SmolStr::new_static("regions"),
951 LexObjectProperty::Array(LexArray {
952 description: Some(
953 CowStr::new_static(
954 "The per-region Age Assurance configuration.",
955 ),
956 ),
957 items: LexArrayItem::Ref(LexRef {
958 r#ref: CowStr::new_static(
959 "app.bsky.ageassurance.defs#configRegion",
960 ),
961 ..Default::default()
962 }),
963 ..Default::default()
964 }),
965 );
966 map
967 },
968 ..Default::default()
969 }),
970 );
971 map.insert(
972 SmolStr::new_static("configRegion"),
973 LexUserType::Object(LexObject {
974 description: Some(
975 CowStr::new_static(
976 "The Age Assurance configuration for a specific region.",
977 ),
978 ),
979 required: Some(
980 vec![
981 SmolStr::new_static("countryCode"),
982 SmolStr::new_static("minAccessAge"),
983 SmolStr::new_static("rules")
984 ],
985 ),
986 properties: {
987 #[allow(unused_mut)]
988 let mut map = BTreeMap::new();
989 map.insert(
990 SmolStr::new_static("countryCode"),
991 LexObjectProperty::String(LexString {
992 description: Some(
993 CowStr::new_static(
994 "The ISO 3166-1 alpha-2 country code this configuration applies to.",
995 ),
996 ),
997 ..Default::default()
998 }),
999 );
1000 map.insert(
1001 SmolStr::new_static("minAccessAge"),
1002 LexObjectProperty::Integer(LexInteger {
1003 ..Default::default()
1004 }),
1005 );
1006 map.insert(
1007 SmolStr::new_static("regionCode"),
1008 LexObjectProperty::String(LexString {
1009 description: Some(
1010 CowStr::new_static(
1011 "The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country.",
1012 ),
1013 ),
1014 ..Default::default()
1015 }),
1016 );
1017 map.insert(
1018 SmolStr::new_static("rules"),
1019 LexObjectProperty::Array(LexArray {
1020 description: Some(
1021 CowStr::new_static(
1022 "The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item.",
1023 ),
1024 ),
1025 items: LexArrayItem::Union(LexRefUnion {
1026 refs: vec![
1027 CowStr::new_static("#configRegionRuleDefault"),
1028 CowStr::new_static("#configRegionRuleIfDeclaredOverAge"),
1029 CowStr::new_static("#configRegionRuleIfDeclaredUnderAge"),
1030 CowStr::new_static("#configRegionRuleIfAssuredOverAge"),
1031 CowStr::new_static("#configRegionRuleIfAssuredUnderAge"),
1032 CowStr::new_static("#configRegionRuleIfAccountNewerThan"),
1033 CowStr::new_static("#configRegionRuleIfAccountOlderThan")
1034 ],
1035 ..Default::default()
1036 }),
1037 ..Default::default()
1038 }),
1039 );
1040 map
1041 },
1042 ..Default::default()
1043 }),
1044 );
1045 map.insert(
1046 SmolStr::new_static("configRegionRuleDefault"),
1047 LexUserType::Object(LexObject {
1048 description: Some(
1049 CowStr::new_static("Age Assurance rule that applies by default."),
1050 ),
1051 required: Some(vec![SmolStr::new_static("access")]),
1052 properties: {
1053 #[allow(unused_mut)]
1054 let mut map = BTreeMap::new();
1055 map.insert(
1056 SmolStr::new_static("access"),
1057 LexObjectProperty::Ref(LexRef {
1058 r#ref: CowStr::new_static(
1059 "app.bsky.ageassurance.defs#access",
1060 ),
1061 ..Default::default()
1062 }),
1063 );
1064 map
1065 },
1066 ..Default::default()
1067 }),
1068 );
1069 map.insert(
1070 SmolStr::new_static("configRegionRuleIfAccountNewerThan"),
1071 LexUserType::Object(LexObject {
1072 description: Some(
1073 CowStr::new_static(
1074 "Age Assurance rule that applies if the account is equal-to or newer than a certain date.",
1075 ),
1076 ),
1077 required: Some(
1078 vec![SmolStr::new_static("date"), SmolStr::new_static("access")],
1079 ),
1080 properties: {
1081 #[allow(unused_mut)]
1082 let mut map = BTreeMap::new();
1083 map.insert(
1084 SmolStr::new_static("access"),
1085 LexObjectProperty::Ref(LexRef {
1086 r#ref: CowStr::new_static(
1087 "app.bsky.ageassurance.defs#access",
1088 ),
1089 ..Default::default()
1090 }),
1091 );
1092 map.insert(
1093 SmolStr::new_static("date"),
1094 LexObjectProperty::String(LexString {
1095 description: Some(
1096 CowStr::new_static(
1097 "The date threshold as a datetime string.",
1098 ),
1099 ),
1100 format: Some(LexStringFormat::Datetime),
1101 ..Default::default()
1102 }),
1103 );
1104 map
1105 },
1106 ..Default::default()
1107 }),
1108 );
1109 map.insert(
1110 SmolStr::new_static("configRegionRuleIfAccountOlderThan"),
1111 LexUserType::Object(LexObject {
1112 description: Some(
1113 CowStr::new_static(
1114 "Age Assurance rule that applies if the account is older than a certain date.",
1115 ),
1116 ),
1117 required: Some(
1118 vec![SmolStr::new_static("date"), SmolStr::new_static("access")],
1119 ),
1120 properties: {
1121 #[allow(unused_mut)]
1122 let mut map = BTreeMap::new();
1123 map.insert(
1124 SmolStr::new_static("access"),
1125 LexObjectProperty::Ref(LexRef {
1126 r#ref: CowStr::new_static(
1127 "app.bsky.ageassurance.defs#access",
1128 ),
1129 ..Default::default()
1130 }),
1131 );
1132 map.insert(
1133 SmolStr::new_static("date"),
1134 LexObjectProperty::String(LexString {
1135 description: Some(
1136 CowStr::new_static(
1137 "The date threshold as a datetime string.",
1138 ),
1139 ),
1140 format: Some(LexStringFormat::Datetime),
1141 ..Default::default()
1142 }),
1143 );
1144 map
1145 },
1146 ..Default::default()
1147 }),
1148 );
1149 map.insert(
1150 SmolStr::new_static("configRegionRuleIfAssuredOverAge"),
1151 LexUserType::Object(LexObject {
1152 description: Some(
1153 CowStr::new_static(
1154 "Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age.",
1155 ),
1156 ),
1157 required: Some(
1158 vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
1159 ),
1160 properties: {
1161 #[allow(unused_mut)]
1162 let mut map = BTreeMap::new();
1163 map.insert(
1164 SmolStr::new_static("access"),
1165 LexObjectProperty::Ref(LexRef {
1166 r#ref: CowStr::new_static(
1167 "app.bsky.ageassurance.defs#access",
1168 ),
1169 ..Default::default()
1170 }),
1171 );
1172 map.insert(
1173 SmolStr::new_static("age"),
1174 LexObjectProperty::Integer(LexInteger {
1175 ..Default::default()
1176 }),
1177 );
1178 map
1179 },
1180 ..Default::default()
1181 }),
1182 );
1183 map.insert(
1184 SmolStr::new_static("configRegionRuleIfAssuredUnderAge"),
1185 LexUserType::Object(LexObject {
1186 description: Some(
1187 CowStr::new_static(
1188 "Age Assurance rule that applies if the user has been assured to be under a certain age.",
1189 ),
1190 ),
1191 required: Some(
1192 vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
1193 ),
1194 properties: {
1195 #[allow(unused_mut)]
1196 let mut map = BTreeMap::new();
1197 map.insert(
1198 SmolStr::new_static("access"),
1199 LexObjectProperty::Ref(LexRef {
1200 r#ref: CowStr::new_static(
1201 "app.bsky.ageassurance.defs#access",
1202 ),
1203 ..Default::default()
1204 }),
1205 );
1206 map.insert(
1207 SmolStr::new_static("age"),
1208 LexObjectProperty::Integer(LexInteger {
1209 ..Default::default()
1210 }),
1211 );
1212 map
1213 },
1214 ..Default::default()
1215 }),
1216 );
1217 map.insert(
1218 SmolStr::new_static("configRegionRuleIfDeclaredOverAge"),
1219 LexUserType::Object(LexObject {
1220 description: Some(
1221 CowStr::new_static(
1222 "Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age.",
1223 ),
1224 ),
1225 required: Some(
1226 vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
1227 ),
1228 properties: {
1229 #[allow(unused_mut)]
1230 let mut map = BTreeMap::new();
1231 map.insert(
1232 SmolStr::new_static("access"),
1233 LexObjectProperty::Ref(LexRef {
1234 r#ref: CowStr::new_static(
1235 "app.bsky.ageassurance.defs#access",
1236 ),
1237 ..Default::default()
1238 }),
1239 );
1240 map.insert(
1241 SmolStr::new_static("age"),
1242 LexObjectProperty::Integer(LexInteger {
1243 ..Default::default()
1244 }),
1245 );
1246 map
1247 },
1248 ..Default::default()
1249 }),
1250 );
1251 map.insert(
1252 SmolStr::new_static("configRegionRuleIfDeclaredUnderAge"),
1253 LexUserType::Object(LexObject {
1254 description: Some(
1255 CowStr::new_static(
1256 "Age Assurance rule that applies if the user has declared themselves under a certain age.",
1257 ),
1258 ),
1259 required: Some(
1260 vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
1261 ),
1262 properties: {
1263 #[allow(unused_mut)]
1264 let mut map = BTreeMap::new();
1265 map.insert(
1266 SmolStr::new_static("access"),
1267 LexObjectProperty::Ref(LexRef {
1268 r#ref: CowStr::new_static(
1269 "app.bsky.ageassurance.defs#access",
1270 ),
1271 ..Default::default()
1272 }),
1273 );
1274 map.insert(
1275 SmolStr::new_static("age"),
1276 LexObjectProperty::Integer(LexInteger {
1277 ..Default::default()
1278 }),
1279 );
1280 map
1281 },
1282 ..Default::default()
1283 }),
1284 );
1285 map.insert(
1286 SmolStr::new_static("event"),
1287 LexUserType::Object(LexObject {
1288 description: Some(
1289 CowStr::new_static(
1290 "Object used to store Age Assurance data in stash.",
1291 ),
1292 ),
1293 required: Some(
1294 vec![
1295 SmolStr::new_static("createdAt"),
1296 SmolStr::new_static("status"), SmolStr::new_static("access"),
1297 SmolStr::new_static("attemptId"),
1298 SmolStr::new_static("countryCode")
1299 ],
1300 ),
1301 properties: {
1302 #[allow(unused_mut)]
1303 let mut map = BTreeMap::new();
1304 map.insert(
1305 SmolStr::new_static("access"),
1306 LexObjectProperty::String(LexString {
1307 description: Some(
1308 CowStr::new_static(
1309 "The access level granted based on Age Assurance data we've processed.",
1310 ),
1311 ),
1312 ..Default::default()
1313 }),
1314 );
1315 map.insert(
1316 SmolStr::new_static("attemptId"),
1317 LexObjectProperty::String(LexString {
1318 description: Some(
1319 CowStr::new_static(
1320 "The unique identifier for this instance of the Age Assurance flow, in UUID format.",
1321 ),
1322 ),
1323 ..Default::default()
1324 }),
1325 );
1326 map.insert(
1327 SmolStr::new_static("completeIp"),
1328 LexObjectProperty::String(LexString {
1329 description: Some(
1330 CowStr::new_static(
1331 "The IP address used when completing the Age Assurance flow.",
1332 ),
1333 ),
1334 ..Default::default()
1335 }),
1336 );
1337 map.insert(
1338 SmolStr::new_static("completeUa"),
1339 LexObjectProperty::String(LexString {
1340 description: Some(
1341 CowStr::new_static(
1342 "The user agent used when completing the Age Assurance flow.",
1343 ),
1344 ),
1345 ..Default::default()
1346 }),
1347 );
1348 map.insert(
1349 SmolStr::new_static("countryCode"),
1350 LexObjectProperty::String(LexString {
1351 description: Some(
1352 CowStr::new_static(
1353 "The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.",
1354 ),
1355 ),
1356 ..Default::default()
1357 }),
1358 );
1359 map.insert(
1360 SmolStr::new_static("createdAt"),
1361 LexObjectProperty::String(LexString {
1362 description: Some(
1363 CowStr::new_static(
1364 "The date and time of this write operation.",
1365 ),
1366 ),
1367 format: Some(LexStringFormat::Datetime),
1368 ..Default::default()
1369 }),
1370 );
1371 map.insert(
1372 SmolStr::new_static("email"),
1373 LexObjectProperty::String(LexString {
1374 description: Some(
1375 CowStr::new_static("The email used for Age Assurance."),
1376 ),
1377 ..Default::default()
1378 }),
1379 );
1380 map.insert(
1381 SmolStr::new_static("initIp"),
1382 LexObjectProperty::String(LexString {
1383 description: Some(
1384 CowStr::new_static(
1385 "The IP address used when initiating the Age Assurance flow.",
1386 ),
1387 ),
1388 ..Default::default()
1389 }),
1390 );
1391 map.insert(
1392 SmolStr::new_static("initUa"),
1393 LexObjectProperty::String(LexString {
1394 description: Some(
1395 CowStr::new_static(
1396 "The user agent used when initiating the Age Assurance flow.",
1397 ),
1398 ),
1399 ..Default::default()
1400 }),
1401 );
1402 map.insert(
1403 SmolStr::new_static("regionCode"),
1404 LexObjectProperty::String(LexString {
1405 description: Some(
1406 CowStr::new_static(
1407 "The ISO 3166-2 region code provided when beginning the Age Assurance flow.",
1408 ),
1409 ),
1410 ..Default::default()
1411 }),
1412 );
1413 map.insert(
1414 SmolStr::new_static("status"),
1415 LexObjectProperty::String(LexString {
1416 description: Some(
1417 CowStr::new_static(
1418 "The status of the Age Assurance process.",
1419 ),
1420 ),
1421 ..Default::default()
1422 }),
1423 );
1424 map
1425 },
1426 ..Default::default()
1427 }),
1428 );
1429 map.insert(
1430 SmolStr::new_static("state"),
1431 LexUserType::Object(LexObject {
1432 description: Some(
1433 CowStr::new_static("The user's computed Age Assurance state."),
1434 ),
1435 required: Some(
1436 vec![
1437 SmolStr::new_static("status"), SmolStr::new_static("access")
1438 ],
1439 ),
1440 properties: {
1441 #[allow(unused_mut)]
1442 let mut map = BTreeMap::new();
1443 map.insert(
1444 SmolStr::new_static("access"),
1445 LexObjectProperty::Ref(LexRef {
1446 r#ref: CowStr::new_static(
1447 "app.bsky.ageassurance.defs#access",
1448 ),
1449 ..Default::default()
1450 }),
1451 );
1452 map.insert(
1453 SmolStr::new_static("lastInitiatedAt"),
1454 LexObjectProperty::String(LexString {
1455 description: Some(
1456 CowStr::new_static(
1457 "The timestamp when this state was last updated.",
1458 ),
1459 ),
1460 format: Some(LexStringFormat::Datetime),
1461 ..Default::default()
1462 }),
1463 );
1464 map.insert(
1465 SmolStr::new_static("status"),
1466 LexObjectProperty::Ref(LexRef {
1467 r#ref: CowStr::new_static(
1468 "app.bsky.ageassurance.defs#status",
1469 ),
1470 ..Default::default()
1471 }),
1472 );
1473 map
1474 },
1475 ..Default::default()
1476 }),
1477 );
1478 map.insert(
1479 SmolStr::new_static("stateMetadata"),
1480 LexUserType::Object(LexObject {
1481 description: Some(
1482 CowStr::new_static(
1483 "Additional metadata needed to compute Age Assurance state client-side.",
1484 ),
1485 ),
1486 required: Some(vec![]),
1487 properties: {
1488 #[allow(unused_mut)]
1489 let mut map = BTreeMap::new();
1490 map.insert(
1491 SmolStr::new_static("accountCreatedAt"),
1492 LexObjectProperty::String(LexString {
1493 description: Some(
1494 CowStr::new_static("The account creation timestamp."),
1495 ),
1496 format: Some(LexStringFormat::Datetime),
1497 ..Default::default()
1498 }),
1499 );
1500 map
1501 },
1502 ..Default::default()
1503 }),
1504 );
1505 map.insert(
1506 SmolStr::new_static("status"),
1507 LexUserType::String(LexString {
1508 description: Some(
1509 CowStr::new_static("The status of the Age Assurance process."),
1510 ),
1511 ..Default::default()
1512 }),
1513 );
1514 map
1515 },
1516 ..Default::default()
1517 }
1518}
1519
1520pub mod config_region_state {
1521
1522 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1523 #[allow(unused)]
1524 use ::core::marker::PhantomData;
1525 mod sealed {
1526 pub trait Sealed {}
1527 }
1528 pub trait State: sealed::Sealed {
1530 type Rules;
1531 type CountryCode;
1532 type MinAccessAge;
1533 }
1534 pub struct Empty(());
1536 impl sealed::Sealed for Empty {}
1537 impl State for Empty {
1538 type Rules = Unset;
1539 type CountryCode = Unset;
1540 type MinAccessAge = Unset;
1541 }
1542 pub struct SetRules<S: State = Empty>(PhantomData<fn() -> S>);
1544 impl<S: State> sealed::Sealed for SetRules<S> {}
1545 impl<S: State> State for SetRules<S> {
1546 type Rules = Set<members::rules>;
1547 type CountryCode = S::CountryCode;
1548 type MinAccessAge = S::MinAccessAge;
1549 }
1550 pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
1552 impl<S: State> sealed::Sealed for SetCountryCode<S> {}
1553 impl<S: State> State for SetCountryCode<S> {
1554 type Rules = S::Rules;
1555 type CountryCode = Set<members::country_code>;
1556 type MinAccessAge = S::MinAccessAge;
1557 }
1558 pub struct SetMinAccessAge<S: State = Empty>(PhantomData<fn() -> S>);
1560 impl<S: State> sealed::Sealed for SetMinAccessAge<S> {}
1561 impl<S: State> State for SetMinAccessAge<S> {
1562 type Rules = S::Rules;
1563 type CountryCode = S::CountryCode;
1564 type MinAccessAge = Set<members::min_access_age>;
1565 }
1566 #[allow(non_camel_case_types)]
1568 pub mod members {
1569 pub struct rules(());
1571 pub struct country_code(());
1573 pub struct min_access_age(());
1575 }
1576}
1577
1578pub struct ConfigRegionBuilder<'a, S: config_region_state::State> {
1580 _state: PhantomData<fn() -> S>,
1581 _fields: (
1582 Option<CowStr<'a>>,
1583 Option<i64>,
1584 Option<CowStr<'a>>,
1585 Option<Vec<ConfigRegionRulesItem<'a>>>,
1586 ),
1587 _lifetime: PhantomData<&'a ()>,
1588}
1589
1590impl<'a> ConfigRegion<'a> {
1591 pub fn new() -> ConfigRegionBuilder<'a, config_region_state::Empty> {
1593 ConfigRegionBuilder::new()
1594 }
1595}
1596
1597impl<'a> ConfigRegionBuilder<'a, config_region_state::Empty> {
1598 pub fn new() -> Self {
1600 ConfigRegionBuilder {
1601 _state: PhantomData,
1602 _fields: (None, None, None, None),
1603 _lifetime: PhantomData,
1604 }
1605 }
1606}
1607
1608impl<'a, S> ConfigRegionBuilder<'a, S>
1609where
1610 S: config_region_state::State,
1611 S::CountryCode: config_region_state::IsUnset,
1612{
1613 pub fn country_code(
1615 mut self,
1616 value: impl Into<CowStr<'a>>,
1617 ) -> ConfigRegionBuilder<'a, config_region_state::SetCountryCode<S>> {
1618 self._fields.0 = Option::Some(value.into());
1619 ConfigRegionBuilder {
1620 _state: PhantomData,
1621 _fields: self._fields,
1622 _lifetime: PhantomData,
1623 }
1624 }
1625}
1626
1627impl<'a, S> ConfigRegionBuilder<'a, S>
1628where
1629 S: config_region_state::State,
1630 S::MinAccessAge: config_region_state::IsUnset,
1631{
1632 pub fn min_access_age(
1634 mut self,
1635 value: impl Into<i64>,
1636 ) -> ConfigRegionBuilder<'a, config_region_state::SetMinAccessAge<S>> {
1637 self._fields.1 = Option::Some(value.into());
1638 ConfigRegionBuilder {
1639 _state: PhantomData,
1640 _fields: self._fields,
1641 _lifetime: PhantomData,
1642 }
1643 }
1644}
1645
1646impl<'a, S: config_region_state::State> ConfigRegionBuilder<'a, S> {
1647 pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
1649 self._fields.2 = value.into();
1650 self
1651 }
1652 pub fn maybe_region_code(mut self, value: Option<CowStr<'a>>) -> Self {
1654 self._fields.2 = value;
1655 self
1656 }
1657}
1658
1659impl<'a, S> ConfigRegionBuilder<'a, S>
1660where
1661 S: config_region_state::State,
1662 S::Rules: config_region_state::IsUnset,
1663{
1664 pub fn rules(
1666 mut self,
1667 value: impl Into<Vec<ConfigRegionRulesItem<'a>>>,
1668 ) -> ConfigRegionBuilder<'a, config_region_state::SetRules<S>> {
1669 self._fields.3 = Option::Some(value.into());
1670 ConfigRegionBuilder {
1671 _state: PhantomData,
1672 _fields: self._fields,
1673 _lifetime: PhantomData,
1674 }
1675 }
1676}
1677
1678impl<'a, S> ConfigRegionBuilder<'a, S>
1679where
1680 S: config_region_state::State,
1681 S::Rules: config_region_state::IsSet,
1682 S::CountryCode: config_region_state::IsSet,
1683 S::MinAccessAge: config_region_state::IsSet,
1684{
1685 pub fn build(self) -> ConfigRegion<'a> {
1687 ConfigRegion {
1688 country_code: self._fields.0.unwrap(),
1689 min_access_age: self._fields.1.unwrap(),
1690 region_code: self._fields.2,
1691 rules: self._fields.3.unwrap(),
1692 extra_data: Default::default(),
1693 }
1694 }
1695 pub fn build_with_data(
1697 self,
1698 extra_data: BTreeMap<
1699 jacquard_common::deps::smol_str::SmolStr,
1700 jacquard_common::types::value::Data<'a>,
1701 >,
1702 ) -> ConfigRegion<'a> {
1703 ConfigRegion {
1704 country_code: self._fields.0.unwrap(),
1705 min_access_age: self._fields.1.unwrap(),
1706 region_code: self._fields.2,
1707 rules: self._fields.3.unwrap(),
1708 extra_data: Some(extra_data),
1709 }
1710 }
1711}
1712
1713pub mod config_region_rule_default_state {
1714
1715 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1716 #[allow(unused)]
1717 use ::core::marker::PhantomData;
1718 mod sealed {
1719 pub trait Sealed {}
1720 }
1721 pub trait State: sealed::Sealed {
1723 type Access;
1724 }
1725 pub struct Empty(());
1727 impl sealed::Sealed for Empty {}
1728 impl State for Empty {
1729 type Access = Unset;
1730 }
1731 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
1733 impl<S: State> sealed::Sealed for SetAccess<S> {}
1734 impl<S: State> State for SetAccess<S> {
1735 type Access = Set<members::access>;
1736 }
1737 #[allow(non_camel_case_types)]
1739 pub mod members {
1740 pub struct access(());
1742 }
1743}
1744
1745pub struct ConfigRegionRuleDefaultBuilder<
1747 'a,
1748 S: config_region_rule_default_state::State,
1749> {
1750 _state: PhantomData<fn() -> S>,
1751 _fields: (Option<ageassurance::Access<'a>>,),
1752 _lifetime: PhantomData<&'a ()>,
1753}
1754
1755impl<'a> ConfigRegionRuleDefault<'a> {
1756 pub fn new() -> ConfigRegionRuleDefaultBuilder<
1758 'a,
1759 config_region_rule_default_state::Empty,
1760 > {
1761 ConfigRegionRuleDefaultBuilder::new()
1762 }
1763}
1764
1765impl<'a> ConfigRegionRuleDefaultBuilder<'a, config_region_rule_default_state::Empty> {
1766 pub fn new() -> Self {
1768 ConfigRegionRuleDefaultBuilder {
1769 _state: PhantomData,
1770 _fields: (None,),
1771 _lifetime: PhantomData,
1772 }
1773 }
1774}
1775
1776impl<'a, S> ConfigRegionRuleDefaultBuilder<'a, S>
1777where
1778 S: config_region_rule_default_state::State,
1779 S::Access: config_region_rule_default_state::IsUnset,
1780{
1781 pub fn access(
1783 mut self,
1784 value: impl Into<ageassurance::Access<'a>>,
1785 ) -> ConfigRegionRuleDefaultBuilder<
1786 'a,
1787 config_region_rule_default_state::SetAccess<S>,
1788 > {
1789 self._fields.0 = Option::Some(value.into());
1790 ConfigRegionRuleDefaultBuilder {
1791 _state: PhantomData,
1792 _fields: self._fields,
1793 _lifetime: PhantomData,
1794 }
1795 }
1796}
1797
1798impl<'a, S> ConfigRegionRuleDefaultBuilder<'a, S>
1799where
1800 S: config_region_rule_default_state::State,
1801 S::Access: config_region_rule_default_state::IsSet,
1802{
1803 pub fn build(self) -> ConfigRegionRuleDefault<'a> {
1805 ConfigRegionRuleDefault {
1806 access: self._fields.0.unwrap(),
1807 extra_data: Default::default(),
1808 }
1809 }
1810 pub fn build_with_data(
1812 self,
1813 extra_data: BTreeMap<
1814 jacquard_common::deps::smol_str::SmolStr,
1815 jacquard_common::types::value::Data<'a>,
1816 >,
1817 ) -> ConfigRegionRuleDefault<'a> {
1818 ConfigRegionRuleDefault {
1819 access: self._fields.0.unwrap(),
1820 extra_data: Some(extra_data),
1821 }
1822 }
1823}
1824
1825pub mod config_region_rule_if_account_newer_than_state {
1826
1827 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1828 #[allow(unused)]
1829 use ::core::marker::PhantomData;
1830 mod sealed {
1831 pub trait Sealed {}
1832 }
1833 pub trait State: sealed::Sealed {
1835 type Access;
1836 type Date;
1837 }
1838 pub struct Empty(());
1840 impl sealed::Sealed for Empty {}
1841 impl State for Empty {
1842 type Access = Unset;
1843 type Date = Unset;
1844 }
1845 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
1847 impl<S: State> sealed::Sealed for SetAccess<S> {}
1848 impl<S: State> State for SetAccess<S> {
1849 type Access = Set<members::access>;
1850 type Date = S::Date;
1851 }
1852 pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>);
1854 impl<S: State> sealed::Sealed for SetDate<S> {}
1855 impl<S: State> State for SetDate<S> {
1856 type Access = S::Access;
1857 type Date = Set<members::date>;
1858 }
1859 #[allow(non_camel_case_types)]
1861 pub mod members {
1862 pub struct access(());
1864 pub struct date(());
1866 }
1867}
1868
1869pub struct ConfigRegionRuleIfAccountNewerThanBuilder<
1871 'a,
1872 S: config_region_rule_if_account_newer_than_state::State,
1873> {
1874 _state: PhantomData<fn() -> S>,
1875 _fields: (Option<ageassurance::Access<'a>>, Option<Datetime>),
1876 _lifetime: PhantomData<&'a ()>,
1877}
1878
1879impl<'a> ConfigRegionRuleIfAccountNewerThan<'a> {
1880 pub fn new() -> ConfigRegionRuleIfAccountNewerThanBuilder<
1882 'a,
1883 config_region_rule_if_account_newer_than_state::Empty,
1884 > {
1885 ConfigRegionRuleIfAccountNewerThanBuilder::new()
1886 }
1887}
1888
1889impl<
1890 'a,
1891> ConfigRegionRuleIfAccountNewerThanBuilder<
1892 'a,
1893 config_region_rule_if_account_newer_than_state::Empty,
1894> {
1895 pub fn new() -> Self {
1897 ConfigRegionRuleIfAccountNewerThanBuilder {
1898 _state: PhantomData,
1899 _fields: (None, None),
1900 _lifetime: PhantomData,
1901 }
1902 }
1903}
1904
1905impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
1906where
1907 S: config_region_rule_if_account_newer_than_state::State,
1908 S::Access: config_region_rule_if_account_newer_than_state::IsUnset,
1909{
1910 pub fn access(
1912 mut self,
1913 value: impl Into<ageassurance::Access<'a>>,
1914 ) -> ConfigRegionRuleIfAccountNewerThanBuilder<
1915 'a,
1916 config_region_rule_if_account_newer_than_state::SetAccess<S>,
1917 > {
1918 self._fields.0 = Option::Some(value.into());
1919 ConfigRegionRuleIfAccountNewerThanBuilder {
1920 _state: PhantomData,
1921 _fields: self._fields,
1922 _lifetime: PhantomData,
1923 }
1924 }
1925}
1926
1927impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
1928where
1929 S: config_region_rule_if_account_newer_than_state::State,
1930 S::Date: config_region_rule_if_account_newer_than_state::IsUnset,
1931{
1932 pub fn date(
1934 mut self,
1935 value: impl Into<Datetime>,
1936 ) -> ConfigRegionRuleIfAccountNewerThanBuilder<
1937 'a,
1938 config_region_rule_if_account_newer_than_state::SetDate<S>,
1939 > {
1940 self._fields.1 = Option::Some(value.into());
1941 ConfigRegionRuleIfAccountNewerThanBuilder {
1942 _state: PhantomData,
1943 _fields: self._fields,
1944 _lifetime: PhantomData,
1945 }
1946 }
1947}
1948
1949impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
1950where
1951 S: config_region_rule_if_account_newer_than_state::State,
1952 S::Access: config_region_rule_if_account_newer_than_state::IsSet,
1953 S::Date: config_region_rule_if_account_newer_than_state::IsSet,
1954{
1955 pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<'a> {
1957 ConfigRegionRuleIfAccountNewerThan {
1958 access: self._fields.0.unwrap(),
1959 date: self._fields.1.unwrap(),
1960 extra_data: Default::default(),
1961 }
1962 }
1963 pub fn build_with_data(
1965 self,
1966 extra_data: BTreeMap<
1967 jacquard_common::deps::smol_str::SmolStr,
1968 jacquard_common::types::value::Data<'a>,
1969 >,
1970 ) -> ConfigRegionRuleIfAccountNewerThan<'a> {
1971 ConfigRegionRuleIfAccountNewerThan {
1972 access: self._fields.0.unwrap(),
1973 date: self._fields.1.unwrap(),
1974 extra_data: Some(extra_data),
1975 }
1976 }
1977}
1978
1979pub mod config_region_rule_if_account_older_than_state {
1980
1981 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1982 #[allow(unused)]
1983 use ::core::marker::PhantomData;
1984 mod sealed {
1985 pub trait Sealed {}
1986 }
1987 pub trait State: sealed::Sealed {
1989 type Access;
1990 type Date;
1991 }
1992 pub struct Empty(());
1994 impl sealed::Sealed for Empty {}
1995 impl State for Empty {
1996 type Access = Unset;
1997 type Date = Unset;
1998 }
1999 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
2001 impl<S: State> sealed::Sealed for SetAccess<S> {}
2002 impl<S: State> State for SetAccess<S> {
2003 type Access = Set<members::access>;
2004 type Date = S::Date;
2005 }
2006 pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>);
2008 impl<S: State> sealed::Sealed for SetDate<S> {}
2009 impl<S: State> State for SetDate<S> {
2010 type Access = S::Access;
2011 type Date = Set<members::date>;
2012 }
2013 #[allow(non_camel_case_types)]
2015 pub mod members {
2016 pub struct access(());
2018 pub struct date(());
2020 }
2021}
2022
2023pub struct ConfigRegionRuleIfAccountOlderThanBuilder<
2025 'a,
2026 S: config_region_rule_if_account_older_than_state::State,
2027> {
2028 _state: PhantomData<fn() -> S>,
2029 _fields: (Option<ageassurance::Access<'a>>, Option<Datetime>),
2030 _lifetime: PhantomData<&'a ()>,
2031}
2032
2033impl<'a> ConfigRegionRuleIfAccountOlderThan<'a> {
2034 pub fn new() -> ConfigRegionRuleIfAccountOlderThanBuilder<
2036 'a,
2037 config_region_rule_if_account_older_than_state::Empty,
2038 > {
2039 ConfigRegionRuleIfAccountOlderThanBuilder::new()
2040 }
2041}
2042
2043impl<
2044 'a,
2045> ConfigRegionRuleIfAccountOlderThanBuilder<
2046 'a,
2047 config_region_rule_if_account_older_than_state::Empty,
2048> {
2049 pub fn new() -> Self {
2051 ConfigRegionRuleIfAccountOlderThanBuilder {
2052 _state: PhantomData,
2053 _fields: (None, None),
2054 _lifetime: PhantomData,
2055 }
2056 }
2057}
2058
2059impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
2060where
2061 S: config_region_rule_if_account_older_than_state::State,
2062 S::Access: config_region_rule_if_account_older_than_state::IsUnset,
2063{
2064 pub fn access(
2066 mut self,
2067 value: impl Into<ageassurance::Access<'a>>,
2068 ) -> ConfigRegionRuleIfAccountOlderThanBuilder<
2069 'a,
2070 config_region_rule_if_account_older_than_state::SetAccess<S>,
2071 > {
2072 self._fields.0 = Option::Some(value.into());
2073 ConfigRegionRuleIfAccountOlderThanBuilder {
2074 _state: PhantomData,
2075 _fields: self._fields,
2076 _lifetime: PhantomData,
2077 }
2078 }
2079}
2080
2081impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
2082where
2083 S: config_region_rule_if_account_older_than_state::State,
2084 S::Date: config_region_rule_if_account_older_than_state::IsUnset,
2085{
2086 pub fn date(
2088 mut self,
2089 value: impl Into<Datetime>,
2090 ) -> ConfigRegionRuleIfAccountOlderThanBuilder<
2091 'a,
2092 config_region_rule_if_account_older_than_state::SetDate<S>,
2093 > {
2094 self._fields.1 = Option::Some(value.into());
2095 ConfigRegionRuleIfAccountOlderThanBuilder {
2096 _state: PhantomData,
2097 _fields: self._fields,
2098 _lifetime: PhantomData,
2099 }
2100 }
2101}
2102
2103impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
2104where
2105 S: config_region_rule_if_account_older_than_state::State,
2106 S::Access: config_region_rule_if_account_older_than_state::IsSet,
2107 S::Date: config_region_rule_if_account_older_than_state::IsSet,
2108{
2109 pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<'a> {
2111 ConfigRegionRuleIfAccountOlderThan {
2112 access: self._fields.0.unwrap(),
2113 date: self._fields.1.unwrap(),
2114 extra_data: Default::default(),
2115 }
2116 }
2117 pub fn build_with_data(
2119 self,
2120 extra_data: BTreeMap<
2121 jacquard_common::deps::smol_str::SmolStr,
2122 jacquard_common::types::value::Data<'a>,
2123 >,
2124 ) -> ConfigRegionRuleIfAccountOlderThan<'a> {
2125 ConfigRegionRuleIfAccountOlderThan {
2126 access: self._fields.0.unwrap(),
2127 date: self._fields.1.unwrap(),
2128 extra_data: Some(extra_data),
2129 }
2130 }
2131}
2132
2133pub mod config_region_rule_if_assured_over_age_state {
2134
2135 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2136 #[allow(unused)]
2137 use ::core::marker::PhantomData;
2138 mod sealed {
2139 pub trait Sealed {}
2140 }
2141 pub trait State: sealed::Sealed {
2143 type Access;
2144 type Age;
2145 }
2146 pub struct Empty(());
2148 impl sealed::Sealed for Empty {}
2149 impl State for Empty {
2150 type Access = Unset;
2151 type Age = Unset;
2152 }
2153 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
2155 impl<S: State> sealed::Sealed for SetAccess<S> {}
2156 impl<S: State> State for SetAccess<S> {
2157 type Access = Set<members::access>;
2158 type Age = S::Age;
2159 }
2160 pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
2162 impl<S: State> sealed::Sealed for SetAge<S> {}
2163 impl<S: State> State for SetAge<S> {
2164 type Access = S::Access;
2165 type Age = Set<members::age>;
2166 }
2167 #[allow(non_camel_case_types)]
2169 pub mod members {
2170 pub struct access(());
2172 pub struct age(());
2174 }
2175}
2176
2177pub struct ConfigRegionRuleIfAssuredOverAgeBuilder<
2179 'a,
2180 S: config_region_rule_if_assured_over_age_state::State,
2181> {
2182 _state: PhantomData<fn() -> S>,
2183 _fields: (Option<ageassurance::Access<'a>>, Option<i64>),
2184 _lifetime: PhantomData<&'a ()>,
2185}
2186
2187impl<'a> ConfigRegionRuleIfAssuredOverAge<'a> {
2188 pub fn new() -> ConfigRegionRuleIfAssuredOverAgeBuilder<
2190 'a,
2191 config_region_rule_if_assured_over_age_state::Empty,
2192 > {
2193 ConfigRegionRuleIfAssuredOverAgeBuilder::new()
2194 }
2195}
2196
2197impl<
2198 'a,
2199> ConfigRegionRuleIfAssuredOverAgeBuilder<
2200 'a,
2201 config_region_rule_if_assured_over_age_state::Empty,
2202> {
2203 pub fn new() -> Self {
2205 ConfigRegionRuleIfAssuredOverAgeBuilder {
2206 _state: PhantomData,
2207 _fields: (None, None),
2208 _lifetime: PhantomData,
2209 }
2210 }
2211}
2212
2213impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
2214where
2215 S: config_region_rule_if_assured_over_age_state::State,
2216 S::Access: config_region_rule_if_assured_over_age_state::IsUnset,
2217{
2218 pub fn access(
2220 mut self,
2221 value: impl Into<ageassurance::Access<'a>>,
2222 ) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
2223 'a,
2224 config_region_rule_if_assured_over_age_state::SetAccess<S>,
2225 > {
2226 self._fields.0 = Option::Some(value.into());
2227 ConfigRegionRuleIfAssuredOverAgeBuilder {
2228 _state: PhantomData,
2229 _fields: self._fields,
2230 _lifetime: PhantomData,
2231 }
2232 }
2233}
2234
2235impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
2236where
2237 S: config_region_rule_if_assured_over_age_state::State,
2238 S::Age: config_region_rule_if_assured_over_age_state::IsUnset,
2239{
2240 pub fn age(
2242 mut self,
2243 value: impl Into<i64>,
2244 ) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
2245 'a,
2246 config_region_rule_if_assured_over_age_state::SetAge<S>,
2247 > {
2248 self._fields.1 = Option::Some(value.into());
2249 ConfigRegionRuleIfAssuredOverAgeBuilder {
2250 _state: PhantomData,
2251 _fields: self._fields,
2252 _lifetime: PhantomData,
2253 }
2254 }
2255}
2256
2257impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
2258where
2259 S: config_region_rule_if_assured_over_age_state::State,
2260 S::Access: config_region_rule_if_assured_over_age_state::IsSet,
2261 S::Age: config_region_rule_if_assured_over_age_state::IsSet,
2262{
2263 pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<'a> {
2265 ConfigRegionRuleIfAssuredOverAge {
2266 access: self._fields.0.unwrap(),
2267 age: self._fields.1.unwrap(),
2268 extra_data: Default::default(),
2269 }
2270 }
2271 pub fn build_with_data(
2273 self,
2274 extra_data: BTreeMap<
2275 jacquard_common::deps::smol_str::SmolStr,
2276 jacquard_common::types::value::Data<'a>,
2277 >,
2278 ) -> ConfigRegionRuleIfAssuredOverAge<'a> {
2279 ConfigRegionRuleIfAssuredOverAge {
2280 access: self._fields.0.unwrap(),
2281 age: self._fields.1.unwrap(),
2282 extra_data: Some(extra_data),
2283 }
2284 }
2285}
2286
2287pub mod config_region_rule_if_assured_under_age_state {
2288
2289 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2290 #[allow(unused)]
2291 use ::core::marker::PhantomData;
2292 mod sealed {
2293 pub trait Sealed {}
2294 }
2295 pub trait State: sealed::Sealed {
2297 type Access;
2298 type Age;
2299 }
2300 pub struct Empty(());
2302 impl sealed::Sealed for Empty {}
2303 impl State for Empty {
2304 type Access = Unset;
2305 type Age = Unset;
2306 }
2307 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
2309 impl<S: State> sealed::Sealed for SetAccess<S> {}
2310 impl<S: State> State for SetAccess<S> {
2311 type Access = Set<members::access>;
2312 type Age = S::Age;
2313 }
2314 pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
2316 impl<S: State> sealed::Sealed for SetAge<S> {}
2317 impl<S: State> State for SetAge<S> {
2318 type Access = S::Access;
2319 type Age = Set<members::age>;
2320 }
2321 #[allow(non_camel_case_types)]
2323 pub mod members {
2324 pub struct access(());
2326 pub struct age(());
2328 }
2329}
2330
2331pub struct ConfigRegionRuleIfAssuredUnderAgeBuilder<
2333 'a,
2334 S: config_region_rule_if_assured_under_age_state::State,
2335> {
2336 _state: PhantomData<fn() -> S>,
2337 _fields: (Option<ageassurance::Access<'a>>, Option<i64>),
2338 _lifetime: PhantomData<&'a ()>,
2339}
2340
2341impl<'a> ConfigRegionRuleIfAssuredUnderAge<'a> {
2342 pub fn new() -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
2344 'a,
2345 config_region_rule_if_assured_under_age_state::Empty,
2346 > {
2347 ConfigRegionRuleIfAssuredUnderAgeBuilder::new()
2348 }
2349}
2350
2351impl<
2352 'a,
2353> ConfigRegionRuleIfAssuredUnderAgeBuilder<
2354 'a,
2355 config_region_rule_if_assured_under_age_state::Empty,
2356> {
2357 pub fn new() -> Self {
2359 ConfigRegionRuleIfAssuredUnderAgeBuilder {
2360 _state: PhantomData,
2361 _fields: (None, None),
2362 _lifetime: PhantomData,
2363 }
2364 }
2365}
2366
2367impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
2368where
2369 S: config_region_rule_if_assured_under_age_state::State,
2370 S::Access: config_region_rule_if_assured_under_age_state::IsUnset,
2371{
2372 pub fn access(
2374 mut self,
2375 value: impl Into<ageassurance::Access<'a>>,
2376 ) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
2377 'a,
2378 config_region_rule_if_assured_under_age_state::SetAccess<S>,
2379 > {
2380 self._fields.0 = Option::Some(value.into());
2381 ConfigRegionRuleIfAssuredUnderAgeBuilder {
2382 _state: PhantomData,
2383 _fields: self._fields,
2384 _lifetime: PhantomData,
2385 }
2386 }
2387}
2388
2389impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
2390where
2391 S: config_region_rule_if_assured_under_age_state::State,
2392 S::Age: config_region_rule_if_assured_under_age_state::IsUnset,
2393{
2394 pub fn age(
2396 mut self,
2397 value: impl Into<i64>,
2398 ) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
2399 'a,
2400 config_region_rule_if_assured_under_age_state::SetAge<S>,
2401 > {
2402 self._fields.1 = Option::Some(value.into());
2403 ConfigRegionRuleIfAssuredUnderAgeBuilder {
2404 _state: PhantomData,
2405 _fields: self._fields,
2406 _lifetime: PhantomData,
2407 }
2408 }
2409}
2410
2411impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
2412where
2413 S: config_region_rule_if_assured_under_age_state::State,
2414 S::Access: config_region_rule_if_assured_under_age_state::IsSet,
2415 S::Age: config_region_rule_if_assured_under_age_state::IsSet,
2416{
2417 pub fn build(self) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
2419 ConfigRegionRuleIfAssuredUnderAge {
2420 access: self._fields.0.unwrap(),
2421 age: self._fields.1.unwrap(),
2422 extra_data: Default::default(),
2423 }
2424 }
2425 pub fn build_with_data(
2427 self,
2428 extra_data: BTreeMap<
2429 jacquard_common::deps::smol_str::SmolStr,
2430 jacquard_common::types::value::Data<'a>,
2431 >,
2432 ) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
2433 ConfigRegionRuleIfAssuredUnderAge {
2434 access: self._fields.0.unwrap(),
2435 age: self._fields.1.unwrap(),
2436 extra_data: Some(extra_data),
2437 }
2438 }
2439}
2440
2441pub mod config_region_rule_if_declared_over_age_state {
2442
2443 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2444 #[allow(unused)]
2445 use ::core::marker::PhantomData;
2446 mod sealed {
2447 pub trait Sealed {}
2448 }
2449 pub trait State: sealed::Sealed {
2451 type Access;
2452 type Age;
2453 }
2454 pub struct Empty(());
2456 impl sealed::Sealed for Empty {}
2457 impl State for Empty {
2458 type Access = Unset;
2459 type Age = Unset;
2460 }
2461 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
2463 impl<S: State> sealed::Sealed for SetAccess<S> {}
2464 impl<S: State> State for SetAccess<S> {
2465 type Access = Set<members::access>;
2466 type Age = S::Age;
2467 }
2468 pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
2470 impl<S: State> sealed::Sealed for SetAge<S> {}
2471 impl<S: State> State for SetAge<S> {
2472 type Access = S::Access;
2473 type Age = Set<members::age>;
2474 }
2475 #[allow(non_camel_case_types)]
2477 pub mod members {
2478 pub struct access(());
2480 pub struct age(());
2482 }
2483}
2484
2485pub struct ConfigRegionRuleIfDeclaredOverAgeBuilder<
2487 'a,
2488 S: config_region_rule_if_declared_over_age_state::State,
2489> {
2490 _state: PhantomData<fn() -> S>,
2491 _fields: (Option<ageassurance::Access<'a>>, Option<i64>),
2492 _lifetime: PhantomData<&'a ()>,
2493}
2494
2495impl<'a> ConfigRegionRuleIfDeclaredOverAge<'a> {
2496 pub fn new() -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
2498 'a,
2499 config_region_rule_if_declared_over_age_state::Empty,
2500 > {
2501 ConfigRegionRuleIfDeclaredOverAgeBuilder::new()
2502 }
2503}
2504
2505impl<
2506 'a,
2507> ConfigRegionRuleIfDeclaredOverAgeBuilder<
2508 'a,
2509 config_region_rule_if_declared_over_age_state::Empty,
2510> {
2511 pub fn new() -> Self {
2513 ConfigRegionRuleIfDeclaredOverAgeBuilder {
2514 _state: PhantomData,
2515 _fields: (None, None),
2516 _lifetime: PhantomData,
2517 }
2518 }
2519}
2520
2521impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
2522where
2523 S: config_region_rule_if_declared_over_age_state::State,
2524 S::Access: config_region_rule_if_declared_over_age_state::IsUnset,
2525{
2526 pub fn access(
2528 mut self,
2529 value: impl Into<ageassurance::Access<'a>>,
2530 ) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
2531 'a,
2532 config_region_rule_if_declared_over_age_state::SetAccess<S>,
2533 > {
2534 self._fields.0 = Option::Some(value.into());
2535 ConfigRegionRuleIfDeclaredOverAgeBuilder {
2536 _state: PhantomData,
2537 _fields: self._fields,
2538 _lifetime: PhantomData,
2539 }
2540 }
2541}
2542
2543impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
2544where
2545 S: config_region_rule_if_declared_over_age_state::State,
2546 S::Age: config_region_rule_if_declared_over_age_state::IsUnset,
2547{
2548 pub fn age(
2550 mut self,
2551 value: impl Into<i64>,
2552 ) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
2553 'a,
2554 config_region_rule_if_declared_over_age_state::SetAge<S>,
2555 > {
2556 self._fields.1 = Option::Some(value.into());
2557 ConfigRegionRuleIfDeclaredOverAgeBuilder {
2558 _state: PhantomData,
2559 _fields: self._fields,
2560 _lifetime: PhantomData,
2561 }
2562 }
2563}
2564
2565impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
2566where
2567 S: config_region_rule_if_declared_over_age_state::State,
2568 S::Access: config_region_rule_if_declared_over_age_state::IsSet,
2569 S::Age: config_region_rule_if_declared_over_age_state::IsSet,
2570{
2571 pub fn build(self) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
2573 ConfigRegionRuleIfDeclaredOverAge {
2574 access: self._fields.0.unwrap(),
2575 age: self._fields.1.unwrap(),
2576 extra_data: Default::default(),
2577 }
2578 }
2579 pub fn build_with_data(
2581 self,
2582 extra_data: BTreeMap<
2583 jacquard_common::deps::smol_str::SmolStr,
2584 jacquard_common::types::value::Data<'a>,
2585 >,
2586 ) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
2587 ConfigRegionRuleIfDeclaredOverAge {
2588 access: self._fields.0.unwrap(),
2589 age: self._fields.1.unwrap(),
2590 extra_data: Some(extra_data),
2591 }
2592 }
2593}
2594
2595pub mod config_region_rule_if_declared_under_age_state {
2596
2597 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2598 #[allow(unused)]
2599 use ::core::marker::PhantomData;
2600 mod sealed {
2601 pub trait Sealed {}
2602 }
2603 pub trait State: sealed::Sealed {
2605 type Age;
2606 type Access;
2607 }
2608 pub struct Empty(());
2610 impl sealed::Sealed for Empty {}
2611 impl State for Empty {
2612 type Age = Unset;
2613 type Access = Unset;
2614 }
2615 pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
2617 impl<S: State> sealed::Sealed for SetAge<S> {}
2618 impl<S: State> State for SetAge<S> {
2619 type Age = Set<members::age>;
2620 type Access = S::Access;
2621 }
2622 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
2624 impl<S: State> sealed::Sealed for SetAccess<S> {}
2625 impl<S: State> State for SetAccess<S> {
2626 type Age = S::Age;
2627 type Access = Set<members::access>;
2628 }
2629 #[allow(non_camel_case_types)]
2631 pub mod members {
2632 pub struct age(());
2634 pub struct access(());
2636 }
2637}
2638
2639pub struct ConfigRegionRuleIfDeclaredUnderAgeBuilder<
2641 'a,
2642 S: config_region_rule_if_declared_under_age_state::State,
2643> {
2644 _state: PhantomData<fn() -> S>,
2645 _fields: (Option<ageassurance::Access<'a>>, Option<i64>),
2646 _lifetime: PhantomData<&'a ()>,
2647}
2648
2649impl<'a> ConfigRegionRuleIfDeclaredUnderAge<'a> {
2650 pub fn new() -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
2652 'a,
2653 config_region_rule_if_declared_under_age_state::Empty,
2654 > {
2655 ConfigRegionRuleIfDeclaredUnderAgeBuilder::new()
2656 }
2657}
2658
2659impl<
2660 'a,
2661> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
2662 'a,
2663 config_region_rule_if_declared_under_age_state::Empty,
2664> {
2665 pub fn new() -> Self {
2667 ConfigRegionRuleIfDeclaredUnderAgeBuilder {
2668 _state: PhantomData,
2669 _fields: (None, None),
2670 _lifetime: PhantomData,
2671 }
2672 }
2673}
2674
2675impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
2676where
2677 S: config_region_rule_if_declared_under_age_state::State,
2678 S::Access: config_region_rule_if_declared_under_age_state::IsUnset,
2679{
2680 pub fn access(
2682 mut self,
2683 value: impl Into<ageassurance::Access<'a>>,
2684 ) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
2685 'a,
2686 config_region_rule_if_declared_under_age_state::SetAccess<S>,
2687 > {
2688 self._fields.0 = Option::Some(value.into());
2689 ConfigRegionRuleIfDeclaredUnderAgeBuilder {
2690 _state: PhantomData,
2691 _fields: self._fields,
2692 _lifetime: PhantomData,
2693 }
2694 }
2695}
2696
2697impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
2698where
2699 S: config_region_rule_if_declared_under_age_state::State,
2700 S::Age: config_region_rule_if_declared_under_age_state::IsUnset,
2701{
2702 pub fn age(
2704 mut self,
2705 value: impl Into<i64>,
2706 ) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
2707 'a,
2708 config_region_rule_if_declared_under_age_state::SetAge<S>,
2709 > {
2710 self._fields.1 = Option::Some(value.into());
2711 ConfigRegionRuleIfDeclaredUnderAgeBuilder {
2712 _state: PhantomData,
2713 _fields: self._fields,
2714 _lifetime: PhantomData,
2715 }
2716 }
2717}
2718
2719impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
2720where
2721 S: config_region_rule_if_declared_under_age_state::State,
2722 S::Age: config_region_rule_if_declared_under_age_state::IsSet,
2723 S::Access: config_region_rule_if_declared_under_age_state::IsSet,
2724{
2725 pub fn build(self) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
2727 ConfigRegionRuleIfDeclaredUnderAge {
2728 access: self._fields.0.unwrap(),
2729 age: self._fields.1.unwrap(),
2730 extra_data: Default::default(),
2731 }
2732 }
2733 pub fn build_with_data(
2735 self,
2736 extra_data: BTreeMap<
2737 jacquard_common::deps::smol_str::SmolStr,
2738 jacquard_common::types::value::Data<'a>,
2739 >,
2740 ) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
2741 ConfigRegionRuleIfDeclaredUnderAge {
2742 access: self._fields.0.unwrap(),
2743 age: self._fields.1.unwrap(),
2744 extra_data: Some(extra_data),
2745 }
2746 }
2747}
2748
2749pub mod event_state {
2750
2751 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
2752 #[allow(unused)]
2753 use ::core::marker::PhantomData;
2754 mod sealed {
2755 pub trait Sealed {}
2756 }
2757 pub trait State: sealed::Sealed {
2759 type AttemptId;
2760 type Access;
2761 type CreatedAt;
2762 type CountryCode;
2763 type Status;
2764 }
2765 pub struct Empty(());
2767 impl sealed::Sealed for Empty {}
2768 impl State for Empty {
2769 type AttemptId = Unset;
2770 type Access = Unset;
2771 type CreatedAt = Unset;
2772 type CountryCode = Unset;
2773 type Status = Unset;
2774 }
2775 pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>);
2777 impl<S: State> sealed::Sealed for SetAttemptId<S> {}
2778 impl<S: State> State for SetAttemptId<S> {
2779 type AttemptId = Set<members::attempt_id>;
2780 type Access = S::Access;
2781 type CreatedAt = S::CreatedAt;
2782 type CountryCode = S::CountryCode;
2783 type Status = S::Status;
2784 }
2785 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
2787 impl<S: State> sealed::Sealed for SetAccess<S> {}
2788 impl<S: State> State for SetAccess<S> {
2789 type AttemptId = S::AttemptId;
2790 type Access = Set<members::access>;
2791 type CreatedAt = S::CreatedAt;
2792 type CountryCode = S::CountryCode;
2793 type Status = S::Status;
2794 }
2795 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
2797 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
2798 impl<S: State> State for SetCreatedAt<S> {
2799 type AttemptId = S::AttemptId;
2800 type Access = S::Access;
2801 type CreatedAt = Set<members::created_at>;
2802 type CountryCode = S::CountryCode;
2803 type Status = S::Status;
2804 }
2805 pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
2807 impl<S: State> sealed::Sealed for SetCountryCode<S> {}
2808 impl<S: State> State for SetCountryCode<S> {
2809 type AttemptId = S::AttemptId;
2810 type Access = S::Access;
2811 type CreatedAt = S::CreatedAt;
2812 type CountryCode = Set<members::country_code>;
2813 type Status = S::Status;
2814 }
2815 pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
2817 impl<S: State> sealed::Sealed for SetStatus<S> {}
2818 impl<S: State> State for SetStatus<S> {
2819 type AttemptId = S::AttemptId;
2820 type Access = S::Access;
2821 type CreatedAt = S::CreatedAt;
2822 type CountryCode = S::CountryCode;
2823 type Status = Set<members::status>;
2824 }
2825 #[allow(non_camel_case_types)]
2827 pub mod members {
2828 pub struct attempt_id(());
2830 pub struct access(());
2832 pub struct created_at(());
2834 pub struct country_code(());
2836 pub struct status(());
2838 }
2839}
2840
2841pub struct EventBuilder<'a, S: event_state::State> {
2843 _state: PhantomData<fn() -> S>,
2844 _fields: (
2845 Option<EventAccess<'a>>,
2846 Option<CowStr<'a>>,
2847 Option<CowStr<'a>>,
2848 Option<CowStr<'a>>,
2849 Option<CowStr<'a>>,
2850 Option<Datetime>,
2851 Option<CowStr<'a>>,
2852 Option<CowStr<'a>>,
2853 Option<CowStr<'a>>,
2854 Option<CowStr<'a>>,
2855 Option<EventStatus<'a>>,
2856 ),
2857 _lifetime: PhantomData<&'a ()>,
2858}
2859
2860impl<'a> Event<'a> {
2861 pub fn new() -> EventBuilder<'a, event_state::Empty> {
2863 EventBuilder::new()
2864 }
2865}
2866
2867impl<'a> EventBuilder<'a, event_state::Empty> {
2868 pub fn new() -> Self {
2870 EventBuilder {
2871 _state: PhantomData,
2872 _fields: (None, None, None, None, None, None, None, None, None, None, None),
2873 _lifetime: PhantomData,
2874 }
2875 }
2876}
2877
2878impl<'a, S> EventBuilder<'a, S>
2879where
2880 S: event_state::State,
2881 S::Access: event_state::IsUnset,
2882{
2883 pub fn access(
2885 mut self,
2886 value: impl Into<EventAccess<'a>>,
2887 ) -> EventBuilder<'a, event_state::SetAccess<S>> {
2888 self._fields.0 = Option::Some(value.into());
2889 EventBuilder {
2890 _state: PhantomData,
2891 _fields: self._fields,
2892 _lifetime: PhantomData,
2893 }
2894 }
2895}
2896
2897impl<'a, S> EventBuilder<'a, S>
2898where
2899 S: event_state::State,
2900 S::AttemptId: event_state::IsUnset,
2901{
2902 pub fn attempt_id(
2904 mut self,
2905 value: impl Into<CowStr<'a>>,
2906 ) -> EventBuilder<'a, event_state::SetAttemptId<S>> {
2907 self._fields.1 = Option::Some(value.into());
2908 EventBuilder {
2909 _state: PhantomData,
2910 _fields: self._fields,
2911 _lifetime: PhantomData,
2912 }
2913 }
2914}
2915
2916impl<'a, S: event_state::State> EventBuilder<'a, S> {
2917 pub fn complete_ip(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
2919 self._fields.2 = value.into();
2920 self
2921 }
2922 pub fn maybe_complete_ip(mut self, value: Option<CowStr<'a>>) -> Self {
2924 self._fields.2 = value;
2925 self
2926 }
2927}
2928
2929impl<'a, S: event_state::State> EventBuilder<'a, S> {
2930 pub fn complete_ua(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
2932 self._fields.3 = value.into();
2933 self
2934 }
2935 pub fn maybe_complete_ua(mut self, value: Option<CowStr<'a>>) -> Self {
2937 self._fields.3 = value;
2938 self
2939 }
2940}
2941
2942impl<'a, S> EventBuilder<'a, S>
2943where
2944 S: event_state::State,
2945 S::CountryCode: event_state::IsUnset,
2946{
2947 pub fn country_code(
2949 mut self,
2950 value: impl Into<CowStr<'a>>,
2951 ) -> EventBuilder<'a, event_state::SetCountryCode<S>> {
2952 self._fields.4 = Option::Some(value.into());
2953 EventBuilder {
2954 _state: PhantomData,
2955 _fields: self._fields,
2956 _lifetime: PhantomData,
2957 }
2958 }
2959}
2960
2961impl<'a, S> EventBuilder<'a, S>
2962where
2963 S: event_state::State,
2964 S::CreatedAt: event_state::IsUnset,
2965{
2966 pub fn created_at(
2968 mut self,
2969 value: impl Into<Datetime>,
2970 ) -> EventBuilder<'a, event_state::SetCreatedAt<S>> {
2971 self._fields.5 = Option::Some(value.into());
2972 EventBuilder {
2973 _state: PhantomData,
2974 _fields: self._fields,
2975 _lifetime: PhantomData,
2976 }
2977 }
2978}
2979
2980impl<'a, S: event_state::State> EventBuilder<'a, S> {
2981 pub fn email(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
2983 self._fields.6 = value.into();
2984 self
2985 }
2986 pub fn maybe_email(mut self, value: Option<CowStr<'a>>) -> Self {
2988 self._fields.6 = value;
2989 self
2990 }
2991}
2992
2993impl<'a, S: event_state::State> EventBuilder<'a, S> {
2994 pub fn init_ip(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
2996 self._fields.7 = value.into();
2997 self
2998 }
2999 pub fn maybe_init_ip(mut self, value: Option<CowStr<'a>>) -> Self {
3001 self._fields.7 = value;
3002 self
3003 }
3004}
3005
3006impl<'a, S: event_state::State> EventBuilder<'a, S> {
3007 pub fn init_ua(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
3009 self._fields.8 = value.into();
3010 self
3011 }
3012 pub fn maybe_init_ua(mut self, value: Option<CowStr<'a>>) -> Self {
3014 self._fields.8 = value;
3015 self
3016 }
3017}
3018
3019impl<'a, S: event_state::State> EventBuilder<'a, S> {
3020 pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
3022 self._fields.9 = value.into();
3023 self
3024 }
3025 pub fn maybe_region_code(mut self, value: Option<CowStr<'a>>) -> Self {
3027 self._fields.9 = value;
3028 self
3029 }
3030}
3031
3032impl<'a, S> EventBuilder<'a, S>
3033where
3034 S: event_state::State,
3035 S::Status: event_state::IsUnset,
3036{
3037 pub fn status(
3039 mut self,
3040 value: impl Into<EventStatus<'a>>,
3041 ) -> EventBuilder<'a, event_state::SetStatus<S>> {
3042 self._fields.10 = Option::Some(value.into());
3043 EventBuilder {
3044 _state: PhantomData,
3045 _fields: self._fields,
3046 _lifetime: PhantomData,
3047 }
3048 }
3049}
3050
3051impl<'a, S> EventBuilder<'a, S>
3052where
3053 S: event_state::State,
3054 S::AttemptId: event_state::IsSet,
3055 S::Access: event_state::IsSet,
3056 S::CreatedAt: event_state::IsSet,
3057 S::CountryCode: event_state::IsSet,
3058 S::Status: event_state::IsSet,
3059{
3060 pub fn build(self) -> Event<'a> {
3062 Event {
3063 access: self._fields.0.unwrap(),
3064 attempt_id: self._fields.1.unwrap(),
3065 complete_ip: self._fields.2,
3066 complete_ua: self._fields.3,
3067 country_code: self._fields.4.unwrap(),
3068 created_at: self._fields.5.unwrap(),
3069 email: self._fields.6,
3070 init_ip: self._fields.7,
3071 init_ua: self._fields.8,
3072 region_code: self._fields.9,
3073 status: self._fields.10.unwrap(),
3074 extra_data: Default::default(),
3075 }
3076 }
3077 pub fn build_with_data(
3079 self,
3080 extra_data: BTreeMap<
3081 jacquard_common::deps::smol_str::SmolStr,
3082 jacquard_common::types::value::Data<'a>,
3083 >,
3084 ) -> Event<'a> {
3085 Event {
3086 access: self._fields.0.unwrap(),
3087 attempt_id: self._fields.1.unwrap(),
3088 complete_ip: self._fields.2,
3089 complete_ua: self._fields.3,
3090 country_code: self._fields.4.unwrap(),
3091 created_at: self._fields.5.unwrap(),
3092 email: self._fields.6,
3093 init_ip: self._fields.7,
3094 init_ua: self._fields.8,
3095 region_code: self._fields.9,
3096 status: self._fields.10.unwrap(),
3097 extra_data: Some(extra_data),
3098 }
3099 }
3100}
3101
3102pub mod state_state {
3103
3104 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
3105 #[allow(unused)]
3106 use ::core::marker::PhantomData;
3107 mod sealed {
3108 pub trait Sealed {}
3109 }
3110 pub trait State: sealed::Sealed {
3112 type Access;
3113 type Status;
3114 }
3115 pub struct Empty(());
3117 impl sealed::Sealed for Empty {}
3118 impl State for Empty {
3119 type Access = Unset;
3120 type Status = Unset;
3121 }
3122 pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
3124 impl<S: State> sealed::Sealed for SetAccess<S> {}
3125 impl<S: State> State for SetAccess<S> {
3126 type Access = Set<members::access>;
3127 type Status = S::Status;
3128 }
3129 pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
3131 impl<S: State> sealed::Sealed for SetStatus<S> {}
3132 impl<S: State> State for SetStatus<S> {
3133 type Access = S::Access;
3134 type Status = Set<members::status>;
3135 }
3136 #[allow(non_camel_case_types)]
3138 pub mod members {
3139 pub struct access(());
3141 pub struct status(());
3143 }
3144}
3145
3146pub struct StateBuilder<'a, S: state_state::State> {
3148 _state: PhantomData<fn() -> S>,
3149 _fields: (
3150 Option<ageassurance::Access<'a>>,
3151 Option<Datetime>,
3152 Option<ageassurance::Status<'a>>,
3153 ),
3154 _lifetime: PhantomData<&'a ()>,
3155}
3156
3157impl<'a> State<'a> {
3158 pub fn new() -> StateBuilder<'a, state_state::Empty> {
3160 StateBuilder::new()
3161 }
3162}
3163
3164impl<'a> StateBuilder<'a, state_state::Empty> {
3165 pub fn new() -> Self {
3167 StateBuilder {
3168 _state: PhantomData,
3169 _fields: (None, None, None),
3170 _lifetime: PhantomData,
3171 }
3172 }
3173}
3174
3175impl<'a, S> StateBuilder<'a, S>
3176where
3177 S: state_state::State,
3178 S::Access: state_state::IsUnset,
3179{
3180 pub fn access(
3182 mut self,
3183 value: impl Into<ageassurance::Access<'a>>,
3184 ) -> StateBuilder<'a, state_state::SetAccess<S>> {
3185 self._fields.0 = Option::Some(value.into());
3186 StateBuilder {
3187 _state: PhantomData,
3188 _fields: self._fields,
3189 _lifetime: PhantomData,
3190 }
3191 }
3192}
3193
3194impl<'a, S: state_state::State> StateBuilder<'a, S> {
3195 pub fn last_initiated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
3197 self._fields.1 = value.into();
3198 self
3199 }
3200 pub fn maybe_last_initiated_at(mut self, value: Option<Datetime>) -> Self {
3202 self._fields.1 = value;
3203 self
3204 }
3205}
3206
3207impl<'a, S> StateBuilder<'a, S>
3208where
3209 S: state_state::State,
3210 S::Status: state_state::IsUnset,
3211{
3212 pub fn status(
3214 mut self,
3215 value: impl Into<ageassurance::Status<'a>>,
3216 ) -> StateBuilder<'a, state_state::SetStatus<S>> {
3217 self._fields.2 = Option::Some(value.into());
3218 StateBuilder {
3219 _state: PhantomData,
3220 _fields: self._fields,
3221 _lifetime: PhantomData,
3222 }
3223 }
3224}
3225
3226impl<'a, S> StateBuilder<'a, S>
3227where
3228 S: state_state::State,
3229 S::Access: state_state::IsSet,
3230 S::Status: state_state::IsSet,
3231{
3232 pub fn build(self) -> State<'a> {
3234 State {
3235 access: self._fields.0.unwrap(),
3236 last_initiated_at: self._fields.1,
3237 status: self._fields.2.unwrap(),
3238 extra_data: Default::default(),
3239 }
3240 }
3241 pub fn build_with_data(
3243 self,
3244 extra_data: BTreeMap<
3245 jacquard_common::deps::smol_str::SmolStr,
3246 jacquard_common::types::value::Data<'a>,
3247 >,
3248 ) -> State<'a> {
3249 State {
3250 access: self._fields.0.unwrap(),
3251 last_initiated_at: self._fields.1,
3252 status: self._fields.2.unwrap(),
3253 extra_data: Some(extra_data),
3254 }
3255 }
3256}