···131131 "attemptId"
132132 ],
133133 "properties": {
134134+ "access": {
135135+ "type": "ref",
136136+ "ref": "app.bsky.ageassurance.defs#access"
137137+ },
134138 "attemptId": {
135139 "type": "string",
136140 "description": "The unique identifier for this instance of the age assurance flow, in UUID format."
···143147 "type": "string",
144148 "description": "The user agent used when completing the AA flow."
145149 },
150150+ "countryCode": {
151151+ "type": "string",
152152+ "description": "The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow."
153153+ },
146154 "createdAt": {
147155 "type": "string",
148156 "description": "The date and time of this write operation.",
···156164 "type": "string",
157165 "description": "The user agent used when initiating the AA flow."
158166 },
167167+ "regionCode": {
168168+ "type": "string",
169169+ "description": "The ISO 3166-2 region code provided when beginning the Age Assurance flow."
170170+ },
159171 "status": {
160172 "type": "string",
161161- "description": "The status of the age assurance process.",
173173+ "description": "The status of the Age Assurance process.",
162174 "knownValues": [
163175 "unknown",
164176 "pending",
···175187 "status"
176188 ],
177189 "properties": {
190190+ "access": {
191191+ "type": "ref",
192192+ "ref": "app.bsky.ageassurance.defs#access"
193193+ },
178194 "comment": {
179195 "type": "string",
180196 "description": "Comment describing the reason for the override."
···13211337 "subjectReviewState": {
13221338 "type": "string",
13231339 "knownValues": [
13241324- "#reviewOpen",
13251325- "#reviewEscalated",
13261326- "#reviewClosed",
13271327- "#reviewNone"
13401340+ "tools.ozone.moderation.defs#reviewOpen",
13411341+ "tools.ozone.moderation.defs#reviewEscalated",
13421342+ "tools.ozone.moderation.defs#reviewClosed",
13431343+ "tools.ozone.moderation.defs#reviewNone"
13281344 ]
13291345 },
13301346 "subjectStatusView": {
···44// Any manual changes will be overwritten on the next regeneration.
5566pub mod actor;
77+pub mod ageassurance;
78pub mod bookmark;
89pub mod embed;
910pub mod feed;
+3424
crates/weaver-api/src/app_bsky/ageassurance.rs
···11+// @generated by jacquard-lexicon. DO NOT EDIT.
22+//
33+// Lexicon: app.bsky.ageassurance.defs
44+//
55+// This file was automatically generated from Lexicon schemas.
66+// Any manual changes will be overwritten on the next regeneration.
77+88+pub mod begin;
99+pub mod get_config;
1010+pub mod get_state;
1111+1212+/// The access level granted based on Age Assurance data we've processed.
1313+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1414+pub enum Access<'a> {
1515+ Unknown,
1616+ None,
1717+ Safe,
1818+ Full,
1919+ Other(jacquard_common::CowStr<'a>),
2020+}
2121+2222+impl<'a> Access<'a> {
2323+ pub fn as_str(&self) -> &str {
2424+ match self {
2525+ Self::Unknown => "unknown",
2626+ Self::None => "none",
2727+ Self::Safe => "safe",
2828+ Self::Full => "full",
2929+ Self::Other(s) => s.as_ref(),
3030+ }
3131+ }
3232+}
3333+3434+impl<'a> From<&'a str> for Access<'a> {
3535+ fn from(s: &'a str) -> Self {
3636+ match s {
3737+ "unknown" => Self::Unknown,
3838+ "none" => Self::None,
3939+ "safe" => Self::Safe,
4040+ "full" => Self::Full,
4141+ _ => Self::Other(jacquard_common::CowStr::from(s)),
4242+ }
4343+ }
4444+}
4545+4646+impl<'a> From<String> for Access<'a> {
4747+ fn from(s: String) -> Self {
4848+ match s.as_str() {
4949+ "unknown" => Self::Unknown,
5050+ "none" => Self::None,
5151+ "safe" => Self::Safe,
5252+ "full" => Self::Full,
5353+ _ => Self::Other(jacquard_common::CowStr::from(s)),
5454+ }
5555+ }
5656+}
5757+5858+impl<'a> AsRef<str> for Access<'a> {
5959+ fn as_ref(&self) -> &str {
6060+ self.as_str()
6161+ }
6262+}
6363+6464+impl<'a> serde::Serialize for Access<'a> {
6565+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6666+ where
6767+ S: serde::Serializer,
6868+ {
6969+ serializer.serialize_str(self.as_str())
7070+ }
7171+}
7272+7373+impl<'de, 'a> serde::Deserialize<'de> for Access<'a>
7474+where
7575+ 'de: 'a,
7676+{
7777+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7878+ where
7979+ D: serde::Deserializer<'de>,
8080+ {
8181+ let s = <&'de str>::deserialize(deserializer)?;
8282+ Ok(Self::from(s))
8383+ }
8484+}
8585+8686+impl jacquard_common::IntoStatic for Access<'_> {
8787+ type Output = Access<'static>;
8888+ fn into_static(self) -> Self::Output {
8989+ match self {
9090+ Access::Unknown => Access::Unknown,
9191+ Access::None => Access::None,
9292+ Access::Safe => Access::Safe,
9393+ Access::Full => Access::Full,
9494+ Access::Other(v) => Access::Other(v.into_static()),
9595+ }
9696+ }
9797+}
9898+9999+///
100100+#[jacquard_derive::lexicon]
101101+#[derive(
102102+ serde::Serialize,
103103+ serde::Deserialize,
104104+ Debug,
105105+ Clone,
106106+ PartialEq,
107107+ Eq,
108108+ jacquard_derive::IntoStatic
109109+)]
110110+#[serde(rename_all = "camelCase")]
111111+pub struct Config<'a> {
112112+ /// The per-region Age Assurance configuration.
113113+ #[serde(borrow)]
114114+ pub regions: Vec<crate::app_bsky::ageassurance::ConfigRegion<'a>>,
115115+}
116116+117117+pub mod config_state {
118118+119119+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
120120+ #[allow(unused)]
121121+ use ::core::marker::PhantomData;
122122+ mod sealed {
123123+ pub trait Sealed {}
124124+ }
125125+ /// State trait tracking which required fields have been set
126126+ pub trait State: sealed::Sealed {
127127+ type Regions;
128128+ }
129129+ /// Empty state - all required fields are unset
130130+ pub struct Empty(());
131131+ impl sealed::Sealed for Empty {}
132132+ impl State for Empty {
133133+ type Regions = Unset;
134134+ }
135135+ ///State transition - sets the `regions` field to Set
136136+ pub struct SetRegions<S: State = Empty>(PhantomData<fn() -> S>);
137137+ impl<S: State> sealed::Sealed for SetRegions<S> {}
138138+ impl<S: State> State for SetRegions<S> {
139139+ type Regions = Set<members::regions>;
140140+ }
141141+ /// Marker types for field names
142142+ #[allow(non_camel_case_types)]
143143+ pub mod members {
144144+ ///Marker type for the `regions` field
145145+ pub struct regions(());
146146+ }
147147+}
148148+149149+/// Builder for constructing an instance of this type
150150+pub struct ConfigBuilder<'a, S: config_state::State> {
151151+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
152152+ __unsafe_private_named: (
153153+ ::core::option::Option<Vec<crate::app_bsky::ageassurance::ConfigRegion<'a>>>,
154154+ ),
155155+ _phantom: ::core::marker::PhantomData<&'a ()>,
156156+}
157157+158158+impl<'a> Config<'a> {
159159+ /// Create a new builder for this type
160160+ pub fn new() -> ConfigBuilder<'a, config_state::Empty> {
161161+ ConfigBuilder::new()
162162+ }
163163+}
164164+165165+impl<'a> ConfigBuilder<'a, config_state::Empty> {
166166+ /// Create a new builder with all fields unset
167167+ pub fn new() -> Self {
168168+ ConfigBuilder {
169169+ _phantom_state: ::core::marker::PhantomData,
170170+ __unsafe_private_named: (None,),
171171+ _phantom: ::core::marker::PhantomData,
172172+ }
173173+ }
174174+}
175175+176176+impl<'a, S> ConfigBuilder<'a, S>
177177+where
178178+ S: config_state::State,
179179+ S::Regions: config_state::IsUnset,
180180+{
181181+ /// Set the `regions` field (required)
182182+ pub fn regions(
183183+ mut self,
184184+ value: impl Into<Vec<crate::app_bsky::ageassurance::ConfigRegion<'a>>>,
185185+ ) -> ConfigBuilder<'a, config_state::SetRegions<S>> {
186186+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
187187+ ConfigBuilder {
188188+ _phantom_state: ::core::marker::PhantomData,
189189+ __unsafe_private_named: self.__unsafe_private_named,
190190+ _phantom: ::core::marker::PhantomData,
191191+ }
192192+ }
193193+}
194194+195195+impl<'a, S> ConfigBuilder<'a, S>
196196+where
197197+ S: config_state::State,
198198+ S::Regions: config_state::IsSet,
199199+{
200200+ /// Build the final struct
201201+ pub fn build(self) -> Config<'a> {
202202+ Config {
203203+ regions: self.__unsafe_private_named.0.unwrap(),
204204+ extra_data: Default::default(),
205205+ }
206206+ }
207207+ /// Build the final struct with custom extra_data
208208+ pub fn build_with_data(
209209+ self,
210210+ extra_data: std::collections::BTreeMap<
211211+ jacquard_common::smol_str::SmolStr,
212212+ jacquard_common::types::value::Data<'a>,
213213+ >,
214214+ ) -> Config<'a> {
215215+ Config {
216216+ regions: self.__unsafe_private_named.0.unwrap(),
217217+ extra_data: Some(extra_data),
218218+ }
219219+ }
220220+}
221221+222222+fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
223223+ 'static,
224224+> {
225225+ ::jacquard_lexicon::lexicon::LexiconDoc {
226226+ lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
227227+ id: ::jacquard_common::CowStr::new_static("app.bsky.ageassurance.defs"),
228228+ revision: None,
229229+ description: None,
230230+ defs: {
231231+ let mut map = ::std::collections::BTreeMap::new();
232232+ map.insert(
233233+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
234234+ ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString {
235235+ description: Some(
236236+ ::jacquard_common::CowStr::new_static(
237237+ "The access level granted based on Age Assurance data we've processed.",
238238+ ),
239239+ ),
240240+ format: None,
241241+ default: None,
242242+ min_length: None,
243243+ max_length: None,
244244+ min_graphemes: None,
245245+ max_graphemes: None,
246246+ r#enum: None,
247247+ r#const: None,
248248+ known_values: None,
249249+ }),
250250+ );
251251+ map.insert(
252252+ ::jacquard_common::smol_str::SmolStr::new_static("config"),
253253+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
254254+ description: Some(::jacquard_common::CowStr::new_static("")),
255255+ required: Some(
256256+ vec![::jacquard_common::smol_str::SmolStr::new_static("regions")],
257257+ ),
258258+ nullable: None,
259259+ properties: {
260260+ #[allow(unused_mut)]
261261+ let mut map = ::std::collections::BTreeMap::new();
262262+ map.insert(
263263+ ::jacquard_common::smol_str::SmolStr::new_static("regions"),
264264+ ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
265265+ description: Some(
266266+ ::jacquard_common::CowStr::new_static(
267267+ "The per-region Age Assurance configuration.",
268268+ ),
269269+ ),
270270+ items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
271271+ description: None,
272272+ r#ref: ::jacquard_common::CowStr::new_static(
273273+ "app.bsky.ageassurance.defs#configRegion",
274274+ ),
275275+ }),
276276+ min_length: None,
277277+ max_length: None,
278278+ }),
279279+ );
280280+ map
281281+ },
282282+ }),
283283+ );
284284+ map.insert(
285285+ ::jacquard_common::smol_str::SmolStr::new_static("configRegion"),
286286+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
287287+ description: Some(
288288+ ::jacquard_common::CowStr::new_static(
289289+ "The Age Assurance configuration for a specific region.",
290290+ ),
291291+ ),
292292+ required: Some(
293293+ vec![
294294+ ::jacquard_common::smol_str::SmolStr::new_static("countryCode"),
295295+ ::jacquard_common::smol_str::SmolStr::new_static("rules")
296296+ ],
297297+ ),
298298+ nullable: None,
299299+ properties: {
300300+ #[allow(unused_mut)]
301301+ let mut map = ::std::collections::BTreeMap::new();
302302+ map.insert(
303303+ ::jacquard_common::smol_str::SmolStr::new_static(
304304+ "countryCode",
305305+ ),
306306+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
307307+ description: Some(
308308+ ::jacquard_common::CowStr::new_static(
309309+ "The ISO 3166-1 alpha-2 country code this configuration applies to.",
310310+ ),
311311+ ),
312312+ format: None,
313313+ default: None,
314314+ min_length: None,
315315+ max_length: None,
316316+ min_graphemes: None,
317317+ max_graphemes: None,
318318+ r#enum: None,
319319+ r#const: None,
320320+ known_values: None,
321321+ }),
322322+ );
323323+ map.insert(
324324+ ::jacquard_common::smol_str::SmolStr::new_static(
325325+ "regionCode",
326326+ ),
327327+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
328328+ description: Some(
329329+ ::jacquard_common::CowStr::new_static(
330330+ "The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country.",
331331+ ),
332332+ ),
333333+ format: None,
334334+ default: None,
335335+ min_length: None,
336336+ max_length: None,
337337+ min_graphemes: None,
338338+ max_graphemes: None,
339339+ r#enum: None,
340340+ r#const: None,
341341+ known_values: None,
342342+ }),
343343+ );
344344+ map.insert(
345345+ ::jacquard_common::smol_str::SmolStr::new_static("rules"),
346346+ ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
347347+ description: Some(
348348+ ::jacquard_common::CowStr::new_static(
349349+ "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.",
350350+ ),
351351+ ),
352352+ items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion {
353353+ description: None,
354354+ refs: vec![
355355+ ::jacquard_common::CowStr::new_static("#configRegionRuleDefault"),
356356+ ::jacquard_common::CowStr::new_static("#configRegionRuleIfDeclaredOverAge"),
357357+ ::jacquard_common::CowStr::new_static("#configRegionRuleIfDeclaredUnderAge"),
358358+ ::jacquard_common::CowStr::new_static("#configRegionRuleIfAssuredOverAge"),
359359+ ::jacquard_common::CowStr::new_static("#configRegionRuleIfAssuredUnderAge"),
360360+ ::jacquard_common::CowStr::new_static("#configRegionRuleIfAccountNewerThan"),
361361+ ::jacquard_common::CowStr::new_static("#configRegionRuleIfAccountOlderThan")
362362+ ],
363363+ closed: None,
364364+ }),
365365+ min_length: None,
366366+ max_length: None,
367367+ }),
368368+ );
369369+ map
370370+ },
371371+ }),
372372+ );
373373+ map.insert(
374374+ ::jacquard_common::smol_str::SmolStr::new_static(
375375+ "configRegionRuleDefault",
376376+ ),
377377+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
378378+ description: Some(
379379+ ::jacquard_common::CowStr::new_static(
380380+ "Age Assurance rule that applies by default.",
381381+ ),
382382+ ),
383383+ required: Some(
384384+ vec![::jacquard_common::smol_str::SmolStr::new_static("access")],
385385+ ),
386386+ nullable: None,
387387+ properties: {
388388+ #[allow(unused_mut)]
389389+ let mut map = ::std::collections::BTreeMap::new();
390390+ map.insert(
391391+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
392392+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
393393+ description: None,
394394+ r#ref: ::jacquard_common::CowStr::new_static(
395395+ "app.bsky.ageassurance.defs#access",
396396+ ),
397397+ }),
398398+ );
399399+ map
400400+ },
401401+ }),
402402+ );
403403+ map.insert(
404404+ ::jacquard_common::smol_str::SmolStr::new_static(
405405+ "configRegionRuleIfAccountNewerThan",
406406+ ),
407407+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
408408+ description: Some(
409409+ ::jacquard_common::CowStr::new_static(
410410+ "Age Assurance rule that applies if the account is equal-to or newer than a certain date.",
411411+ ),
412412+ ),
413413+ required: Some(
414414+ vec![
415415+ ::jacquard_common::smol_str::SmolStr::new_static("date"),
416416+ ::jacquard_common::smol_str::SmolStr::new_static("access")
417417+ ],
418418+ ),
419419+ nullable: None,
420420+ properties: {
421421+ #[allow(unused_mut)]
422422+ let mut map = ::std::collections::BTreeMap::new();
423423+ map.insert(
424424+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
425425+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
426426+ description: None,
427427+ r#ref: ::jacquard_common::CowStr::new_static(
428428+ "app.bsky.ageassurance.defs#access",
429429+ ),
430430+ }),
431431+ );
432432+ map.insert(
433433+ ::jacquard_common::smol_str::SmolStr::new_static("date"),
434434+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
435435+ description: Some(
436436+ ::jacquard_common::CowStr::new_static(
437437+ "The date threshold as a datetime string.",
438438+ ),
439439+ ),
440440+ format: Some(
441441+ ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
442442+ ),
443443+ default: None,
444444+ min_length: None,
445445+ max_length: None,
446446+ min_graphemes: None,
447447+ max_graphemes: None,
448448+ r#enum: None,
449449+ r#const: None,
450450+ known_values: None,
451451+ }),
452452+ );
453453+ map
454454+ },
455455+ }),
456456+ );
457457+ map.insert(
458458+ ::jacquard_common::smol_str::SmolStr::new_static(
459459+ "configRegionRuleIfAccountOlderThan",
460460+ ),
461461+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
462462+ description: Some(
463463+ ::jacquard_common::CowStr::new_static(
464464+ "Age Assurance rule that applies if the account is older than a certain date.",
465465+ ),
466466+ ),
467467+ required: Some(
468468+ vec![
469469+ ::jacquard_common::smol_str::SmolStr::new_static("date"),
470470+ ::jacquard_common::smol_str::SmolStr::new_static("access")
471471+ ],
472472+ ),
473473+ nullable: None,
474474+ properties: {
475475+ #[allow(unused_mut)]
476476+ let mut map = ::std::collections::BTreeMap::new();
477477+ map.insert(
478478+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
479479+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
480480+ description: None,
481481+ r#ref: ::jacquard_common::CowStr::new_static(
482482+ "app.bsky.ageassurance.defs#access",
483483+ ),
484484+ }),
485485+ );
486486+ map.insert(
487487+ ::jacquard_common::smol_str::SmolStr::new_static("date"),
488488+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
489489+ description: Some(
490490+ ::jacquard_common::CowStr::new_static(
491491+ "The date threshold as a datetime string.",
492492+ ),
493493+ ),
494494+ format: Some(
495495+ ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
496496+ ),
497497+ default: None,
498498+ min_length: None,
499499+ max_length: None,
500500+ min_graphemes: None,
501501+ max_graphemes: None,
502502+ r#enum: None,
503503+ r#const: None,
504504+ known_values: None,
505505+ }),
506506+ );
507507+ map
508508+ },
509509+ }),
510510+ );
511511+ map.insert(
512512+ ::jacquard_common::smol_str::SmolStr::new_static(
513513+ "configRegionRuleIfAssuredOverAge",
514514+ ),
515515+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
516516+ description: Some(
517517+ ::jacquard_common::CowStr::new_static(
518518+ "Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age.",
519519+ ),
520520+ ),
521521+ required: Some(
522522+ vec![
523523+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
524524+ ::jacquard_common::smol_str::SmolStr::new_static("access")
525525+ ],
526526+ ),
527527+ nullable: None,
528528+ properties: {
529529+ #[allow(unused_mut)]
530530+ let mut map = ::std::collections::BTreeMap::new();
531531+ map.insert(
532532+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
533533+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
534534+ description: None,
535535+ r#ref: ::jacquard_common::CowStr::new_static(
536536+ "app.bsky.ageassurance.defs#access",
537537+ ),
538538+ }),
539539+ );
540540+ map.insert(
541541+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
542542+ ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
543543+ description: None,
544544+ default: None,
545545+ minimum: None,
546546+ maximum: None,
547547+ r#enum: None,
548548+ r#const: None,
549549+ }),
550550+ );
551551+ map
552552+ },
553553+ }),
554554+ );
555555+ map.insert(
556556+ ::jacquard_common::smol_str::SmolStr::new_static(
557557+ "configRegionRuleIfAssuredUnderAge",
558558+ ),
559559+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
560560+ description: Some(
561561+ ::jacquard_common::CowStr::new_static(
562562+ "Age Assurance rule that applies if the user has been assured to be under a certain age.",
563563+ ),
564564+ ),
565565+ required: Some(
566566+ vec![
567567+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
568568+ ::jacquard_common::smol_str::SmolStr::new_static("access")
569569+ ],
570570+ ),
571571+ nullable: None,
572572+ properties: {
573573+ #[allow(unused_mut)]
574574+ let mut map = ::std::collections::BTreeMap::new();
575575+ map.insert(
576576+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
577577+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
578578+ description: None,
579579+ r#ref: ::jacquard_common::CowStr::new_static(
580580+ "app.bsky.ageassurance.defs#access",
581581+ ),
582582+ }),
583583+ );
584584+ map.insert(
585585+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
586586+ ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
587587+ description: None,
588588+ default: None,
589589+ minimum: None,
590590+ maximum: None,
591591+ r#enum: None,
592592+ r#const: None,
593593+ }),
594594+ );
595595+ map
596596+ },
597597+ }),
598598+ );
599599+ map.insert(
600600+ ::jacquard_common::smol_str::SmolStr::new_static(
601601+ "configRegionRuleIfDeclaredOverAge",
602602+ ),
603603+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
604604+ description: Some(
605605+ ::jacquard_common::CowStr::new_static(
606606+ "Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age.",
607607+ ),
608608+ ),
609609+ required: Some(
610610+ vec![
611611+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
612612+ ::jacquard_common::smol_str::SmolStr::new_static("access")
613613+ ],
614614+ ),
615615+ nullable: None,
616616+ properties: {
617617+ #[allow(unused_mut)]
618618+ let mut map = ::std::collections::BTreeMap::new();
619619+ map.insert(
620620+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
621621+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
622622+ description: None,
623623+ r#ref: ::jacquard_common::CowStr::new_static(
624624+ "app.bsky.ageassurance.defs#access",
625625+ ),
626626+ }),
627627+ );
628628+ map.insert(
629629+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
630630+ ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
631631+ description: None,
632632+ default: None,
633633+ minimum: None,
634634+ maximum: None,
635635+ r#enum: None,
636636+ r#const: None,
637637+ }),
638638+ );
639639+ map
640640+ },
641641+ }),
642642+ );
643643+ map.insert(
644644+ ::jacquard_common::smol_str::SmolStr::new_static(
645645+ "configRegionRuleIfDeclaredUnderAge",
646646+ ),
647647+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
648648+ description: Some(
649649+ ::jacquard_common::CowStr::new_static(
650650+ "Age Assurance rule that applies if the user has declared themselves under a certain age.",
651651+ ),
652652+ ),
653653+ required: Some(
654654+ vec![
655655+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
656656+ ::jacquard_common::smol_str::SmolStr::new_static("access")
657657+ ],
658658+ ),
659659+ nullable: None,
660660+ properties: {
661661+ #[allow(unused_mut)]
662662+ let mut map = ::std::collections::BTreeMap::new();
663663+ map.insert(
664664+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
665665+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
666666+ description: None,
667667+ r#ref: ::jacquard_common::CowStr::new_static(
668668+ "app.bsky.ageassurance.defs#access",
669669+ ),
670670+ }),
671671+ );
672672+ map.insert(
673673+ ::jacquard_common::smol_str::SmolStr::new_static("age"),
674674+ ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
675675+ description: None,
676676+ default: None,
677677+ minimum: None,
678678+ maximum: None,
679679+ r#enum: None,
680680+ r#const: None,
681681+ }),
682682+ );
683683+ map
684684+ },
685685+ }),
686686+ );
687687+ map.insert(
688688+ ::jacquard_common::smol_str::SmolStr::new_static("event"),
689689+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
690690+ description: Some(
691691+ ::jacquard_common::CowStr::new_static(
692692+ "Object used to store Age Assurance data in stash.",
693693+ ),
694694+ ),
695695+ required: Some(
696696+ vec![
697697+ ::jacquard_common::smol_str::SmolStr::new_static("createdAt"),
698698+ ::jacquard_common::smol_str::SmolStr::new_static("status"),
699699+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
700700+ ::jacquard_common::smol_str::SmolStr::new_static("attemptId"),
701701+ ::jacquard_common::smol_str::SmolStr::new_static("countryCode")
702702+ ],
703703+ ),
704704+ nullable: None,
705705+ properties: {
706706+ #[allow(unused_mut)]
707707+ let mut map = ::std::collections::BTreeMap::new();
708708+ map.insert(
709709+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
710710+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
711711+ description: Some(
712712+ ::jacquard_common::CowStr::new_static(
713713+ "The access level granted based on Age Assurance data we've processed.",
714714+ ),
715715+ ),
716716+ format: None,
717717+ default: None,
718718+ min_length: None,
719719+ max_length: None,
720720+ min_graphemes: None,
721721+ max_graphemes: None,
722722+ r#enum: None,
723723+ r#const: None,
724724+ known_values: None,
725725+ }),
726726+ );
727727+ map.insert(
728728+ ::jacquard_common::smol_str::SmolStr::new_static(
729729+ "attemptId",
730730+ ),
731731+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
732732+ description: Some(
733733+ ::jacquard_common::CowStr::new_static(
734734+ "The unique identifier for this instance of the Age Assurance flow, in UUID format.",
735735+ ),
736736+ ),
737737+ format: None,
738738+ default: None,
739739+ min_length: None,
740740+ max_length: None,
741741+ min_graphemes: None,
742742+ max_graphemes: None,
743743+ r#enum: None,
744744+ r#const: None,
745745+ known_values: None,
746746+ }),
747747+ );
748748+ map.insert(
749749+ ::jacquard_common::smol_str::SmolStr::new_static(
750750+ "completeIp",
751751+ ),
752752+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
753753+ description: Some(
754754+ ::jacquard_common::CowStr::new_static(
755755+ "The IP address used when completing the Age Assurance flow.",
756756+ ),
757757+ ),
758758+ format: None,
759759+ default: None,
760760+ min_length: None,
761761+ max_length: None,
762762+ min_graphemes: None,
763763+ max_graphemes: None,
764764+ r#enum: None,
765765+ r#const: None,
766766+ known_values: None,
767767+ }),
768768+ );
769769+ map.insert(
770770+ ::jacquard_common::smol_str::SmolStr::new_static(
771771+ "completeUa",
772772+ ),
773773+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
774774+ description: Some(
775775+ ::jacquard_common::CowStr::new_static(
776776+ "The user agent used when completing the Age Assurance flow.",
777777+ ),
778778+ ),
779779+ format: None,
780780+ default: None,
781781+ min_length: None,
782782+ max_length: None,
783783+ min_graphemes: None,
784784+ max_graphemes: None,
785785+ r#enum: None,
786786+ r#const: None,
787787+ known_values: None,
788788+ }),
789789+ );
790790+ map.insert(
791791+ ::jacquard_common::smol_str::SmolStr::new_static(
792792+ "countryCode",
793793+ ),
794794+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
795795+ description: Some(
796796+ ::jacquard_common::CowStr::new_static(
797797+ "The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.",
798798+ ),
799799+ ),
800800+ format: None,
801801+ default: None,
802802+ min_length: None,
803803+ max_length: None,
804804+ min_graphemes: None,
805805+ max_graphemes: None,
806806+ r#enum: None,
807807+ r#const: None,
808808+ known_values: None,
809809+ }),
810810+ );
811811+ map.insert(
812812+ ::jacquard_common::smol_str::SmolStr::new_static(
813813+ "createdAt",
814814+ ),
815815+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
816816+ description: Some(
817817+ ::jacquard_common::CowStr::new_static(
818818+ "The date and time of this write operation.",
819819+ ),
820820+ ),
821821+ format: Some(
822822+ ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
823823+ ),
824824+ default: None,
825825+ min_length: None,
826826+ max_length: None,
827827+ min_graphemes: None,
828828+ max_graphemes: None,
829829+ r#enum: None,
830830+ r#const: None,
831831+ known_values: None,
832832+ }),
833833+ );
834834+ map.insert(
835835+ ::jacquard_common::smol_str::SmolStr::new_static("email"),
836836+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
837837+ description: Some(
838838+ ::jacquard_common::CowStr::new_static(
839839+ "The email used for Age Assurance.",
840840+ ),
841841+ ),
842842+ format: None,
843843+ default: None,
844844+ min_length: None,
845845+ max_length: None,
846846+ min_graphemes: None,
847847+ max_graphemes: None,
848848+ r#enum: None,
849849+ r#const: None,
850850+ known_values: None,
851851+ }),
852852+ );
853853+ map.insert(
854854+ ::jacquard_common::smol_str::SmolStr::new_static("initIp"),
855855+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
856856+ description: Some(
857857+ ::jacquard_common::CowStr::new_static(
858858+ "The IP address used when initiating the Age Assurance flow.",
859859+ ),
860860+ ),
861861+ format: None,
862862+ default: None,
863863+ min_length: None,
864864+ max_length: None,
865865+ min_graphemes: None,
866866+ max_graphemes: None,
867867+ r#enum: None,
868868+ r#const: None,
869869+ known_values: None,
870870+ }),
871871+ );
872872+ map.insert(
873873+ ::jacquard_common::smol_str::SmolStr::new_static("initUa"),
874874+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
875875+ description: Some(
876876+ ::jacquard_common::CowStr::new_static(
877877+ "The user agent used when initiating the Age Assurance flow.",
878878+ ),
879879+ ),
880880+ format: None,
881881+ default: None,
882882+ min_length: None,
883883+ max_length: None,
884884+ min_graphemes: None,
885885+ max_graphemes: None,
886886+ r#enum: None,
887887+ r#const: None,
888888+ known_values: None,
889889+ }),
890890+ );
891891+ map.insert(
892892+ ::jacquard_common::smol_str::SmolStr::new_static(
893893+ "regionCode",
894894+ ),
895895+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
896896+ description: Some(
897897+ ::jacquard_common::CowStr::new_static(
898898+ "The ISO 3166-2 region code provided when beginning the Age Assurance flow.",
899899+ ),
900900+ ),
901901+ format: None,
902902+ default: None,
903903+ min_length: None,
904904+ max_length: None,
905905+ min_graphemes: None,
906906+ max_graphemes: None,
907907+ r#enum: None,
908908+ r#const: None,
909909+ known_values: None,
910910+ }),
911911+ );
912912+ map.insert(
913913+ ::jacquard_common::smol_str::SmolStr::new_static("status"),
914914+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
915915+ description: Some(
916916+ ::jacquard_common::CowStr::new_static(
917917+ "The status of the Age Assurance process.",
918918+ ),
919919+ ),
920920+ format: None,
921921+ default: None,
922922+ min_length: None,
923923+ max_length: None,
924924+ min_graphemes: None,
925925+ max_graphemes: None,
926926+ r#enum: None,
927927+ r#const: None,
928928+ known_values: None,
929929+ }),
930930+ );
931931+ map
932932+ },
933933+ }),
934934+ );
935935+ map.insert(
936936+ ::jacquard_common::smol_str::SmolStr::new_static("state"),
937937+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
938938+ description: Some(
939939+ ::jacquard_common::CowStr::new_static(
940940+ "The user's computed Age Assurance state.",
941941+ ),
942942+ ),
943943+ required: Some(
944944+ vec![
945945+ ::jacquard_common::smol_str::SmolStr::new_static("status"),
946946+ ::jacquard_common::smol_str::SmolStr::new_static("access")
947947+ ],
948948+ ),
949949+ nullable: None,
950950+ properties: {
951951+ #[allow(unused_mut)]
952952+ let mut map = ::std::collections::BTreeMap::new();
953953+ map.insert(
954954+ ::jacquard_common::smol_str::SmolStr::new_static("access"),
955955+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
956956+ description: None,
957957+ r#ref: ::jacquard_common::CowStr::new_static(
958958+ "app.bsky.ageassurance.defs#access",
959959+ ),
960960+ }),
961961+ );
962962+ map.insert(
963963+ ::jacquard_common::smol_str::SmolStr::new_static(
964964+ "lastInitiatedAt",
965965+ ),
966966+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
967967+ description: Some(
968968+ ::jacquard_common::CowStr::new_static(
969969+ "The timestamp when this state was last updated.",
970970+ ),
971971+ ),
972972+ format: Some(
973973+ ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
974974+ ),
975975+ default: None,
976976+ min_length: None,
977977+ max_length: None,
978978+ min_graphemes: None,
979979+ max_graphemes: None,
980980+ r#enum: None,
981981+ r#const: None,
982982+ known_values: None,
983983+ }),
984984+ );
985985+ map.insert(
986986+ ::jacquard_common::smol_str::SmolStr::new_static("status"),
987987+ ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
988988+ description: None,
989989+ r#ref: ::jacquard_common::CowStr::new_static(
990990+ "app.bsky.ageassurance.defs#status",
991991+ ),
992992+ }),
993993+ );
994994+ map
995995+ },
996996+ }),
997997+ );
998998+ map.insert(
999999+ ::jacquard_common::smol_str::SmolStr::new_static("stateMetadata"),
10001000+ ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
10011001+ description: Some(
10021002+ ::jacquard_common::CowStr::new_static(
10031003+ "Additional metadata needed to compute Age Assurance state client-side.",
10041004+ ),
10051005+ ),
10061006+ required: Some(vec![]),
10071007+ nullable: None,
10081008+ properties: {
10091009+ #[allow(unused_mut)]
10101010+ let mut map = ::std::collections::BTreeMap::new();
10111011+ map.insert(
10121012+ ::jacquard_common::smol_str::SmolStr::new_static(
10131013+ "accountCreatedAt",
10141014+ ),
10151015+ ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
10161016+ description: Some(
10171017+ ::jacquard_common::CowStr::new_static(
10181018+ "The account creation timestamp.",
10191019+ ),
10201020+ ),
10211021+ format: Some(
10221022+ ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
10231023+ ),
10241024+ default: None,
10251025+ min_length: None,
10261026+ max_length: None,
10271027+ min_graphemes: None,
10281028+ max_graphemes: None,
10291029+ r#enum: None,
10301030+ r#const: None,
10311031+ known_values: None,
10321032+ }),
10331033+ );
10341034+ map
10351035+ },
10361036+ }),
10371037+ );
10381038+ map.insert(
10391039+ ::jacquard_common::smol_str::SmolStr::new_static("status"),
10401040+ ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString {
10411041+ description: Some(
10421042+ ::jacquard_common::CowStr::new_static(
10431043+ "The status of the Age Assurance process.",
10441044+ ),
10451045+ ),
10461046+ format: None,
10471047+ default: None,
10481048+ min_length: None,
10491049+ max_length: None,
10501050+ min_graphemes: None,
10511051+ max_graphemes: None,
10521052+ r#enum: None,
10531053+ r#const: None,
10541054+ known_values: None,
10551055+ }),
10561056+ );
10571057+ map
10581058+ },
10591059+ }
10601060+}
10611061+10621062+impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Config<'a> {
10631063+ fn nsid() -> &'static str {
10641064+ "app.bsky.ageassurance.defs"
10651065+ }
10661066+ fn def_name() -> &'static str {
10671067+ "config"
10681068+ }
10691069+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
10701070+ lexicon_doc_app_bsky_ageassurance_defs()
10711071+ }
10721072+ fn validate(
10731073+ &self,
10741074+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
10751075+ Ok(())
10761076+ }
10771077+}
10781078+10791079+/// The Age Assurance configuration for a specific region.
10801080+#[jacquard_derive::lexicon]
10811081+#[derive(
10821082+ serde::Serialize,
10831083+ serde::Deserialize,
10841084+ Debug,
10851085+ Clone,
10861086+ PartialEq,
10871087+ Eq,
10881088+ jacquard_derive::IntoStatic
10891089+)]
10901090+#[serde(rename_all = "camelCase")]
10911091+pub struct ConfigRegion<'a> {
10921092+ /// The ISO 3166-1 alpha-2 country code this configuration applies to.
10931093+ #[serde(borrow)]
10941094+ pub country_code: jacquard_common::CowStr<'a>,
10951095+ /// The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country.
10961096+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
10971097+ #[serde(borrow)]
10981098+ pub region_code: std::option::Option<jacquard_common::CowStr<'a>>,
10991099+ /// 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.
11001100+ #[serde(borrow)]
11011101+ pub rules: Vec<ConfigRegionRulesItem<'a>>,
11021102+}
11031103+11041104+pub mod config_region_state {
11051105+11061106+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
11071107+ #[allow(unused)]
11081108+ use ::core::marker::PhantomData;
11091109+ mod sealed {
11101110+ pub trait Sealed {}
11111111+ }
11121112+ /// State trait tracking which required fields have been set
11131113+ pub trait State: sealed::Sealed {
11141114+ type CountryCode;
11151115+ type Rules;
11161116+ }
11171117+ /// Empty state - all required fields are unset
11181118+ pub struct Empty(());
11191119+ impl sealed::Sealed for Empty {}
11201120+ impl State for Empty {
11211121+ type CountryCode = Unset;
11221122+ type Rules = Unset;
11231123+ }
11241124+ ///State transition - sets the `country_code` field to Set
11251125+ pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
11261126+ impl<S: State> sealed::Sealed for SetCountryCode<S> {}
11271127+ impl<S: State> State for SetCountryCode<S> {
11281128+ type CountryCode = Set<members::country_code>;
11291129+ type Rules = S::Rules;
11301130+ }
11311131+ ///State transition - sets the `rules` field to Set
11321132+ pub struct SetRules<S: State = Empty>(PhantomData<fn() -> S>);
11331133+ impl<S: State> sealed::Sealed for SetRules<S> {}
11341134+ impl<S: State> State for SetRules<S> {
11351135+ type CountryCode = S::CountryCode;
11361136+ type Rules = Set<members::rules>;
11371137+ }
11381138+ /// Marker types for field names
11391139+ #[allow(non_camel_case_types)]
11401140+ pub mod members {
11411141+ ///Marker type for the `country_code` field
11421142+ pub struct country_code(());
11431143+ ///Marker type for the `rules` field
11441144+ pub struct rules(());
11451145+ }
11461146+}
11471147+11481148+/// Builder for constructing an instance of this type
11491149+pub struct ConfigRegionBuilder<'a, S: config_region_state::State> {
11501150+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
11511151+ __unsafe_private_named: (
11521152+ ::core::option::Option<jacquard_common::CowStr<'a>>,
11531153+ ::core::option::Option<jacquard_common::CowStr<'a>>,
11541154+ ::core::option::Option<Vec<ConfigRegionRulesItem<'a>>>,
11551155+ ),
11561156+ _phantom: ::core::marker::PhantomData<&'a ()>,
11571157+}
11581158+11591159+impl<'a> ConfigRegion<'a> {
11601160+ /// Create a new builder for this type
11611161+ pub fn new() -> ConfigRegionBuilder<'a, config_region_state::Empty> {
11621162+ ConfigRegionBuilder::new()
11631163+ }
11641164+}
11651165+11661166+impl<'a> ConfigRegionBuilder<'a, config_region_state::Empty> {
11671167+ /// Create a new builder with all fields unset
11681168+ pub fn new() -> Self {
11691169+ ConfigRegionBuilder {
11701170+ _phantom_state: ::core::marker::PhantomData,
11711171+ __unsafe_private_named: (None, None, None),
11721172+ _phantom: ::core::marker::PhantomData,
11731173+ }
11741174+ }
11751175+}
11761176+11771177+impl<'a, S> ConfigRegionBuilder<'a, S>
11781178+where
11791179+ S: config_region_state::State,
11801180+ S::CountryCode: config_region_state::IsUnset,
11811181+{
11821182+ /// Set the `countryCode` field (required)
11831183+ pub fn country_code(
11841184+ mut self,
11851185+ value: impl Into<jacquard_common::CowStr<'a>>,
11861186+ ) -> ConfigRegionBuilder<'a, config_region_state::SetCountryCode<S>> {
11871187+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
11881188+ ConfigRegionBuilder {
11891189+ _phantom_state: ::core::marker::PhantomData,
11901190+ __unsafe_private_named: self.__unsafe_private_named,
11911191+ _phantom: ::core::marker::PhantomData,
11921192+ }
11931193+ }
11941194+}
11951195+11961196+impl<'a, S: config_region_state::State> ConfigRegionBuilder<'a, S> {
11971197+ /// Set the `regionCode` field (optional)
11981198+ pub fn region_code(
11991199+ mut self,
12001200+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
12011201+ ) -> Self {
12021202+ self.__unsafe_private_named.1 = value.into();
12031203+ self
12041204+ }
12051205+ /// Set the `regionCode` field to an Option value (optional)
12061206+ pub fn maybe_region_code(
12071207+ mut self,
12081208+ value: Option<jacquard_common::CowStr<'a>>,
12091209+ ) -> Self {
12101210+ self.__unsafe_private_named.1 = value;
12111211+ self
12121212+ }
12131213+}
12141214+12151215+impl<'a, S> ConfigRegionBuilder<'a, S>
12161216+where
12171217+ S: config_region_state::State,
12181218+ S::Rules: config_region_state::IsUnset,
12191219+{
12201220+ /// Set the `rules` field (required)
12211221+ pub fn rules(
12221222+ mut self,
12231223+ value: impl Into<Vec<ConfigRegionRulesItem<'a>>>,
12241224+ ) -> ConfigRegionBuilder<'a, config_region_state::SetRules<S>> {
12251225+ self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
12261226+ ConfigRegionBuilder {
12271227+ _phantom_state: ::core::marker::PhantomData,
12281228+ __unsafe_private_named: self.__unsafe_private_named,
12291229+ _phantom: ::core::marker::PhantomData,
12301230+ }
12311231+ }
12321232+}
12331233+12341234+impl<'a, S> ConfigRegionBuilder<'a, S>
12351235+where
12361236+ S: config_region_state::State,
12371237+ S::CountryCode: config_region_state::IsSet,
12381238+ S::Rules: config_region_state::IsSet,
12391239+{
12401240+ /// Build the final struct
12411241+ pub fn build(self) -> ConfigRegion<'a> {
12421242+ ConfigRegion {
12431243+ country_code: self.__unsafe_private_named.0.unwrap(),
12441244+ region_code: self.__unsafe_private_named.1,
12451245+ rules: self.__unsafe_private_named.2.unwrap(),
12461246+ extra_data: Default::default(),
12471247+ }
12481248+ }
12491249+ /// Build the final struct with custom extra_data
12501250+ pub fn build_with_data(
12511251+ self,
12521252+ extra_data: std::collections::BTreeMap<
12531253+ jacquard_common::smol_str::SmolStr,
12541254+ jacquard_common::types::value::Data<'a>,
12551255+ >,
12561256+ ) -> ConfigRegion<'a> {
12571257+ ConfigRegion {
12581258+ country_code: self.__unsafe_private_named.0.unwrap(),
12591259+ region_code: self.__unsafe_private_named.1,
12601260+ rules: self.__unsafe_private_named.2.unwrap(),
12611261+ extra_data: Some(extra_data),
12621262+ }
12631263+ }
12641264+}
12651265+12661266+#[jacquard_derive::open_union]
12671267+#[derive(
12681268+ serde::Serialize,
12691269+ serde::Deserialize,
12701270+ Debug,
12711271+ Clone,
12721272+ PartialEq,
12731273+ Eq,
12741274+ jacquard_derive::IntoStatic
12751275+)]
12761276+#[serde(tag = "$type")]
12771277+#[serde(bound(deserialize = "'de: 'a"))]
12781278+pub enum ConfigRegionRulesItem<'a> {
12791279+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleDefault")]
12801280+ ConfigRegionRuleDefault(
12811281+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleDefault<'a>>,
12821282+ ),
12831283+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge")]
12841284+ ConfigRegionRuleIfDeclaredOverAge(
12851285+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleIfDeclaredOverAge<'a>>,
12861286+ ),
12871287+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge")]
12881288+ ConfigRegionRuleIfDeclaredUnderAge(
12891289+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleIfDeclaredUnderAge<'a>>,
12901290+ ),
12911291+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge")]
12921292+ ConfigRegionRuleIfAssuredOverAge(
12931293+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleIfAssuredOverAge<'a>>,
12941294+ ),
12951295+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge")]
12961296+ ConfigRegionRuleIfAssuredUnderAge(
12971297+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleIfAssuredUnderAge<'a>>,
12981298+ ),
12991299+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan")]
13001300+ ConfigRegionRuleIfAccountNewerThan(
13011301+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleIfAccountNewerThan<'a>>,
13021302+ ),
13031303+ #[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan")]
13041304+ ConfigRegionRuleIfAccountOlderThan(
13051305+ Box<crate::app_bsky::ageassurance::ConfigRegionRuleIfAccountOlderThan<'a>>,
13061306+ ),
13071307+}
13081308+13091309+impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ConfigRegion<'a> {
13101310+ fn nsid() -> &'static str {
13111311+ "app.bsky.ageassurance.defs"
13121312+ }
13131313+ fn def_name() -> &'static str {
13141314+ "configRegion"
13151315+ }
13161316+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
13171317+ lexicon_doc_app_bsky_ageassurance_defs()
13181318+ }
13191319+ fn validate(
13201320+ &self,
13211321+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
13221322+ Ok(())
13231323+ }
13241324+}
13251325+13261326+/// Age Assurance rule that applies by default.
13271327+#[jacquard_derive::lexicon]
13281328+#[derive(
13291329+ serde::Serialize,
13301330+ serde::Deserialize,
13311331+ Debug,
13321332+ Clone,
13331333+ PartialEq,
13341334+ Eq,
13351335+ jacquard_derive::IntoStatic
13361336+)]
13371337+#[serde(rename_all = "camelCase")]
13381338+pub struct ConfigRegionRuleDefault<'a> {
13391339+ #[serde(borrow)]
13401340+ pub access: crate::app_bsky::ageassurance::Access<'a>,
13411341+}
13421342+13431343+pub mod config_region_rule_default_state {
13441344+13451345+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
13461346+ #[allow(unused)]
13471347+ use ::core::marker::PhantomData;
13481348+ mod sealed {
13491349+ pub trait Sealed {}
13501350+ }
13511351+ /// State trait tracking which required fields have been set
13521352+ pub trait State: sealed::Sealed {
13531353+ type Access;
13541354+ }
13551355+ /// Empty state - all required fields are unset
13561356+ pub struct Empty(());
13571357+ impl sealed::Sealed for Empty {}
13581358+ impl State for Empty {
13591359+ type Access = Unset;
13601360+ }
13611361+ ///State transition - sets the `access` field to Set
13621362+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
13631363+ impl<S: State> sealed::Sealed for SetAccess<S> {}
13641364+ impl<S: State> State for SetAccess<S> {
13651365+ type Access = Set<members::access>;
13661366+ }
13671367+ /// Marker types for field names
13681368+ #[allow(non_camel_case_types)]
13691369+ pub mod members {
13701370+ ///Marker type for the `access` field
13711371+ pub struct access(());
13721372+ }
13731373+}
13741374+13751375+/// Builder for constructing an instance of this type
13761376+pub struct ConfigRegionRuleDefaultBuilder<
13771377+ 'a,
13781378+ S: config_region_rule_default_state::State,
13791379+> {
13801380+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
13811381+ __unsafe_private_named: (
13821382+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
13831383+ ),
13841384+ _phantom: ::core::marker::PhantomData<&'a ()>,
13851385+}
13861386+13871387+impl<'a> ConfigRegionRuleDefault<'a> {
13881388+ /// Create a new builder for this type
13891389+ pub fn new() -> ConfigRegionRuleDefaultBuilder<
13901390+ 'a,
13911391+ config_region_rule_default_state::Empty,
13921392+ > {
13931393+ ConfigRegionRuleDefaultBuilder::new()
13941394+ }
13951395+}
13961396+13971397+impl<'a> ConfigRegionRuleDefaultBuilder<'a, config_region_rule_default_state::Empty> {
13981398+ /// Create a new builder with all fields unset
13991399+ pub fn new() -> Self {
14001400+ ConfigRegionRuleDefaultBuilder {
14011401+ _phantom_state: ::core::marker::PhantomData,
14021402+ __unsafe_private_named: (None,),
14031403+ _phantom: ::core::marker::PhantomData,
14041404+ }
14051405+ }
14061406+}
14071407+14081408+impl<'a, S> ConfigRegionRuleDefaultBuilder<'a, S>
14091409+where
14101410+ S: config_region_rule_default_state::State,
14111411+ S::Access: config_region_rule_default_state::IsUnset,
14121412+{
14131413+ /// Set the `access` field (required)
14141414+ pub fn access(
14151415+ mut self,
14161416+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
14171417+ ) -> ConfigRegionRuleDefaultBuilder<
14181418+ 'a,
14191419+ config_region_rule_default_state::SetAccess<S>,
14201420+ > {
14211421+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
14221422+ ConfigRegionRuleDefaultBuilder {
14231423+ _phantom_state: ::core::marker::PhantomData,
14241424+ __unsafe_private_named: self.__unsafe_private_named,
14251425+ _phantom: ::core::marker::PhantomData,
14261426+ }
14271427+ }
14281428+}
14291429+14301430+impl<'a, S> ConfigRegionRuleDefaultBuilder<'a, S>
14311431+where
14321432+ S: config_region_rule_default_state::State,
14331433+ S::Access: config_region_rule_default_state::IsSet,
14341434+{
14351435+ /// Build the final struct
14361436+ pub fn build(self) -> ConfigRegionRuleDefault<'a> {
14371437+ ConfigRegionRuleDefault {
14381438+ access: self.__unsafe_private_named.0.unwrap(),
14391439+ extra_data: Default::default(),
14401440+ }
14411441+ }
14421442+ /// Build the final struct with custom extra_data
14431443+ pub fn build_with_data(
14441444+ self,
14451445+ extra_data: std::collections::BTreeMap<
14461446+ jacquard_common::smol_str::SmolStr,
14471447+ jacquard_common::types::value::Data<'a>,
14481448+ >,
14491449+ ) -> ConfigRegionRuleDefault<'a> {
14501450+ ConfigRegionRuleDefault {
14511451+ access: self.__unsafe_private_named.0.unwrap(),
14521452+ extra_data: Some(extra_data),
14531453+ }
14541454+ }
14551455+}
14561456+14571457+impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ConfigRegionRuleDefault<'a> {
14581458+ fn nsid() -> &'static str {
14591459+ "app.bsky.ageassurance.defs"
14601460+ }
14611461+ fn def_name() -> &'static str {
14621462+ "configRegionRuleDefault"
14631463+ }
14641464+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
14651465+ lexicon_doc_app_bsky_ageassurance_defs()
14661466+ }
14671467+ fn validate(
14681468+ &self,
14691469+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
14701470+ Ok(())
14711471+ }
14721472+}
14731473+14741474+/// Age Assurance rule that applies if the account is equal-to or newer than a certain date.
14751475+#[jacquard_derive::lexicon]
14761476+#[derive(
14771477+ serde::Serialize,
14781478+ serde::Deserialize,
14791479+ Debug,
14801480+ Clone,
14811481+ PartialEq,
14821482+ Eq,
14831483+ jacquard_derive::IntoStatic
14841484+)]
14851485+#[serde(rename_all = "camelCase")]
14861486+pub struct ConfigRegionRuleIfAccountNewerThan<'a> {
14871487+ #[serde(borrow)]
14881488+ pub access: crate::app_bsky::ageassurance::Access<'a>,
14891489+ /// The date threshold as a datetime string.
14901490+ pub date: jacquard_common::types::string::Datetime,
14911491+}
14921492+14931493+pub mod config_region_rule_if_account_newer_than_state {
14941494+14951495+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
14961496+ #[allow(unused)]
14971497+ use ::core::marker::PhantomData;
14981498+ mod sealed {
14991499+ pub trait Sealed {}
15001500+ }
15011501+ /// State trait tracking which required fields have been set
15021502+ pub trait State: sealed::Sealed {
15031503+ type Date;
15041504+ type Access;
15051505+ }
15061506+ /// Empty state - all required fields are unset
15071507+ pub struct Empty(());
15081508+ impl sealed::Sealed for Empty {}
15091509+ impl State for Empty {
15101510+ type Date = Unset;
15111511+ type Access = Unset;
15121512+ }
15131513+ ///State transition - sets the `date` field to Set
15141514+ pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>);
15151515+ impl<S: State> sealed::Sealed for SetDate<S> {}
15161516+ impl<S: State> State for SetDate<S> {
15171517+ type Date = Set<members::date>;
15181518+ type Access = S::Access;
15191519+ }
15201520+ ///State transition - sets the `access` field to Set
15211521+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
15221522+ impl<S: State> sealed::Sealed for SetAccess<S> {}
15231523+ impl<S: State> State for SetAccess<S> {
15241524+ type Date = S::Date;
15251525+ type Access = Set<members::access>;
15261526+ }
15271527+ /// Marker types for field names
15281528+ #[allow(non_camel_case_types)]
15291529+ pub mod members {
15301530+ ///Marker type for the `date` field
15311531+ pub struct date(());
15321532+ ///Marker type for the `access` field
15331533+ pub struct access(());
15341534+ }
15351535+}
15361536+15371537+/// Builder for constructing an instance of this type
15381538+pub struct ConfigRegionRuleIfAccountNewerThanBuilder<
15391539+ 'a,
15401540+ S: config_region_rule_if_account_newer_than_state::State,
15411541+> {
15421542+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
15431543+ __unsafe_private_named: (
15441544+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
15451545+ ::core::option::Option<jacquard_common::types::string::Datetime>,
15461546+ ),
15471547+ _phantom: ::core::marker::PhantomData<&'a ()>,
15481548+}
15491549+15501550+impl<'a> ConfigRegionRuleIfAccountNewerThan<'a> {
15511551+ /// Create a new builder for this type
15521552+ pub fn new() -> ConfigRegionRuleIfAccountNewerThanBuilder<
15531553+ 'a,
15541554+ config_region_rule_if_account_newer_than_state::Empty,
15551555+ > {
15561556+ ConfigRegionRuleIfAccountNewerThanBuilder::new()
15571557+ }
15581558+}
15591559+15601560+impl<
15611561+ 'a,
15621562+> ConfigRegionRuleIfAccountNewerThanBuilder<
15631563+ 'a,
15641564+ config_region_rule_if_account_newer_than_state::Empty,
15651565+> {
15661566+ /// Create a new builder with all fields unset
15671567+ pub fn new() -> Self {
15681568+ ConfigRegionRuleIfAccountNewerThanBuilder {
15691569+ _phantom_state: ::core::marker::PhantomData,
15701570+ __unsafe_private_named: (None, None),
15711571+ _phantom: ::core::marker::PhantomData,
15721572+ }
15731573+ }
15741574+}
15751575+15761576+impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
15771577+where
15781578+ S: config_region_rule_if_account_newer_than_state::State,
15791579+ S::Access: config_region_rule_if_account_newer_than_state::IsUnset,
15801580+{
15811581+ /// Set the `access` field (required)
15821582+ pub fn access(
15831583+ mut self,
15841584+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
15851585+ ) -> ConfigRegionRuleIfAccountNewerThanBuilder<
15861586+ 'a,
15871587+ config_region_rule_if_account_newer_than_state::SetAccess<S>,
15881588+ > {
15891589+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
15901590+ ConfigRegionRuleIfAccountNewerThanBuilder {
15911591+ _phantom_state: ::core::marker::PhantomData,
15921592+ __unsafe_private_named: self.__unsafe_private_named,
15931593+ _phantom: ::core::marker::PhantomData,
15941594+ }
15951595+ }
15961596+}
15971597+15981598+impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
15991599+where
16001600+ S: config_region_rule_if_account_newer_than_state::State,
16011601+ S::Date: config_region_rule_if_account_newer_than_state::IsUnset,
16021602+{
16031603+ /// Set the `date` field (required)
16041604+ pub fn date(
16051605+ mut self,
16061606+ value: impl Into<jacquard_common::types::string::Datetime>,
16071607+ ) -> ConfigRegionRuleIfAccountNewerThanBuilder<
16081608+ 'a,
16091609+ config_region_rule_if_account_newer_than_state::SetDate<S>,
16101610+ > {
16111611+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
16121612+ ConfigRegionRuleIfAccountNewerThanBuilder {
16131613+ _phantom_state: ::core::marker::PhantomData,
16141614+ __unsafe_private_named: self.__unsafe_private_named,
16151615+ _phantom: ::core::marker::PhantomData,
16161616+ }
16171617+ }
16181618+}
16191619+16201620+impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
16211621+where
16221622+ S: config_region_rule_if_account_newer_than_state::State,
16231623+ S::Date: config_region_rule_if_account_newer_than_state::IsSet,
16241624+ S::Access: config_region_rule_if_account_newer_than_state::IsSet,
16251625+{
16261626+ /// Build the final struct
16271627+ pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<'a> {
16281628+ ConfigRegionRuleIfAccountNewerThan {
16291629+ access: self.__unsafe_private_named.0.unwrap(),
16301630+ date: self.__unsafe_private_named.1.unwrap(),
16311631+ extra_data: Default::default(),
16321632+ }
16331633+ }
16341634+ /// Build the final struct with custom extra_data
16351635+ pub fn build_with_data(
16361636+ self,
16371637+ extra_data: std::collections::BTreeMap<
16381638+ jacquard_common::smol_str::SmolStr,
16391639+ jacquard_common::types::value::Data<'a>,
16401640+ >,
16411641+ ) -> ConfigRegionRuleIfAccountNewerThan<'a> {
16421642+ ConfigRegionRuleIfAccountNewerThan {
16431643+ access: self.__unsafe_private_named.0.unwrap(),
16441644+ date: self.__unsafe_private_named.1.unwrap(),
16451645+ extra_data: Some(extra_data),
16461646+ }
16471647+ }
16481648+}
16491649+16501650+impl<'a> ::jacquard_lexicon::schema::LexiconSchema
16511651+for ConfigRegionRuleIfAccountNewerThan<'a> {
16521652+ fn nsid() -> &'static str {
16531653+ "app.bsky.ageassurance.defs"
16541654+ }
16551655+ fn def_name() -> &'static str {
16561656+ "configRegionRuleIfAccountNewerThan"
16571657+ }
16581658+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
16591659+ lexicon_doc_app_bsky_ageassurance_defs()
16601660+ }
16611661+ fn validate(
16621662+ &self,
16631663+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
16641664+ Ok(())
16651665+ }
16661666+}
16671667+16681668+/// Age Assurance rule that applies if the account is older than a certain date.
16691669+#[jacquard_derive::lexicon]
16701670+#[derive(
16711671+ serde::Serialize,
16721672+ serde::Deserialize,
16731673+ Debug,
16741674+ Clone,
16751675+ PartialEq,
16761676+ Eq,
16771677+ jacquard_derive::IntoStatic
16781678+)]
16791679+#[serde(rename_all = "camelCase")]
16801680+pub struct ConfigRegionRuleIfAccountOlderThan<'a> {
16811681+ #[serde(borrow)]
16821682+ pub access: crate::app_bsky::ageassurance::Access<'a>,
16831683+ /// The date threshold as a datetime string.
16841684+ pub date: jacquard_common::types::string::Datetime,
16851685+}
16861686+16871687+pub mod config_region_rule_if_account_older_than_state {
16881688+16891689+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
16901690+ #[allow(unused)]
16911691+ use ::core::marker::PhantomData;
16921692+ mod sealed {
16931693+ pub trait Sealed {}
16941694+ }
16951695+ /// State trait tracking which required fields have been set
16961696+ pub trait State: sealed::Sealed {
16971697+ type Date;
16981698+ type Access;
16991699+ }
17001700+ /// Empty state - all required fields are unset
17011701+ pub struct Empty(());
17021702+ impl sealed::Sealed for Empty {}
17031703+ impl State for Empty {
17041704+ type Date = Unset;
17051705+ type Access = Unset;
17061706+ }
17071707+ ///State transition - sets the `date` field to Set
17081708+ pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>);
17091709+ impl<S: State> sealed::Sealed for SetDate<S> {}
17101710+ impl<S: State> State for SetDate<S> {
17111711+ type Date = Set<members::date>;
17121712+ type Access = S::Access;
17131713+ }
17141714+ ///State transition - sets the `access` field to Set
17151715+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
17161716+ impl<S: State> sealed::Sealed for SetAccess<S> {}
17171717+ impl<S: State> State for SetAccess<S> {
17181718+ type Date = S::Date;
17191719+ type Access = Set<members::access>;
17201720+ }
17211721+ /// Marker types for field names
17221722+ #[allow(non_camel_case_types)]
17231723+ pub mod members {
17241724+ ///Marker type for the `date` field
17251725+ pub struct date(());
17261726+ ///Marker type for the `access` field
17271727+ pub struct access(());
17281728+ }
17291729+}
17301730+17311731+/// Builder for constructing an instance of this type
17321732+pub struct ConfigRegionRuleIfAccountOlderThanBuilder<
17331733+ 'a,
17341734+ S: config_region_rule_if_account_older_than_state::State,
17351735+> {
17361736+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
17371737+ __unsafe_private_named: (
17381738+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
17391739+ ::core::option::Option<jacquard_common::types::string::Datetime>,
17401740+ ),
17411741+ _phantom: ::core::marker::PhantomData<&'a ()>,
17421742+}
17431743+17441744+impl<'a> ConfigRegionRuleIfAccountOlderThan<'a> {
17451745+ /// Create a new builder for this type
17461746+ pub fn new() -> ConfigRegionRuleIfAccountOlderThanBuilder<
17471747+ 'a,
17481748+ config_region_rule_if_account_older_than_state::Empty,
17491749+ > {
17501750+ ConfigRegionRuleIfAccountOlderThanBuilder::new()
17511751+ }
17521752+}
17531753+17541754+impl<
17551755+ 'a,
17561756+> ConfigRegionRuleIfAccountOlderThanBuilder<
17571757+ 'a,
17581758+ config_region_rule_if_account_older_than_state::Empty,
17591759+> {
17601760+ /// Create a new builder with all fields unset
17611761+ pub fn new() -> Self {
17621762+ ConfigRegionRuleIfAccountOlderThanBuilder {
17631763+ _phantom_state: ::core::marker::PhantomData,
17641764+ __unsafe_private_named: (None, None),
17651765+ _phantom: ::core::marker::PhantomData,
17661766+ }
17671767+ }
17681768+}
17691769+17701770+impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
17711771+where
17721772+ S: config_region_rule_if_account_older_than_state::State,
17731773+ S::Access: config_region_rule_if_account_older_than_state::IsUnset,
17741774+{
17751775+ /// Set the `access` field (required)
17761776+ pub fn access(
17771777+ mut self,
17781778+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
17791779+ ) -> ConfigRegionRuleIfAccountOlderThanBuilder<
17801780+ 'a,
17811781+ config_region_rule_if_account_older_than_state::SetAccess<S>,
17821782+ > {
17831783+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
17841784+ ConfigRegionRuleIfAccountOlderThanBuilder {
17851785+ _phantom_state: ::core::marker::PhantomData,
17861786+ __unsafe_private_named: self.__unsafe_private_named,
17871787+ _phantom: ::core::marker::PhantomData,
17881788+ }
17891789+ }
17901790+}
17911791+17921792+impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
17931793+where
17941794+ S: config_region_rule_if_account_older_than_state::State,
17951795+ S::Date: config_region_rule_if_account_older_than_state::IsUnset,
17961796+{
17971797+ /// Set the `date` field (required)
17981798+ pub fn date(
17991799+ mut self,
18001800+ value: impl Into<jacquard_common::types::string::Datetime>,
18011801+ ) -> ConfigRegionRuleIfAccountOlderThanBuilder<
18021802+ 'a,
18031803+ config_region_rule_if_account_older_than_state::SetDate<S>,
18041804+ > {
18051805+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
18061806+ ConfigRegionRuleIfAccountOlderThanBuilder {
18071807+ _phantom_state: ::core::marker::PhantomData,
18081808+ __unsafe_private_named: self.__unsafe_private_named,
18091809+ _phantom: ::core::marker::PhantomData,
18101810+ }
18111811+ }
18121812+}
18131813+18141814+impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
18151815+where
18161816+ S: config_region_rule_if_account_older_than_state::State,
18171817+ S::Date: config_region_rule_if_account_older_than_state::IsSet,
18181818+ S::Access: config_region_rule_if_account_older_than_state::IsSet,
18191819+{
18201820+ /// Build the final struct
18211821+ pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<'a> {
18221822+ ConfigRegionRuleIfAccountOlderThan {
18231823+ access: self.__unsafe_private_named.0.unwrap(),
18241824+ date: self.__unsafe_private_named.1.unwrap(),
18251825+ extra_data: Default::default(),
18261826+ }
18271827+ }
18281828+ /// Build the final struct with custom extra_data
18291829+ pub fn build_with_data(
18301830+ self,
18311831+ extra_data: std::collections::BTreeMap<
18321832+ jacquard_common::smol_str::SmolStr,
18331833+ jacquard_common::types::value::Data<'a>,
18341834+ >,
18351835+ ) -> ConfigRegionRuleIfAccountOlderThan<'a> {
18361836+ ConfigRegionRuleIfAccountOlderThan {
18371837+ access: self.__unsafe_private_named.0.unwrap(),
18381838+ date: self.__unsafe_private_named.1.unwrap(),
18391839+ extra_data: Some(extra_data),
18401840+ }
18411841+ }
18421842+}
18431843+18441844+impl<'a> ::jacquard_lexicon::schema::LexiconSchema
18451845+for ConfigRegionRuleIfAccountOlderThan<'a> {
18461846+ fn nsid() -> &'static str {
18471847+ "app.bsky.ageassurance.defs"
18481848+ }
18491849+ fn def_name() -> &'static str {
18501850+ "configRegionRuleIfAccountOlderThan"
18511851+ }
18521852+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
18531853+ lexicon_doc_app_bsky_ageassurance_defs()
18541854+ }
18551855+ fn validate(
18561856+ &self,
18571857+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
18581858+ Ok(())
18591859+ }
18601860+}
18611861+18621862+/// Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age.
18631863+#[jacquard_derive::lexicon]
18641864+#[derive(
18651865+ serde::Serialize,
18661866+ serde::Deserialize,
18671867+ Debug,
18681868+ Clone,
18691869+ PartialEq,
18701870+ Eq,
18711871+ jacquard_derive::IntoStatic
18721872+)]
18731873+#[serde(rename_all = "camelCase")]
18741874+pub struct ConfigRegionRuleIfAssuredOverAge<'a> {
18751875+ #[serde(borrow)]
18761876+ pub access: crate::app_bsky::ageassurance::Access<'a>,
18771877+ /// The age threshold as a whole integer.
18781878+ pub age: i64,
18791879+}
18801880+18811881+pub mod config_region_rule_if_assured_over_age_state {
18821882+18831883+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
18841884+ #[allow(unused)]
18851885+ use ::core::marker::PhantomData;
18861886+ mod sealed {
18871887+ pub trait Sealed {}
18881888+ }
18891889+ /// State trait tracking which required fields have been set
18901890+ pub trait State: sealed::Sealed {
18911891+ type Age;
18921892+ type Access;
18931893+ }
18941894+ /// Empty state - all required fields are unset
18951895+ pub struct Empty(());
18961896+ impl sealed::Sealed for Empty {}
18971897+ impl State for Empty {
18981898+ type Age = Unset;
18991899+ type Access = Unset;
19001900+ }
19011901+ ///State transition - sets the `age` field to Set
19021902+ pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
19031903+ impl<S: State> sealed::Sealed for SetAge<S> {}
19041904+ impl<S: State> State for SetAge<S> {
19051905+ type Age = Set<members::age>;
19061906+ type Access = S::Access;
19071907+ }
19081908+ ///State transition - sets the `access` field to Set
19091909+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
19101910+ impl<S: State> sealed::Sealed for SetAccess<S> {}
19111911+ impl<S: State> State for SetAccess<S> {
19121912+ type Age = S::Age;
19131913+ type Access = Set<members::access>;
19141914+ }
19151915+ /// Marker types for field names
19161916+ #[allow(non_camel_case_types)]
19171917+ pub mod members {
19181918+ ///Marker type for the `age` field
19191919+ pub struct age(());
19201920+ ///Marker type for the `access` field
19211921+ pub struct access(());
19221922+ }
19231923+}
19241924+19251925+/// Builder for constructing an instance of this type
19261926+pub struct ConfigRegionRuleIfAssuredOverAgeBuilder<
19271927+ 'a,
19281928+ S: config_region_rule_if_assured_over_age_state::State,
19291929+> {
19301930+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
19311931+ __unsafe_private_named: (
19321932+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
19331933+ ::core::option::Option<i64>,
19341934+ ),
19351935+ _phantom: ::core::marker::PhantomData<&'a ()>,
19361936+}
19371937+19381938+impl<'a> ConfigRegionRuleIfAssuredOverAge<'a> {
19391939+ /// Create a new builder for this type
19401940+ pub fn new() -> ConfigRegionRuleIfAssuredOverAgeBuilder<
19411941+ 'a,
19421942+ config_region_rule_if_assured_over_age_state::Empty,
19431943+ > {
19441944+ ConfigRegionRuleIfAssuredOverAgeBuilder::new()
19451945+ }
19461946+}
19471947+19481948+impl<
19491949+ 'a,
19501950+> ConfigRegionRuleIfAssuredOverAgeBuilder<
19511951+ 'a,
19521952+ config_region_rule_if_assured_over_age_state::Empty,
19531953+> {
19541954+ /// Create a new builder with all fields unset
19551955+ pub fn new() -> Self {
19561956+ ConfigRegionRuleIfAssuredOverAgeBuilder {
19571957+ _phantom_state: ::core::marker::PhantomData,
19581958+ __unsafe_private_named: (None, None),
19591959+ _phantom: ::core::marker::PhantomData,
19601960+ }
19611961+ }
19621962+}
19631963+19641964+impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
19651965+where
19661966+ S: config_region_rule_if_assured_over_age_state::State,
19671967+ S::Access: config_region_rule_if_assured_over_age_state::IsUnset,
19681968+{
19691969+ /// Set the `access` field (required)
19701970+ pub fn access(
19711971+ mut self,
19721972+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
19731973+ ) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
19741974+ 'a,
19751975+ config_region_rule_if_assured_over_age_state::SetAccess<S>,
19761976+ > {
19771977+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
19781978+ ConfigRegionRuleIfAssuredOverAgeBuilder {
19791979+ _phantom_state: ::core::marker::PhantomData,
19801980+ __unsafe_private_named: self.__unsafe_private_named,
19811981+ _phantom: ::core::marker::PhantomData,
19821982+ }
19831983+ }
19841984+}
19851985+19861986+impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
19871987+where
19881988+ S: config_region_rule_if_assured_over_age_state::State,
19891989+ S::Age: config_region_rule_if_assured_over_age_state::IsUnset,
19901990+{
19911991+ /// Set the `age` field (required)
19921992+ pub fn age(
19931993+ mut self,
19941994+ value: impl Into<i64>,
19951995+ ) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
19961996+ 'a,
19971997+ config_region_rule_if_assured_over_age_state::SetAge<S>,
19981998+ > {
19991999+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
20002000+ ConfigRegionRuleIfAssuredOverAgeBuilder {
20012001+ _phantom_state: ::core::marker::PhantomData,
20022002+ __unsafe_private_named: self.__unsafe_private_named,
20032003+ _phantom: ::core::marker::PhantomData,
20042004+ }
20052005+ }
20062006+}
20072007+20082008+impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
20092009+where
20102010+ S: config_region_rule_if_assured_over_age_state::State,
20112011+ S::Age: config_region_rule_if_assured_over_age_state::IsSet,
20122012+ S::Access: config_region_rule_if_assured_over_age_state::IsSet,
20132013+{
20142014+ /// Build the final struct
20152015+ pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<'a> {
20162016+ ConfigRegionRuleIfAssuredOverAge {
20172017+ access: self.__unsafe_private_named.0.unwrap(),
20182018+ age: self.__unsafe_private_named.1.unwrap(),
20192019+ extra_data: Default::default(),
20202020+ }
20212021+ }
20222022+ /// Build the final struct with custom extra_data
20232023+ pub fn build_with_data(
20242024+ self,
20252025+ extra_data: std::collections::BTreeMap<
20262026+ jacquard_common::smol_str::SmolStr,
20272027+ jacquard_common::types::value::Data<'a>,
20282028+ >,
20292029+ ) -> ConfigRegionRuleIfAssuredOverAge<'a> {
20302030+ ConfigRegionRuleIfAssuredOverAge {
20312031+ access: self.__unsafe_private_named.0.unwrap(),
20322032+ age: self.__unsafe_private_named.1.unwrap(),
20332033+ extra_data: Some(extra_data),
20342034+ }
20352035+ }
20362036+}
20372037+20382038+impl<'a> ::jacquard_lexicon::schema::LexiconSchema
20392039+for ConfigRegionRuleIfAssuredOverAge<'a> {
20402040+ fn nsid() -> &'static str {
20412041+ "app.bsky.ageassurance.defs"
20422042+ }
20432043+ fn def_name() -> &'static str {
20442044+ "configRegionRuleIfAssuredOverAge"
20452045+ }
20462046+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
20472047+ lexicon_doc_app_bsky_ageassurance_defs()
20482048+ }
20492049+ fn validate(
20502050+ &self,
20512051+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
20522052+ Ok(())
20532053+ }
20542054+}
20552055+20562056+/// Age Assurance rule that applies if the user has been assured to be under a certain age.
20572057+#[jacquard_derive::lexicon]
20582058+#[derive(
20592059+ serde::Serialize,
20602060+ serde::Deserialize,
20612061+ Debug,
20622062+ Clone,
20632063+ PartialEq,
20642064+ Eq,
20652065+ jacquard_derive::IntoStatic
20662066+)]
20672067+#[serde(rename_all = "camelCase")]
20682068+pub struct ConfigRegionRuleIfAssuredUnderAge<'a> {
20692069+ #[serde(borrow)]
20702070+ pub access: crate::app_bsky::ageassurance::Access<'a>,
20712071+ /// The age threshold as a whole integer.
20722072+ pub age: i64,
20732073+}
20742074+20752075+pub mod config_region_rule_if_assured_under_age_state {
20762076+20772077+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
20782078+ #[allow(unused)]
20792079+ use ::core::marker::PhantomData;
20802080+ mod sealed {
20812081+ pub trait Sealed {}
20822082+ }
20832083+ /// State trait tracking which required fields have been set
20842084+ pub trait State: sealed::Sealed {
20852085+ type Age;
20862086+ type Access;
20872087+ }
20882088+ /// Empty state - all required fields are unset
20892089+ pub struct Empty(());
20902090+ impl sealed::Sealed for Empty {}
20912091+ impl State for Empty {
20922092+ type Age = Unset;
20932093+ type Access = Unset;
20942094+ }
20952095+ ///State transition - sets the `age` field to Set
20962096+ pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
20972097+ impl<S: State> sealed::Sealed for SetAge<S> {}
20982098+ impl<S: State> State for SetAge<S> {
20992099+ type Age = Set<members::age>;
21002100+ type Access = S::Access;
21012101+ }
21022102+ ///State transition - sets the `access` field to Set
21032103+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
21042104+ impl<S: State> sealed::Sealed for SetAccess<S> {}
21052105+ impl<S: State> State for SetAccess<S> {
21062106+ type Age = S::Age;
21072107+ type Access = Set<members::access>;
21082108+ }
21092109+ /// Marker types for field names
21102110+ #[allow(non_camel_case_types)]
21112111+ pub mod members {
21122112+ ///Marker type for the `age` field
21132113+ pub struct age(());
21142114+ ///Marker type for the `access` field
21152115+ pub struct access(());
21162116+ }
21172117+}
21182118+21192119+/// Builder for constructing an instance of this type
21202120+pub struct ConfigRegionRuleIfAssuredUnderAgeBuilder<
21212121+ 'a,
21222122+ S: config_region_rule_if_assured_under_age_state::State,
21232123+> {
21242124+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
21252125+ __unsafe_private_named: (
21262126+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
21272127+ ::core::option::Option<i64>,
21282128+ ),
21292129+ _phantom: ::core::marker::PhantomData<&'a ()>,
21302130+}
21312131+21322132+impl<'a> ConfigRegionRuleIfAssuredUnderAge<'a> {
21332133+ /// Create a new builder for this type
21342134+ pub fn new() -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
21352135+ 'a,
21362136+ config_region_rule_if_assured_under_age_state::Empty,
21372137+ > {
21382138+ ConfigRegionRuleIfAssuredUnderAgeBuilder::new()
21392139+ }
21402140+}
21412141+21422142+impl<
21432143+ 'a,
21442144+> ConfigRegionRuleIfAssuredUnderAgeBuilder<
21452145+ 'a,
21462146+ config_region_rule_if_assured_under_age_state::Empty,
21472147+> {
21482148+ /// Create a new builder with all fields unset
21492149+ pub fn new() -> Self {
21502150+ ConfigRegionRuleIfAssuredUnderAgeBuilder {
21512151+ _phantom_state: ::core::marker::PhantomData,
21522152+ __unsafe_private_named: (None, None),
21532153+ _phantom: ::core::marker::PhantomData,
21542154+ }
21552155+ }
21562156+}
21572157+21582158+impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
21592159+where
21602160+ S: config_region_rule_if_assured_under_age_state::State,
21612161+ S::Access: config_region_rule_if_assured_under_age_state::IsUnset,
21622162+{
21632163+ /// Set the `access` field (required)
21642164+ pub fn access(
21652165+ mut self,
21662166+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
21672167+ ) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
21682168+ 'a,
21692169+ config_region_rule_if_assured_under_age_state::SetAccess<S>,
21702170+ > {
21712171+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
21722172+ ConfigRegionRuleIfAssuredUnderAgeBuilder {
21732173+ _phantom_state: ::core::marker::PhantomData,
21742174+ __unsafe_private_named: self.__unsafe_private_named,
21752175+ _phantom: ::core::marker::PhantomData,
21762176+ }
21772177+ }
21782178+}
21792179+21802180+impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
21812181+where
21822182+ S: config_region_rule_if_assured_under_age_state::State,
21832183+ S::Age: config_region_rule_if_assured_under_age_state::IsUnset,
21842184+{
21852185+ /// Set the `age` field (required)
21862186+ pub fn age(
21872187+ mut self,
21882188+ value: impl Into<i64>,
21892189+ ) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
21902190+ 'a,
21912191+ config_region_rule_if_assured_under_age_state::SetAge<S>,
21922192+ > {
21932193+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
21942194+ ConfigRegionRuleIfAssuredUnderAgeBuilder {
21952195+ _phantom_state: ::core::marker::PhantomData,
21962196+ __unsafe_private_named: self.__unsafe_private_named,
21972197+ _phantom: ::core::marker::PhantomData,
21982198+ }
21992199+ }
22002200+}
22012201+22022202+impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
22032203+where
22042204+ S: config_region_rule_if_assured_under_age_state::State,
22052205+ S::Age: config_region_rule_if_assured_under_age_state::IsSet,
22062206+ S::Access: config_region_rule_if_assured_under_age_state::IsSet,
22072207+{
22082208+ /// Build the final struct
22092209+ pub fn build(self) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
22102210+ ConfigRegionRuleIfAssuredUnderAge {
22112211+ access: self.__unsafe_private_named.0.unwrap(),
22122212+ age: self.__unsafe_private_named.1.unwrap(),
22132213+ extra_data: Default::default(),
22142214+ }
22152215+ }
22162216+ /// Build the final struct with custom extra_data
22172217+ pub fn build_with_data(
22182218+ self,
22192219+ extra_data: std::collections::BTreeMap<
22202220+ jacquard_common::smol_str::SmolStr,
22212221+ jacquard_common::types::value::Data<'a>,
22222222+ >,
22232223+ ) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
22242224+ ConfigRegionRuleIfAssuredUnderAge {
22252225+ access: self.__unsafe_private_named.0.unwrap(),
22262226+ age: self.__unsafe_private_named.1.unwrap(),
22272227+ extra_data: Some(extra_data),
22282228+ }
22292229+ }
22302230+}
22312231+22322232+impl<'a> ::jacquard_lexicon::schema::LexiconSchema
22332233+for ConfigRegionRuleIfAssuredUnderAge<'a> {
22342234+ fn nsid() -> &'static str {
22352235+ "app.bsky.ageassurance.defs"
22362236+ }
22372237+ fn def_name() -> &'static str {
22382238+ "configRegionRuleIfAssuredUnderAge"
22392239+ }
22402240+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
22412241+ lexicon_doc_app_bsky_ageassurance_defs()
22422242+ }
22432243+ fn validate(
22442244+ &self,
22452245+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
22462246+ Ok(())
22472247+ }
22482248+}
22492249+22502250+/// Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age.
22512251+#[jacquard_derive::lexicon]
22522252+#[derive(
22532253+ serde::Serialize,
22542254+ serde::Deserialize,
22552255+ Debug,
22562256+ Clone,
22572257+ PartialEq,
22582258+ Eq,
22592259+ jacquard_derive::IntoStatic
22602260+)]
22612261+#[serde(rename_all = "camelCase")]
22622262+pub struct ConfigRegionRuleIfDeclaredOverAge<'a> {
22632263+ #[serde(borrow)]
22642264+ pub access: crate::app_bsky::ageassurance::Access<'a>,
22652265+ /// The age threshold as a whole integer.
22662266+ pub age: i64,
22672267+}
22682268+22692269+pub mod config_region_rule_if_declared_over_age_state {
22702270+22712271+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
22722272+ #[allow(unused)]
22732273+ use ::core::marker::PhantomData;
22742274+ mod sealed {
22752275+ pub trait Sealed {}
22762276+ }
22772277+ /// State trait tracking which required fields have been set
22782278+ pub trait State: sealed::Sealed {
22792279+ type Age;
22802280+ type Access;
22812281+ }
22822282+ /// Empty state - all required fields are unset
22832283+ pub struct Empty(());
22842284+ impl sealed::Sealed for Empty {}
22852285+ impl State for Empty {
22862286+ type Age = Unset;
22872287+ type Access = Unset;
22882288+ }
22892289+ ///State transition - sets the `age` field to Set
22902290+ pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
22912291+ impl<S: State> sealed::Sealed for SetAge<S> {}
22922292+ impl<S: State> State for SetAge<S> {
22932293+ type Age = Set<members::age>;
22942294+ type Access = S::Access;
22952295+ }
22962296+ ///State transition - sets the `access` field to Set
22972297+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
22982298+ impl<S: State> sealed::Sealed for SetAccess<S> {}
22992299+ impl<S: State> State for SetAccess<S> {
23002300+ type Age = S::Age;
23012301+ type Access = Set<members::access>;
23022302+ }
23032303+ /// Marker types for field names
23042304+ #[allow(non_camel_case_types)]
23052305+ pub mod members {
23062306+ ///Marker type for the `age` field
23072307+ pub struct age(());
23082308+ ///Marker type for the `access` field
23092309+ pub struct access(());
23102310+ }
23112311+}
23122312+23132313+/// Builder for constructing an instance of this type
23142314+pub struct ConfigRegionRuleIfDeclaredOverAgeBuilder<
23152315+ 'a,
23162316+ S: config_region_rule_if_declared_over_age_state::State,
23172317+> {
23182318+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
23192319+ __unsafe_private_named: (
23202320+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
23212321+ ::core::option::Option<i64>,
23222322+ ),
23232323+ _phantom: ::core::marker::PhantomData<&'a ()>,
23242324+}
23252325+23262326+impl<'a> ConfigRegionRuleIfDeclaredOverAge<'a> {
23272327+ /// Create a new builder for this type
23282328+ pub fn new() -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
23292329+ 'a,
23302330+ config_region_rule_if_declared_over_age_state::Empty,
23312331+ > {
23322332+ ConfigRegionRuleIfDeclaredOverAgeBuilder::new()
23332333+ }
23342334+}
23352335+23362336+impl<
23372337+ 'a,
23382338+> ConfigRegionRuleIfDeclaredOverAgeBuilder<
23392339+ 'a,
23402340+ config_region_rule_if_declared_over_age_state::Empty,
23412341+> {
23422342+ /// Create a new builder with all fields unset
23432343+ pub fn new() -> Self {
23442344+ ConfigRegionRuleIfDeclaredOverAgeBuilder {
23452345+ _phantom_state: ::core::marker::PhantomData,
23462346+ __unsafe_private_named: (None, None),
23472347+ _phantom: ::core::marker::PhantomData,
23482348+ }
23492349+ }
23502350+}
23512351+23522352+impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
23532353+where
23542354+ S: config_region_rule_if_declared_over_age_state::State,
23552355+ S::Access: config_region_rule_if_declared_over_age_state::IsUnset,
23562356+{
23572357+ /// Set the `access` field (required)
23582358+ pub fn access(
23592359+ mut self,
23602360+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
23612361+ ) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
23622362+ 'a,
23632363+ config_region_rule_if_declared_over_age_state::SetAccess<S>,
23642364+ > {
23652365+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
23662366+ ConfigRegionRuleIfDeclaredOverAgeBuilder {
23672367+ _phantom_state: ::core::marker::PhantomData,
23682368+ __unsafe_private_named: self.__unsafe_private_named,
23692369+ _phantom: ::core::marker::PhantomData,
23702370+ }
23712371+ }
23722372+}
23732373+23742374+impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
23752375+where
23762376+ S: config_region_rule_if_declared_over_age_state::State,
23772377+ S::Age: config_region_rule_if_declared_over_age_state::IsUnset,
23782378+{
23792379+ /// Set the `age` field (required)
23802380+ pub fn age(
23812381+ mut self,
23822382+ value: impl Into<i64>,
23832383+ ) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
23842384+ 'a,
23852385+ config_region_rule_if_declared_over_age_state::SetAge<S>,
23862386+ > {
23872387+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
23882388+ ConfigRegionRuleIfDeclaredOverAgeBuilder {
23892389+ _phantom_state: ::core::marker::PhantomData,
23902390+ __unsafe_private_named: self.__unsafe_private_named,
23912391+ _phantom: ::core::marker::PhantomData,
23922392+ }
23932393+ }
23942394+}
23952395+23962396+impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
23972397+where
23982398+ S: config_region_rule_if_declared_over_age_state::State,
23992399+ S::Age: config_region_rule_if_declared_over_age_state::IsSet,
24002400+ S::Access: config_region_rule_if_declared_over_age_state::IsSet,
24012401+{
24022402+ /// Build the final struct
24032403+ pub fn build(self) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
24042404+ ConfigRegionRuleIfDeclaredOverAge {
24052405+ access: self.__unsafe_private_named.0.unwrap(),
24062406+ age: self.__unsafe_private_named.1.unwrap(),
24072407+ extra_data: Default::default(),
24082408+ }
24092409+ }
24102410+ /// Build the final struct with custom extra_data
24112411+ pub fn build_with_data(
24122412+ self,
24132413+ extra_data: std::collections::BTreeMap<
24142414+ jacquard_common::smol_str::SmolStr,
24152415+ jacquard_common::types::value::Data<'a>,
24162416+ >,
24172417+ ) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
24182418+ ConfigRegionRuleIfDeclaredOverAge {
24192419+ access: self.__unsafe_private_named.0.unwrap(),
24202420+ age: self.__unsafe_private_named.1.unwrap(),
24212421+ extra_data: Some(extra_data),
24222422+ }
24232423+ }
24242424+}
24252425+24262426+impl<'a> ::jacquard_lexicon::schema::LexiconSchema
24272427+for ConfigRegionRuleIfDeclaredOverAge<'a> {
24282428+ fn nsid() -> &'static str {
24292429+ "app.bsky.ageassurance.defs"
24302430+ }
24312431+ fn def_name() -> &'static str {
24322432+ "configRegionRuleIfDeclaredOverAge"
24332433+ }
24342434+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
24352435+ lexicon_doc_app_bsky_ageassurance_defs()
24362436+ }
24372437+ fn validate(
24382438+ &self,
24392439+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
24402440+ Ok(())
24412441+ }
24422442+}
24432443+24442444+/// Age Assurance rule that applies if the user has declared themselves under a certain age.
24452445+#[jacquard_derive::lexicon]
24462446+#[derive(
24472447+ serde::Serialize,
24482448+ serde::Deserialize,
24492449+ Debug,
24502450+ Clone,
24512451+ PartialEq,
24522452+ Eq,
24532453+ jacquard_derive::IntoStatic
24542454+)]
24552455+#[serde(rename_all = "camelCase")]
24562456+pub struct ConfigRegionRuleIfDeclaredUnderAge<'a> {
24572457+ #[serde(borrow)]
24582458+ pub access: crate::app_bsky::ageassurance::Access<'a>,
24592459+ /// The age threshold as a whole integer.
24602460+ pub age: i64,
24612461+}
24622462+24632463+pub mod config_region_rule_if_declared_under_age_state {
24642464+24652465+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
24662466+ #[allow(unused)]
24672467+ use ::core::marker::PhantomData;
24682468+ mod sealed {
24692469+ pub trait Sealed {}
24702470+ }
24712471+ /// State trait tracking which required fields have been set
24722472+ pub trait State: sealed::Sealed {
24732473+ type Age;
24742474+ type Access;
24752475+ }
24762476+ /// Empty state - all required fields are unset
24772477+ pub struct Empty(());
24782478+ impl sealed::Sealed for Empty {}
24792479+ impl State for Empty {
24802480+ type Age = Unset;
24812481+ type Access = Unset;
24822482+ }
24832483+ ///State transition - sets the `age` field to Set
24842484+ pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
24852485+ impl<S: State> sealed::Sealed for SetAge<S> {}
24862486+ impl<S: State> State for SetAge<S> {
24872487+ type Age = Set<members::age>;
24882488+ type Access = S::Access;
24892489+ }
24902490+ ///State transition - sets the `access` field to Set
24912491+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
24922492+ impl<S: State> sealed::Sealed for SetAccess<S> {}
24932493+ impl<S: State> State for SetAccess<S> {
24942494+ type Age = S::Age;
24952495+ type Access = Set<members::access>;
24962496+ }
24972497+ /// Marker types for field names
24982498+ #[allow(non_camel_case_types)]
24992499+ pub mod members {
25002500+ ///Marker type for the `age` field
25012501+ pub struct age(());
25022502+ ///Marker type for the `access` field
25032503+ pub struct access(());
25042504+ }
25052505+}
25062506+25072507+/// Builder for constructing an instance of this type
25082508+pub struct ConfigRegionRuleIfDeclaredUnderAgeBuilder<
25092509+ 'a,
25102510+ S: config_region_rule_if_declared_under_age_state::State,
25112511+> {
25122512+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
25132513+ __unsafe_private_named: (
25142514+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
25152515+ ::core::option::Option<i64>,
25162516+ ),
25172517+ _phantom: ::core::marker::PhantomData<&'a ()>,
25182518+}
25192519+25202520+impl<'a> ConfigRegionRuleIfDeclaredUnderAge<'a> {
25212521+ /// Create a new builder for this type
25222522+ pub fn new() -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
25232523+ 'a,
25242524+ config_region_rule_if_declared_under_age_state::Empty,
25252525+ > {
25262526+ ConfigRegionRuleIfDeclaredUnderAgeBuilder::new()
25272527+ }
25282528+}
25292529+25302530+impl<
25312531+ 'a,
25322532+> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
25332533+ 'a,
25342534+ config_region_rule_if_declared_under_age_state::Empty,
25352535+> {
25362536+ /// Create a new builder with all fields unset
25372537+ pub fn new() -> Self {
25382538+ ConfigRegionRuleIfDeclaredUnderAgeBuilder {
25392539+ _phantom_state: ::core::marker::PhantomData,
25402540+ __unsafe_private_named: (None, None),
25412541+ _phantom: ::core::marker::PhantomData,
25422542+ }
25432543+ }
25442544+}
25452545+25462546+impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
25472547+where
25482548+ S: config_region_rule_if_declared_under_age_state::State,
25492549+ S::Access: config_region_rule_if_declared_under_age_state::IsUnset,
25502550+{
25512551+ /// Set the `access` field (required)
25522552+ pub fn access(
25532553+ mut self,
25542554+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
25552555+ ) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
25562556+ 'a,
25572557+ config_region_rule_if_declared_under_age_state::SetAccess<S>,
25582558+ > {
25592559+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
25602560+ ConfigRegionRuleIfDeclaredUnderAgeBuilder {
25612561+ _phantom_state: ::core::marker::PhantomData,
25622562+ __unsafe_private_named: self.__unsafe_private_named,
25632563+ _phantom: ::core::marker::PhantomData,
25642564+ }
25652565+ }
25662566+}
25672567+25682568+impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
25692569+where
25702570+ S: config_region_rule_if_declared_under_age_state::State,
25712571+ S::Age: config_region_rule_if_declared_under_age_state::IsUnset,
25722572+{
25732573+ /// Set the `age` field (required)
25742574+ pub fn age(
25752575+ mut self,
25762576+ value: impl Into<i64>,
25772577+ ) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
25782578+ 'a,
25792579+ config_region_rule_if_declared_under_age_state::SetAge<S>,
25802580+ > {
25812581+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
25822582+ ConfigRegionRuleIfDeclaredUnderAgeBuilder {
25832583+ _phantom_state: ::core::marker::PhantomData,
25842584+ __unsafe_private_named: self.__unsafe_private_named,
25852585+ _phantom: ::core::marker::PhantomData,
25862586+ }
25872587+ }
25882588+}
25892589+25902590+impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
25912591+where
25922592+ S: config_region_rule_if_declared_under_age_state::State,
25932593+ S::Age: config_region_rule_if_declared_under_age_state::IsSet,
25942594+ S::Access: config_region_rule_if_declared_under_age_state::IsSet,
25952595+{
25962596+ /// Build the final struct
25972597+ pub fn build(self) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
25982598+ ConfigRegionRuleIfDeclaredUnderAge {
25992599+ access: self.__unsafe_private_named.0.unwrap(),
26002600+ age: self.__unsafe_private_named.1.unwrap(),
26012601+ extra_data: Default::default(),
26022602+ }
26032603+ }
26042604+ /// Build the final struct with custom extra_data
26052605+ pub fn build_with_data(
26062606+ self,
26072607+ extra_data: std::collections::BTreeMap<
26082608+ jacquard_common::smol_str::SmolStr,
26092609+ jacquard_common::types::value::Data<'a>,
26102610+ >,
26112611+ ) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
26122612+ ConfigRegionRuleIfDeclaredUnderAge {
26132613+ access: self.__unsafe_private_named.0.unwrap(),
26142614+ age: self.__unsafe_private_named.1.unwrap(),
26152615+ extra_data: Some(extra_data),
26162616+ }
26172617+ }
26182618+}
26192619+26202620+impl<'a> ::jacquard_lexicon::schema::LexiconSchema
26212621+for ConfigRegionRuleIfDeclaredUnderAge<'a> {
26222622+ fn nsid() -> &'static str {
26232623+ "app.bsky.ageassurance.defs"
26242624+ }
26252625+ fn def_name() -> &'static str {
26262626+ "configRegionRuleIfDeclaredUnderAge"
26272627+ }
26282628+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
26292629+ lexicon_doc_app_bsky_ageassurance_defs()
26302630+ }
26312631+ fn validate(
26322632+ &self,
26332633+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
26342634+ Ok(())
26352635+ }
26362636+}
26372637+26382638+/// Object used to store Age Assurance data in stash.
26392639+#[jacquard_derive::lexicon]
26402640+#[derive(
26412641+ serde::Serialize,
26422642+ serde::Deserialize,
26432643+ Debug,
26442644+ Clone,
26452645+ PartialEq,
26462646+ Eq,
26472647+ jacquard_derive::IntoStatic
26482648+)]
26492649+#[serde(rename_all = "camelCase")]
26502650+pub struct Event<'a> {
26512651+ /// The access level granted based on Age Assurance data we've processed.
26522652+ #[serde(borrow)]
26532653+ pub access: jacquard_common::CowStr<'a>,
26542654+ /// The unique identifier for this instance of the Age Assurance flow, in UUID format.
26552655+ #[serde(borrow)]
26562656+ pub attempt_id: jacquard_common::CowStr<'a>,
26572657+ /// The IP address used when completing the Age Assurance flow.
26582658+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
26592659+ #[serde(borrow)]
26602660+ pub complete_ip: std::option::Option<jacquard_common::CowStr<'a>>,
26612661+ /// The user agent used when completing the Age Assurance flow.
26622662+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
26632663+ #[serde(borrow)]
26642664+ pub complete_ua: std::option::Option<jacquard_common::CowStr<'a>>,
26652665+ /// The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.
26662666+ #[serde(borrow)]
26672667+ pub country_code: jacquard_common::CowStr<'a>,
26682668+ /// The date and time of this write operation.
26692669+ pub created_at: jacquard_common::types::string::Datetime,
26702670+ /// The email used for Age Assurance.
26712671+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
26722672+ #[serde(borrow)]
26732673+ pub email: std::option::Option<jacquard_common::CowStr<'a>>,
26742674+ /// The IP address used when initiating the Age Assurance flow.
26752675+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
26762676+ #[serde(borrow)]
26772677+ pub init_ip: std::option::Option<jacquard_common::CowStr<'a>>,
26782678+ /// The user agent used when initiating the Age Assurance flow.
26792679+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
26802680+ #[serde(borrow)]
26812681+ pub init_ua: std::option::Option<jacquard_common::CowStr<'a>>,
26822682+ /// The ISO 3166-2 region code provided when beginning the Age Assurance flow.
26832683+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
26842684+ #[serde(borrow)]
26852685+ pub region_code: std::option::Option<jacquard_common::CowStr<'a>>,
26862686+ /// The status of the Age Assurance process.
26872687+ #[serde(borrow)]
26882688+ pub status: jacquard_common::CowStr<'a>,
26892689+}
26902690+26912691+pub mod event_state {
26922692+26932693+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
26942694+ #[allow(unused)]
26952695+ use ::core::marker::PhantomData;
26962696+ mod sealed {
26972697+ pub trait Sealed {}
26982698+ }
26992699+ /// State trait tracking which required fields have been set
27002700+ pub trait State: sealed::Sealed {
27012701+ type CreatedAt;
27022702+ type Status;
27032703+ type Access;
27042704+ type AttemptId;
27052705+ type CountryCode;
27062706+ }
27072707+ /// Empty state - all required fields are unset
27082708+ pub struct Empty(());
27092709+ impl sealed::Sealed for Empty {}
27102710+ impl State for Empty {
27112711+ type CreatedAt = Unset;
27122712+ type Status = Unset;
27132713+ type Access = Unset;
27142714+ type AttemptId = Unset;
27152715+ type CountryCode = Unset;
27162716+ }
27172717+ ///State transition - sets the `created_at` field to Set
27182718+ pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
27192719+ impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
27202720+ impl<S: State> State for SetCreatedAt<S> {
27212721+ type CreatedAt = Set<members::created_at>;
27222722+ type Status = S::Status;
27232723+ type Access = S::Access;
27242724+ type AttemptId = S::AttemptId;
27252725+ type CountryCode = S::CountryCode;
27262726+ }
27272727+ ///State transition - sets the `status` field to Set
27282728+ pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
27292729+ impl<S: State> sealed::Sealed for SetStatus<S> {}
27302730+ impl<S: State> State for SetStatus<S> {
27312731+ type CreatedAt = S::CreatedAt;
27322732+ type Status = Set<members::status>;
27332733+ type Access = S::Access;
27342734+ type AttemptId = S::AttemptId;
27352735+ type CountryCode = S::CountryCode;
27362736+ }
27372737+ ///State transition - sets the `access` field to Set
27382738+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
27392739+ impl<S: State> sealed::Sealed for SetAccess<S> {}
27402740+ impl<S: State> State for SetAccess<S> {
27412741+ type CreatedAt = S::CreatedAt;
27422742+ type Status = S::Status;
27432743+ type Access = Set<members::access>;
27442744+ type AttemptId = S::AttemptId;
27452745+ type CountryCode = S::CountryCode;
27462746+ }
27472747+ ///State transition - sets the `attempt_id` field to Set
27482748+ pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>);
27492749+ impl<S: State> sealed::Sealed for SetAttemptId<S> {}
27502750+ impl<S: State> State for SetAttemptId<S> {
27512751+ type CreatedAt = S::CreatedAt;
27522752+ type Status = S::Status;
27532753+ type Access = S::Access;
27542754+ type AttemptId = Set<members::attempt_id>;
27552755+ type CountryCode = S::CountryCode;
27562756+ }
27572757+ ///State transition - sets the `country_code` field to Set
27582758+ pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
27592759+ impl<S: State> sealed::Sealed for SetCountryCode<S> {}
27602760+ impl<S: State> State for SetCountryCode<S> {
27612761+ type CreatedAt = S::CreatedAt;
27622762+ type Status = S::Status;
27632763+ type Access = S::Access;
27642764+ type AttemptId = S::AttemptId;
27652765+ type CountryCode = Set<members::country_code>;
27662766+ }
27672767+ /// Marker types for field names
27682768+ #[allow(non_camel_case_types)]
27692769+ pub mod members {
27702770+ ///Marker type for the `created_at` field
27712771+ pub struct created_at(());
27722772+ ///Marker type for the `status` field
27732773+ pub struct status(());
27742774+ ///Marker type for the `access` field
27752775+ pub struct access(());
27762776+ ///Marker type for the `attempt_id` field
27772777+ pub struct attempt_id(());
27782778+ ///Marker type for the `country_code` field
27792779+ pub struct country_code(());
27802780+ }
27812781+}
27822782+27832783+/// Builder for constructing an instance of this type
27842784+pub struct EventBuilder<'a, S: event_state::State> {
27852785+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
27862786+ __unsafe_private_named: (
27872787+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27882788+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27892789+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27902790+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27912791+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27922792+ ::core::option::Option<jacquard_common::types::string::Datetime>,
27932793+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27942794+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27952795+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27962796+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27972797+ ::core::option::Option<jacquard_common::CowStr<'a>>,
27982798+ ),
27992799+ _phantom: ::core::marker::PhantomData<&'a ()>,
28002800+}
28012801+28022802+impl<'a> Event<'a> {
28032803+ /// Create a new builder for this type
28042804+ pub fn new() -> EventBuilder<'a, event_state::Empty> {
28052805+ EventBuilder::new()
28062806+ }
28072807+}
28082808+28092809+impl<'a> EventBuilder<'a, event_state::Empty> {
28102810+ /// Create a new builder with all fields unset
28112811+ pub fn new() -> Self {
28122812+ EventBuilder {
28132813+ _phantom_state: ::core::marker::PhantomData,
28142814+ __unsafe_private_named: (
28152815+ None,
28162816+ None,
28172817+ None,
28182818+ None,
28192819+ None,
28202820+ None,
28212821+ None,
28222822+ None,
28232823+ None,
28242824+ None,
28252825+ None,
28262826+ ),
28272827+ _phantom: ::core::marker::PhantomData,
28282828+ }
28292829+ }
28302830+}
28312831+28322832+impl<'a, S> EventBuilder<'a, S>
28332833+where
28342834+ S: event_state::State,
28352835+ S::Access: event_state::IsUnset,
28362836+{
28372837+ /// Set the `access` field (required)
28382838+ pub fn access(
28392839+ mut self,
28402840+ value: impl Into<jacquard_common::CowStr<'a>>,
28412841+ ) -> EventBuilder<'a, event_state::SetAccess<S>> {
28422842+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
28432843+ EventBuilder {
28442844+ _phantom_state: ::core::marker::PhantomData,
28452845+ __unsafe_private_named: self.__unsafe_private_named,
28462846+ _phantom: ::core::marker::PhantomData,
28472847+ }
28482848+ }
28492849+}
28502850+28512851+impl<'a, S> EventBuilder<'a, S>
28522852+where
28532853+ S: event_state::State,
28542854+ S::AttemptId: event_state::IsUnset,
28552855+{
28562856+ /// Set the `attemptId` field (required)
28572857+ pub fn attempt_id(
28582858+ mut self,
28592859+ value: impl Into<jacquard_common::CowStr<'a>>,
28602860+ ) -> EventBuilder<'a, event_state::SetAttemptId<S>> {
28612861+ self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
28622862+ EventBuilder {
28632863+ _phantom_state: ::core::marker::PhantomData,
28642864+ __unsafe_private_named: self.__unsafe_private_named,
28652865+ _phantom: ::core::marker::PhantomData,
28662866+ }
28672867+ }
28682868+}
28692869+28702870+impl<'a, S: event_state::State> EventBuilder<'a, S> {
28712871+ /// Set the `completeIp` field (optional)
28722872+ pub fn complete_ip(
28732873+ mut self,
28742874+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
28752875+ ) -> Self {
28762876+ self.__unsafe_private_named.2 = value.into();
28772877+ self
28782878+ }
28792879+ /// Set the `completeIp` field to an Option value (optional)
28802880+ pub fn maybe_complete_ip(
28812881+ mut self,
28822882+ value: Option<jacquard_common::CowStr<'a>>,
28832883+ ) -> Self {
28842884+ self.__unsafe_private_named.2 = value;
28852885+ self
28862886+ }
28872887+}
28882888+28892889+impl<'a, S: event_state::State> EventBuilder<'a, S> {
28902890+ /// Set the `completeUa` field (optional)
28912891+ pub fn complete_ua(
28922892+ mut self,
28932893+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
28942894+ ) -> Self {
28952895+ self.__unsafe_private_named.3 = value.into();
28962896+ self
28972897+ }
28982898+ /// Set the `completeUa` field to an Option value (optional)
28992899+ pub fn maybe_complete_ua(
29002900+ mut self,
29012901+ value: Option<jacquard_common::CowStr<'a>>,
29022902+ ) -> Self {
29032903+ self.__unsafe_private_named.3 = value;
29042904+ self
29052905+ }
29062906+}
29072907+29082908+impl<'a, S> EventBuilder<'a, S>
29092909+where
29102910+ S: event_state::State,
29112911+ S::CountryCode: event_state::IsUnset,
29122912+{
29132913+ /// Set the `countryCode` field (required)
29142914+ pub fn country_code(
29152915+ mut self,
29162916+ value: impl Into<jacquard_common::CowStr<'a>>,
29172917+ ) -> EventBuilder<'a, event_state::SetCountryCode<S>> {
29182918+ self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
29192919+ EventBuilder {
29202920+ _phantom_state: ::core::marker::PhantomData,
29212921+ __unsafe_private_named: self.__unsafe_private_named,
29222922+ _phantom: ::core::marker::PhantomData,
29232923+ }
29242924+ }
29252925+}
29262926+29272927+impl<'a, S> EventBuilder<'a, S>
29282928+where
29292929+ S: event_state::State,
29302930+ S::CreatedAt: event_state::IsUnset,
29312931+{
29322932+ /// Set the `createdAt` field (required)
29332933+ pub fn created_at(
29342934+ mut self,
29352935+ value: impl Into<jacquard_common::types::string::Datetime>,
29362936+ ) -> EventBuilder<'a, event_state::SetCreatedAt<S>> {
29372937+ self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
29382938+ EventBuilder {
29392939+ _phantom_state: ::core::marker::PhantomData,
29402940+ __unsafe_private_named: self.__unsafe_private_named,
29412941+ _phantom: ::core::marker::PhantomData,
29422942+ }
29432943+ }
29442944+}
29452945+29462946+impl<'a, S: event_state::State> EventBuilder<'a, S> {
29472947+ /// Set the `email` field (optional)
29482948+ pub fn email(
29492949+ mut self,
29502950+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
29512951+ ) -> Self {
29522952+ self.__unsafe_private_named.6 = value.into();
29532953+ self
29542954+ }
29552955+ /// Set the `email` field to an Option value (optional)
29562956+ pub fn maybe_email(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
29572957+ self.__unsafe_private_named.6 = value;
29582958+ self
29592959+ }
29602960+}
29612961+29622962+impl<'a, S: event_state::State> EventBuilder<'a, S> {
29632963+ /// Set the `initIp` field (optional)
29642964+ pub fn init_ip(
29652965+ mut self,
29662966+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
29672967+ ) -> Self {
29682968+ self.__unsafe_private_named.7 = value.into();
29692969+ self
29702970+ }
29712971+ /// Set the `initIp` field to an Option value (optional)
29722972+ pub fn maybe_init_ip(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
29732973+ self.__unsafe_private_named.7 = value;
29742974+ self
29752975+ }
29762976+}
29772977+29782978+impl<'a, S: event_state::State> EventBuilder<'a, S> {
29792979+ /// Set the `initUa` field (optional)
29802980+ pub fn init_ua(
29812981+ mut self,
29822982+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
29832983+ ) -> Self {
29842984+ self.__unsafe_private_named.8 = value.into();
29852985+ self
29862986+ }
29872987+ /// Set the `initUa` field to an Option value (optional)
29882988+ pub fn maybe_init_ua(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
29892989+ self.__unsafe_private_named.8 = value;
29902990+ self
29912991+ }
29922992+}
29932993+29942994+impl<'a, S: event_state::State> EventBuilder<'a, S> {
29952995+ /// Set the `regionCode` field (optional)
29962996+ pub fn region_code(
29972997+ mut self,
29982998+ value: impl Into<Option<jacquard_common::CowStr<'a>>>,
29992999+ ) -> Self {
30003000+ self.__unsafe_private_named.9 = value.into();
30013001+ self
30023002+ }
30033003+ /// Set the `regionCode` field to an Option value (optional)
30043004+ pub fn maybe_region_code(
30053005+ mut self,
30063006+ value: Option<jacquard_common::CowStr<'a>>,
30073007+ ) -> Self {
30083008+ self.__unsafe_private_named.9 = value;
30093009+ self
30103010+ }
30113011+}
30123012+30133013+impl<'a, S> EventBuilder<'a, S>
30143014+where
30153015+ S: event_state::State,
30163016+ S::Status: event_state::IsUnset,
30173017+{
30183018+ /// Set the `status` field (required)
30193019+ pub fn status(
30203020+ mut self,
30213021+ value: impl Into<jacquard_common::CowStr<'a>>,
30223022+ ) -> EventBuilder<'a, event_state::SetStatus<S>> {
30233023+ self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into());
30243024+ EventBuilder {
30253025+ _phantom_state: ::core::marker::PhantomData,
30263026+ __unsafe_private_named: self.__unsafe_private_named,
30273027+ _phantom: ::core::marker::PhantomData,
30283028+ }
30293029+ }
30303030+}
30313031+30323032+impl<'a, S> EventBuilder<'a, S>
30333033+where
30343034+ S: event_state::State,
30353035+ S::CreatedAt: event_state::IsSet,
30363036+ S::Status: event_state::IsSet,
30373037+ S::Access: event_state::IsSet,
30383038+ S::AttemptId: event_state::IsSet,
30393039+ S::CountryCode: event_state::IsSet,
30403040+{
30413041+ /// Build the final struct
30423042+ pub fn build(self) -> Event<'a> {
30433043+ Event {
30443044+ access: self.__unsafe_private_named.0.unwrap(),
30453045+ attempt_id: self.__unsafe_private_named.1.unwrap(),
30463046+ complete_ip: self.__unsafe_private_named.2,
30473047+ complete_ua: self.__unsafe_private_named.3,
30483048+ country_code: self.__unsafe_private_named.4.unwrap(),
30493049+ created_at: self.__unsafe_private_named.5.unwrap(),
30503050+ email: self.__unsafe_private_named.6,
30513051+ init_ip: self.__unsafe_private_named.7,
30523052+ init_ua: self.__unsafe_private_named.8,
30533053+ region_code: self.__unsafe_private_named.9,
30543054+ status: self.__unsafe_private_named.10.unwrap(),
30553055+ extra_data: Default::default(),
30563056+ }
30573057+ }
30583058+ /// Build the final struct with custom extra_data
30593059+ pub fn build_with_data(
30603060+ self,
30613061+ extra_data: std::collections::BTreeMap<
30623062+ jacquard_common::smol_str::SmolStr,
30633063+ jacquard_common::types::value::Data<'a>,
30643064+ >,
30653065+ ) -> Event<'a> {
30663066+ Event {
30673067+ access: self.__unsafe_private_named.0.unwrap(),
30683068+ attempt_id: self.__unsafe_private_named.1.unwrap(),
30693069+ complete_ip: self.__unsafe_private_named.2,
30703070+ complete_ua: self.__unsafe_private_named.3,
30713071+ country_code: self.__unsafe_private_named.4.unwrap(),
30723072+ created_at: self.__unsafe_private_named.5.unwrap(),
30733073+ email: self.__unsafe_private_named.6,
30743074+ init_ip: self.__unsafe_private_named.7,
30753075+ init_ua: self.__unsafe_private_named.8,
30763076+ region_code: self.__unsafe_private_named.9,
30773077+ status: self.__unsafe_private_named.10.unwrap(),
30783078+ extra_data: Some(extra_data),
30793079+ }
30803080+ }
30813081+}
30823082+30833083+impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Event<'a> {
30843084+ fn nsid() -> &'static str {
30853085+ "app.bsky.ageassurance.defs"
30863086+ }
30873087+ fn def_name() -> &'static str {
30883088+ "event"
30893089+ }
30903090+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
30913091+ lexicon_doc_app_bsky_ageassurance_defs()
30923092+ }
30933093+ fn validate(
30943094+ &self,
30953095+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
30963096+ Ok(())
30973097+ }
30983098+}
30993099+31003100+/// The user's computed Age Assurance state.
31013101+#[jacquard_derive::lexicon]
31023102+#[derive(
31033103+ serde::Serialize,
31043104+ serde::Deserialize,
31053105+ Debug,
31063106+ Clone,
31073107+ PartialEq,
31083108+ Eq,
31093109+ jacquard_derive::IntoStatic
31103110+)]
31113111+#[serde(rename_all = "camelCase")]
31123112+pub struct State<'a> {
31133113+ #[serde(borrow)]
31143114+ pub access: crate::app_bsky::ageassurance::Access<'a>,
31153115+ /// The timestamp when this state was last updated.
31163116+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
31173117+ pub last_initiated_at: std::option::Option<jacquard_common::types::string::Datetime>,
31183118+ #[serde(borrow)]
31193119+ pub status: crate::app_bsky::ageassurance::Status<'a>,
31203120+}
31213121+31223122+pub mod state_state {
31233123+31243124+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
31253125+ #[allow(unused)]
31263126+ use ::core::marker::PhantomData;
31273127+ mod sealed {
31283128+ pub trait Sealed {}
31293129+ }
31303130+ /// State trait tracking which required fields have been set
31313131+ pub trait State: sealed::Sealed {
31323132+ type Status;
31333133+ type Access;
31343134+ }
31353135+ /// Empty state - all required fields are unset
31363136+ pub struct Empty(());
31373137+ impl sealed::Sealed for Empty {}
31383138+ impl State for Empty {
31393139+ type Status = Unset;
31403140+ type Access = Unset;
31413141+ }
31423142+ ///State transition - sets the `status` field to Set
31433143+ pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
31443144+ impl<S: State> sealed::Sealed for SetStatus<S> {}
31453145+ impl<S: State> State for SetStatus<S> {
31463146+ type Status = Set<members::status>;
31473147+ type Access = S::Access;
31483148+ }
31493149+ ///State transition - sets the `access` field to Set
31503150+ pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
31513151+ impl<S: State> sealed::Sealed for SetAccess<S> {}
31523152+ impl<S: State> State for SetAccess<S> {
31533153+ type Status = S::Status;
31543154+ type Access = Set<members::access>;
31553155+ }
31563156+ /// Marker types for field names
31573157+ #[allow(non_camel_case_types)]
31583158+ pub mod members {
31593159+ ///Marker type for the `status` field
31603160+ pub struct status(());
31613161+ ///Marker type for the `access` field
31623162+ pub struct access(());
31633163+ }
31643164+}
31653165+31663166+/// Builder for constructing an instance of this type
31673167+pub struct StateBuilder<'a, S: state_state::State> {
31683168+ _phantom_state: ::core::marker::PhantomData<fn() -> S>,
31693169+ __unsafe_private_named: (
31703170+ ::core::option::Option<crate::app_bsky::ageassurance::Access<'a>>,
31713171+ ::core::option::Option<jacquard_common::types::string::Datetime>,
31723172+ ::core::option::Option<crate::app_bsky::ageassurance::Status<'a>>,
31733173+ ),
31743174+ _phantom: ::core::marker::PhantomData<&'a ()>,
31753175+}
31763176+31773177+impl<'a> State<'a> {
31783178+ /// Create a new builder for this type
31793179+ pub fn new() -> StateBuilder<'a, state_state::Empty> {
31803180+ StateBuilder::new()
31813181+ }
31823182+}
31833183+31843184+impl<'a> StateBuilder<'a, state_state::Empty> {
31853185+ /// Create a new builder with all fields unset
31863186+ pub fn new() -> Self {
31873187+ StateBuilder {
31883188+ _phantom_state: ::core::marker::PhantomData,
31893189+ __unsafe_private_named: (None, None, None),
31903190+ _phantom: ::core::marker::PhantomData,
31913191+ }
31923192+ }
31933193+}
31943194+31953195+impl<'a, S> StateBuilder<'a, S>
31963196+where
31973197+ S: state_state::State,
31983198+ S::Access: state_state::IsUnset,
31993199+{
32003200+ /// Set the `access` field (required)
32013201+ pub fn access(
32023202+ mut self,
32033203+ value: impl Into<crate::app_bsky::ageassurance::Access<'a>>,
32043204+ ) -> StateBuilder<'a, state_state::SetAccess<S>> {
32053205+ self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
32063206+ StateBuilder {
32073207+ _phantom_state: ::core::marker::PhantomData,
32083208+ __unsafe_private_named: self.__unsafe_private_named,
32093209+ _phantom: ::core::marker::PhantomData,
32103210+ }
32113211+ }
32123212+}
32133213+32143214+impl<'a, S: state_state::State> StateBuilder<'a, S> {
32153215+ /// Set the `lastInitiatedAt` field (optional)
32163216+ pub fn last_initiated_at(
32173217+ mut self,
32183218+ value: impl Into<Option<jacquard_common::types::string::Datetime>>,
32193219+ ) -> Self {
32203220+ self.__unsafe_private_named.1 = value.into();
32213221+ self
32223222+ }
32233223+ /// Set the `lastInitiatedAt` field to an Option value (optional)
32243224+ pub fn maybe_last_initiated_at(
32253225+ mut self,
32263226+ value: Option<jacquard_common::types::string::Datetime>,
32273227+ ) -> Self {
32283228+ self.__unsafe_private_named.1 = value;
32293229+ self
32303230+ }
32313231+}
32323232+32333233+impl<'a, S> StateBuilder<'a, S>
32343234+where
32353235+ S: state_state::State,
32363236+ S::Status: state_state::IsUnset,
32373237+{
32383238+ /// Set the `status` field (required)
32393239+ pub fn status(
32403240+ mut self,
32413241+ value: impl Into<crate::app_bsky::ageassurance::Status<'a>>,
32423242+ ) -> StateBuilder<'a, state_state::SetStatus<S>> {
32433243+ self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
32443244+ StateBuilder {
32453245+ _phantom_state: ::core::marker::PhantomData,
32463246+ __unsafe_private_named: self.__unsafe_private_named,
32473247+ _phantom: ::core::marker::PhantomData,
32483248+ }
32493249+ }
32503250+}
32513251+32523252+impl<'a, S> StateBuilder<'a, S>
32533253+where
32543254+ S: state_state::State,
32553255+ S::Status: state_state::IsSet,
32563256+ S::Access: state_state::IsSet,
32573257+{
32583258+ /// Build the final struct
32593259+ pub fn build(self) -> State<'a> {
32603260+ State {
32613261+ access: self.__unsafe_private_named.0.unwrap(),
32623262+ last_initiated_at: self.__unsafe_private_named.1,
32633263+ status: self.__unsafe_private_named.2.unwrap(),
32643264+ extra_data: Default::default(),
32653265+ }
32663266+ }
32673267+ /// Build the final struct with custom extra_data
32683268+ pub fn build_with_data(
32693269+ self,
32703270+ extra_data: std::collections::BTreeMap<
32713271+ jacquard_common::smol_str::SmolStr,
32723272+ jacquard_common::types::value::Data<'a>,
32733273+ >,
32743274+ ) -> State<'a> {
32753275+ State {
32763276+ access: self.__unsafe_private_named.0.unwrap(),
32773277+ last_initiated_at: self.__unsafe_private_named.1,
32783278+ status: self.__unsafe_private_named.2.unwrap(),
32793279+ extra_data: Some(extra_data),
32803280+ }
32813281+ }
32823282+}
32833283+32843284+impl<'a> ::jacquard_lexicon::schema::LexiconSchema for State<'a> {
32853285+ fn nsid() -> &'static str {
32863286+ "app.bsky.ageassurance.defs"
32873287+ }
32883288+ fn def_name() -> &'static str {
32893289+ "state"
32903290+ }
32913291+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
32923292+ lexicon_doc_app_bsky_ageassurance_defs()
32933293+ }
32943294+ fn validate(
32953295+ &self,
32963296+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
32973297+ Ok(())
32983298+ }
32993299+}
33003300+33013301+/// Additional metadata needed to compute Age Assurance state client-side.
33023302+#[jacquard_derive::lexicon]
33033303+#[derive(
33043304+ serde::Serialize,
33053305+ serde::Deserialize,
33063306+ Debug,
33073307+ Clone,
33083308+ PartialEq,
33093309+ Eq,
33103310+ jacquard_derive::IntoStatic,
33113311+ Default
33123312+)]
33133313+#[serde(rename_all = "camelCase")]
33143314+pub struct StateMetadata<'a> {
33153315+ /// The account creation timestamp.
33163316+ #[serde(skip_serializing_if = "std::option::Option::is_none")]
33173317+ pub account_created_at: std::option::Option<
33183318+ jacquard_common::types::string::Datetime,
33193319+ >,
33203320+}
33213321+33223322+impl<'a> ::jacquard_lexicon::schema::LexiconSchema for StateMetadata<'a> {
33233323+ fn nsid() -> &'static str {
33243324+ "app.bsky.ageassurance.defs"
33253325+ }
33263326+ fn def_name() -> &'static str {
33273327+ "stateMetadata"
33283328+ }
33293329+ fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
33303330+ lexicon_doc_app_bsky_ageassurance_defs()
33313331+ }
33323332+ fn validate(
33333333+ &self,
33343334+ ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
33353335+ Ok(())
33363336+ }
33373337+}
33383338+33393339+/// The status of the Age Assurance process.
33403340+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
33413341+pub enum Status<'a> {
33423342+ Unknown,
33433343+ Pending,
33443344+ Assured,
33453345+ Blocked,
33463346+ Other(jacquard_common::CowStr<'a>),
33473347+}
33483348+33493349+impl<'a> Status<'a> {
33503350+ pub fn as_str(&self) -> &str {
33513351+ match self {
33523352+ Self::Unknown => "unknown",
33533353+ Self::Pending => "pending",
33543354+ Self::Assured => "assured",
33553355+ Self::Blocked => "blocked",
33563356+ Self::Other(s) => s.as_ref(),
33573357+ }
33583358+ }
33593359+}
33603360+33613361+impl<'a> From<&'a str> for Status<'a> {
33623362+ fn from(s: &'a str) -> Self {
33633363+ match s {
33643364+ "unknown" => Self::Unknown,
33653365+ "pending" => Self::Pending,
33663366+ "assured" => Self::Assured,
33673367+ "blocked" => Self::Blocked,
33683368+ _ => Self::Other(jacquard_common::CowStr::from(s)),
33693369+ }
33703370+ }
33713371+}
33723372+33733373+impl<'a> From<String> for Status<'a> {
33743374+ fn from(s: String) -> Self {
33753375+ match s.as_str() {
33763376+ "unknown" => Self::Unknown,
33773377+ "pending" => Self::Pending,
33783378+ "assured" => Self::Assured,
33793379+ "blocked" => Self::Blocked,
33803380+ _ => Self::Other(jacquard_common::CowStr::from(s)),
33813381+ }
33823382+ }
33833383+}
33843384+33853385+impl<'a> AsRef<str> for Status<'a> {
33863386+ fn as_ref(&self) -> &str {
33873387+ self.as_str()
33883388+ }
33893389+}
33903390+33913391+impl<'a> serde::Serialize for Status<'a> {
33923392+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33933393+ where
33943394+ S: serde::Serializer,
33953395+ {
33963396+ serializer.serialize_str(self.as_str())
33973397+ }
33983398+}
33993399+34003400+impl<'de, 'a> serde::Deserialize<'de> for Status<'a>
34013401+where
34023402+ 'de: 'a,
34033403+{
34043404+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34053405+ where
34063406+ D: serde::Deserializer<'de>,
34073407+ {
34083408+ let s = <&'de str>::deserialize(deserializer)?;
34093409+ Ok(Self::from(s))
34103410+ }
34113411+}
34123412+34133413+impl jacquard_common::IntoStatic for Status<'_> {
34143414+ type Output = Status<'static>;
34153415+ fn into_static(self) -> Self::Output {
34163416+ match self {
34173417+ Status::Unknown => Status::Unknown,
34183418+ Status::Pending => Status::Pending,
34193419+ Status::Assured => Status::Assured,
34203420+ Status::Blocked => Status::Blocked,
34213421+ Status::Other(v) => Status::Other(v.into_static()),
34223422+ }
34233423+ }
34243424+}
···1010//! - Content changes (via `last_edit`) trigger paragraph memo re-evaluation
1111//! - The document struct itself is NOT wrapped in a Signal - use `use_hook`
12121313+use std::borrow::Cow;
1314use std::cell::RefCell;
1415use std::rc::Rc;
15161617use dioxus::prelude::*;
1718use loro::{
1818- ExportMode, LoroDoc, LoroList, LoroMap, LoroResult, LoroText, LoroValue, ToJson, UndoManager,
1919+ ExportMode, Frontiers, LoroDoc, LoroList, LoroMap, LoroResult, LoroText, LoroValue, ToJson,
2020+ UndoManager, VersionVector,
1921 cursor::{Cursor, Side},
2022};
21232224use jacquard::IntoStatic;
2325use jacquard::from_json_value;
2426use jacquard::types::string::AtUri;
2727+use weaver_api::com_atproto::repo::strong_ref::StrongRef;
2528use weaver_api::sh_weaver::embed::images::Image;
2929+use weaver_api::sh_weaver::notebook::entry::Entry;
26302731/// Helper for working with editor images.
2832/// Constructed from LoroMap data, NOT serialized directly.
···8084 /// Contains nested containers: images (LoroList), externals (LoroList), etc.
8185 embeds: LoroMap,
82868383- // --- Entry tracking ---
8484- /// AT-URI of the entry if editing an existing record.
8787+ // --- Entry tracking (reactive) ---
8888+ /// StrongRef to the entry if editing an existing record.
8589 /// None for new entries that haven't been published yet.
8686- entry_uri: Option<AtUri<'static>>,
9090+ /// Signal so cloned docs share the same state after publish.
9191+ pub entry_ref: Signal<Option<StrongRef<'static>>>,
9292+9393+ // --- Edit sync state (for PDS sync) ---
9494+ /// StrongRef to the sh.weaver.edit.root record for this edit session.
9595+ /// None if we haven't synced to PDS yet.
9696+ pub edit_root: Signal<Option<StrongRef<'static>>>,
9797+9898+ /// StrongRef to the most recent sh.weaver.edit.diff record.
9999+ /// Used for the `prev` field when creating new diffs.
100100+ /// None if no diffs have been created yet (only root exists).
101101+ pub last_diff: Signal<Option<StrongRef<'static>>>,
102102+103103+ /// Version vector at the time of last sync to PDS.
104104+ /// Used to export only changes since last sync.
105105+ /// None if never synced.
106106+ last_synced_version: Option<VersionVector>,
8710788108 // --- Editor state (non-reactive) ---
89109 /// Undo manager for the document.
···244264 created_at,
245265 tags,
246266 embeds,
247247- entry_uri: None,
267267+ entry_ref: Signal::new(None),
268268+ edit_root: Signal::new(None),
269269+ last_diff: Signal::new(None),
270270+ last_synced_version: None,
248271 undo_mgr: Rc::new(RefCell::new(undo_mgr)),
249272 loro_cursor,
250273 // Reactive editor state - wrapped in Signals
···260283 }
261284 }
262285286286+ /// Create an EditorDocument from a fetched Entry.
287287+ ///
288288+ /// MUST be called from within a reactive context (e.g., `use_hook`) to
289289+ /// properly initialize Dioxus Signals.
290290+ ///
291291+ /// # Arguments
292292+ /// * `entry` - The entry record fetched from PDS
293293+ /// * `entry_ref` - StrongRef to the entry (URI + CID)
294294+ pub fn from_entry(entry: &Entry<'_>, entry_ref: StrongRef<'static>) -> Self {
295295+ let mut doc = Self::new(entry.content.to_string());
296296+297297+ // Set metadata
298298+ doc.set_title(&entry.title);
299299+ doc.set_path(&entry.path);
300300+ doc.set_created_at(&entry.created_at.to_string());
301301+302302+ // Add tags
303303+ if let Some(ref tags) = entry.tags {
304304+ for tag in tags.iter() {
305305+ doc.add_tag(tag.as_ref());
306306+ }
307307+ }
308308+309309+ // Add existing images (no published_blob_uri needed - they're already in the entry)
310310+ if let Some(ref embeds) = entry.embeds {
311311+ if let Some(ref images) = embeds.images {
312312+ for img in &images.images {
313313+ doc.add_image(&img.clone().into_static(), None);
314314+ }
315315+ }
316316+ }
317317+318318+ // Set the entry_ref so subsequent publishes update this record
319319+ doc.set_entry_ref(Some(entry_ref));
320320+321321+ doc
322322+ }
323323+263324 /// Generate current datetime as ISO 8601 string.
264325 #[cfg(target_family = "wasm")]
265326 fn current_datetime_string() -> String {
···359420 self.created_at.insert(0, datetime).ok();
360421 }
361422362362- // --- Entry URI accessors ---
423423+ // --- Entry ref accessors ---
363424364364- /// Get the AT-URI of the entry if editing an existing record.
365365- pub fn entry_uri(&self) -> Option<&AtUri<'static>> {
366366- self.entry_uri.as_ref()
425425+ /// Get the StrongRef to the entry if editing an existing record.
426426+ pub fn entry_ref(&self) -> Option<StrongRef<'static>> {
427427+ self.entry_ref.read().clone()
367428 }
368429369369- /// Set the AT-URI when editing an existing entry.
370370- pub fn set_entry_uri(&mut self, uri: Option<AtUri<'static>>) {
371371- self.entry_uri = uri;
430430+ /// Set the StrongRef when editing an existing entry.
431431+ pub fn set_entry_ref(&mut self, entry: Option<StrongRef<'static>>) {
432432+ self.entry_ref.set(entry);
372433 }
373434374435 // --- Tags accessors ---
···689750690751 /// Get the current state frontiers for change detection.
691752 /// Frontiers represent the "version" of the document state.
692692- pub fn state_frontiers(&self) -> loro::Frontiers {
753753+ pub fn state_frontiers(&self) -> Frontiers {
693754 self.doc.state_frontiers()
694755 }
695756757757+ /// Get the current version vector.
758758+ pub fn version_vector(&self) -> VersionVector {
759759+ self.doc.oplog_vv()
760760+ }
761761+696762 /// Get the last edit info for incremental rendering.
697763 /// Reading this creates a reactive dependency on content changes.
698764 pub fn last_edit(&self) -> Option<EditInfo> {
699765 self.last_edit.read().clone()
700766 }
701767768768+ // --- Edit sync methods ---
769769+770770+ /// Get the edit root StrongRef if set.
771771+ pub fn edit_root(&self) -> Option<StrongRef<'static>> {
772772+ self.edit_root.read().clone()
773773+ }
774774+775775+ /// Set the edit root after creating or finding the root record.
776776+ pub fn set_edit_root(&mut self, root: Option<StrongRef<'static>>) {
777777+ self.edit_root.set(root);
778778+ }
779779+780780+ /// Get the last diff StrongRef if set.
781781+ pub fn last_diff(&self) -> Option<StrongRef<'static>> {
782782+ self.last_diff.read().clone()
783783+ }
784784+785785+ /// Set the last diff after creating a new diff record.
786786+ pub fn set_last_diff(&mut self, diff: Option<StrongRef<'static>>) {
787787+ self.last_diff.set(diff);
788788+ }
789789+790790+ /// Check if there are unsynchronized changes since the last sync.
791791+ pub fn has_unsync_changes(&self) -> bool {
792792+ match &self.last_synced_version {
793793+ Some(synced_vv) => self.doc.oplog_vv() != *synced_vv,
794794+ None => true, // Never synced, so there are changes
795795+ }
796796+ }
797797+798798+ /// Export updates since the last sync.
799799+ /// Returns None if there are no changes to export.
800800+ /// After successful upload, call `mark_synced()` to update the sync marker.
801801+ pub fn export_updates_since_sync(&self) -> Option<Vec<u8>> {
802802+ let from_vv = self.last_synced_version.clone().unwrap_or_default();
803803+ let current_vv = self.doc.oplog_vv();
804804+805805+ // No changes since last sync
806806+ if from_vv == current_vv {
807807+ return None;
808808+ }
809809+810810+ let updates = self
811811+ .doc
812812+ .export(ExportMode::Updates {
813813+ from: Cow::Owned(from_vv),
814814+ })
815815+ .ok()?;
816816+817817+ // Don't return empty updates
818818+ if updates.is_empty() {
819819+ return None;
820820+ }
821821+822822+ Some(updates)
823823+ }
824824+825825+ /// Mark the current state as synced.
826826+ /// Call this after successfully uploading a diff to the PDS.
827827+ pub fn mark_synced(&mut self) {
828828+ self.last_synced_version = Some(self.doc.oplog_vv());
829829+ }
830830+831831+ /// Import updates from a PDS diff blob.
832832+ /// Used when loading edit history from the PDS.
833833+ pub fn import_updates(&mut self, updates: &[u8]) -> LoroResult<()> {
834834+ self.doc.import(updates)?;
835835+ Ok(())
836836+ }
837837+838838+ /// Set the sync state when loading from PDS.
839839+ /// This sets the version marker to the current state so we don't
840840+ /// re-upload what we just downloaded.
841841+ pub fn set_synced_from_pds(
842842+ &mut self,
843843+ edit_root: StrongRef<'static>,
844844+ last_diff: Option<StrongRef<'static>>,
845845+ ) {
846846+ self.edit_root.set(Some(edit_root));
847847+ self.last_diff.set(last_diff);
848848+ self.last_synced_version = Some(self.doc.oplog_vv());
849849+ }
850850+702851 /// Create a new EditorDocument from a binary snapshot.
703852 /// Falls back to empty document if import fails.
704853 ///
···765914 created_at,
766915 tags,
767916 embeds,
768768- entry_uri: None,
917917+ entry_ref: Signal::new(None),
918918+ edit_root: Signal::new(None),
919919+ last_diff: Signal::new(None),
920920+ last_synced_version: None,
769921 undo_mgr: Rc::new(RefCell::new(undo_mgr)),
770922 loro_cursor,
771923 // Reactive editor state - wrapped in Signals
+27-1
crates/weaver-app/src/components/editor/input.rs
···2626 _ => {}
2727 }
2828 }
2929+ // Intercept Cmd+Backspace (delete to start of line) and Cmd+Delete (delete to end)
3030+ if matches!(key, Key::Backspace | Key::Delete) {
3131+ return true;
3232+ }
2933 // Let browser handle other Ctrl/Cmd shortcuts (paste, copy, cut, etc.)
3034 return false;
3135 }
···151155 doc.cursor.write().offset = start;
152156 } else if doc.cursor.read().offset > 0 {
153157 let cursor_offset = doc.cursor.read().offset;
158158+159159+ // Cmd+Backspace: delete to start of line
160160+ if mods.meta() || mods.ctrl() {
161161+ let line_start = find_line_start(doc.loro_text(), cursor_offset);
162162+ if line_start < cursor_offset {
163163+ let _ = doc.remove_tracked(line_start, cursor_offset - line_start);
164164+ doc.cursor.write().offset = line_start;
165165+ }
166166+ return;
167167+ }
168168+154169 // Check if we're about to delete a newline
155170 let prev_char = get_char_at(doc.loro_text(), cursor_offset - 1);
156171···213228 doc.cursor.write().offset = start;
214229 } else {
215230 let cursor_offset = doc.cursor.read().offset;
216216- if cursor_offset < doc.len_chars() {
231231+ let doc_len = doc.len_chars();
232232+233233+ // Cmd+Delete: delete to end of line
234234+ if mods.meta() || mods.ctrl() {
235235+ let line_end = find_line_end(doc.loro_text(), cursor_offset);
236236+ if cursor_offset < line_end {
237237+ let _ = doc.remove_tracked(cursor_offset, line_end - cursor_offset);
238238+ }
239239+ return;
240240+ }
241241+242242+ if cursor_offset < doc_len {
217243 // Delete next char
218244 let _ = doc.remove_tracked(cursor_offset, 1);
219245 }
···5566/// Editor page view.
77///
88-/// Displays the markdown editor at the /editor route for testing during development.
99-/// Eventually this will be integrated into the notebook editing workflow.
88+/// Displays the markdown editor at the /editor route.
99+/// Optionally loads an existing entry for editing via `?entry={at-uri}`.
1010#[component]
1111-pub fn Editor() -> Element {
1111+pub fn Editor(entry: Option<String>) -> Element {
1212 rsx! {
1313 EditorCss {}
1414 div { class: "editor-page",
1515- MarkdownEditor { initial_content: None }
1515+ MarkdownEditor { entry_uri: entry }
1616 }
1717 }
1818}