jacquard_api/com_atproto/
label.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.label.defs
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8pub mod query_labels;
9
10#[cfg(feature = "streaming")]
11pub mod subscribe_labels;
12
13/// Metadata tag on an atproto resource (eg, repo or record).
14#[jacquard_derive::lexicon]
15#[derive(
16    serde::Serialize,
17    serde::Deserialize,
18    Debug,
19    Clone,
20    PartialEq,
21    Eq,
22    jacquard_derive::IntoStatic
23)]
24#[serde(rename_all = "camelCase")]
25pub struct Label<'a> {
26    /// Optionally, CID specifying the specific version of 'uri' resource this label applies to.
27    #[serde(skip_serializing_if = "std::option::Option::is_none")]
28    #[serde(borrow)]
29    pub cid: Option<jacquard_common::types::string::Cid<'a>>,
30    /// Timestamp when this label was created.
31    pub cts: jacquard_common::types::string::Datetime,
32    /// Timestamp at which this label expires (no longer applies).
33    #[serde(skip_serializing_if = "std::option::Option::is_none")]
34    pub exp: Option<jacquard_common::types::string::Datetime>,
35    /// If true, this is a negation label, overwriting a previous label.
36    #[serde(skip_serializing_if = "std::option::Option::is_none")]
37    pub neg: Option<bool>,
38    /// Signature of dag-cbor encoded label.
39    #[serde(skip_serializing_if = "std::option::Option::is_none")]
40    pub sig: Option<bytes::Bytes>,
41    /// DID of the actor who created this label.
42    #[serde(borrow)]
43    pub src: jacquard_common::types::string::Did<'a>,
44    /// AT URI of the record, repository (account), or other resource that this label applies to.
45    #[serde(borrow)]
46    pub uri: jacquard_common::types::string::Uri<'a>,
47    /// The short string name of the value or type of this label.
48    #[serde(borrow)]
49    pub val: jacquard_common::CowStr<'a>,
50    /// The AT Protocol version of the label object.
51    #[serde(skip_serializing_if = "std::option::Option::is_none")]
52    pub ver: Option<i64>,
53}
54
55pub mod label_state {
56
57    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
58    #[allow(unused)]
59    use ::core::marker::PhantomData;
60    mod sealed {
61        pub trait Sealed {}
62    }
63    /// State trait tracking which required fields have been set
64    pub trait State: sealed::Sealed {
65        type Src;
66        type Uri;
67        type Val;
68        type Cts;
69    }
70    /// Empty state - all required fields are unset
71    pub struct Empty(());
72    impl sealed::Sealed for Empty {}
73    impl State for Empty {
74        type Src = Unset;
75        type Uri = Unset;
76        type Val = Unset;
77        type Cts = Unset;
78    }
79    ///State transition - sets the `src` field to Set
80    pub struct SetSrc<S: State = Empty>(PhantomData<fn() -> S>);
81    impl<S: State> sealed::Sealed for SetSrc<S> {}
82    impl<S: State> State for SetSrc<S> {
83        type Src = Set<members::src>;
84        type Uri = S::Uri;
85        type Val = S::Val;
86        type Cts = S::Cts;
87    }
88    ///State transition - sets the `uri` field to Set
89    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
90    impl<S: State> sealed::Sealed for SetUri<S> {}
91    impl<S: State> State for SetUri<S> {
92        type Src = S::Src;
93        type Uri = Set<members::uri>;
94        type Val = S::Val;
95        type Cts = S::Cts;
96    }
97    ///State transition - sets the `val` field to Set
98    pub struct SetVal<S: State = Empty>(PhantomData<fn() -> S>);
99    impl<S: State> sealed::Sealed for SetVal<S> {}
100    impl<S: State> State for SetVal<S> {
101        type Src = S::Src;
102        type Uri = S::Uri;
103        type Val = Set<members::val>;
104        type Cts = S::Cts;
105    }
106    ///State transition - sets the `cts` field to Set
107    pub struct SetCts<S: State = Empty>(PhantomData<fn() -> S>);
108    impl<S: State> sealed::Sealed for SetCts<S> {}
109    impl<S: State> State for SetCts<S> {
110        type Src = S::Src;
111        type Uri = S::Uri;
112        type Val = S::Val;
113        type Cts = Set<members::cts>;
114    }
115    /// Marker types for field names
116    #[allow(non_camel_case_types)]
117    pub mod members {
118        ///Marker type for the `src` field
119        pub struct src(());
120        ///Marker type for the `uri` field
121        pub struct uri(());
122        ///Marker type for the `val` field
123        pub struct val(());
124        ///Marker type for the `cts` field
125        pub struct cts(());
126    }
127}
128
129/// Builder for constructing an instance of this type
130pub struct LabelBuilder<'a, S: label_state::State> {
131    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
132    __unsafe_private_named: (
133        ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
134        ::core::option::Option<jacquard_common::types::string::Datetime>,
135        ::core::option::Option<jacquard_common::types::string::Datetime>,
136        ::core::option::Option<bool>,
137        ::core::option::Option<bytes::Bytes>,
138        ::core::option::Option<jacquard_common::types::string::Did<'a>>,
139        ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
140        ::core::option::Option<jacquard_common::CowStr<'a>>,
141        ::core::option::Option<i64>,
142    ),
143    _phantom: ::core::marker::PhantomData<&'a ()>,
144}
145
146impl<'a> Label<'a> {
147    /// Create a new builder for this type
148    pub fn new() -> LabelBuilder<'a, label_state::Empty> {
149        LabelBuilder::new()
150    }
151}
152
153impl<'a> LabelBuilder<'a, label_state::Empty> {
154    /// Create a new builder with all fields unset
155    pub fn new() -> Self {
156        LabelBuilder {
157            _phantom_state: ::core::marker::PhantomData,
158            __unsafe_private_named: (
159                None,
160                None,
161                None,
162                None,
163                None,
164                None,
165                None,
166                None,
167                None,
168            ),
169            _phantom: ::core::marker::PhantomData,
170        }
171    }
172}
173
174impl<'a, S: label_state::State> LabelBuilder<'a, S> {
175    /// Set the `cid` field (optional)
176    pub fn cid(
177        mut self,
178        value: impl Into<Option<jacquard_common::types::string::Cid<'a>>>,
179    ) -> Self {
180        self.__unsafe_private_named.0 = value.into();
181        self
182    }
183    /// Set the `cid` field to an Option value (optional)
184    pub fn maybe_cid(
185        mut self,
186        value: Option<jacquard_common::types::string::Cid<'a>>,
187    ) -> Self {
188        self.__unsafe_private_named.0 = value;
189        self
190    }
191}
192
193impl<'a, S> LabelBuilder<'a, S>
194where
195    S: label_state::State,
196    S::Cts: label_state::IsUnset,
197{
198    /// Set the `cts` field (required)
199    pub fn cts(
200        mut self,
201        value: impl Into<jacquard_common::types::string::Datetime>,
202    ) -> LabelBuilder<'a, label_state::SetCts<S>> {
203        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
204        LabelBuilder {
205            _phantom_state: ::core::marker::PhantomData,
206            __unsafe_private_named: self.__unsafe_private_named,
207            _phantom: ::core::marker::PhantomData,
208        }
209    }
210}
211
212impl<'a, S: label_state::State> LabelBuilder<'a, S> {
213    /// Set the `exp` field (optional)
214    pub fn exp(
215        mut self,
216        value: impl Into<Option<jacquard_common::types::string::Datetime>>,
217    ) -> Self {
218        self.__unsafe_private_named.2 = value.into();
219        self
220    }
221    /// Set the `exp` field to an Option value (optional)
222    pub fn maybe_exp(
223        mut self,
224        value: Option<jacquard_common::types::string::Datetime>,
225    ) -> Self {
226        self.__unsafe_private_named.2 = value;
227        self
228    }
229}
230
231impl<'a, S: label_state::State> LabelBuilder<'a, S> {
232    /// Set the `neg` field (optional)
233    pub fn neg(mut self, value: impl Into<Option<bool>>) -> Self {
234        self.__unsafe_private_named.3 = value.into();
235        self
236    }
237    /// Set the `neg` field to an Option value (optional)
238    pub fn maybe_neg(mut self, value: Option<bool>) -> Self {
239        self.__unsafe_private_named.3 = value;
240        self
241    }
242}
243
244impl<'a, S: label_state::State> LabelBuilder<'a, S> {
245    /// Set the `sig` field (optional)
246    pub fn sig(mut self, value: impl Into<Option<bytes::Bytes>>) -> Self {
247        self.__unsafe_private_named.4 = value.into();
248        self
249    }
250    /// Set the `sig` field to an Option value (optional)
251    pub fn maybe_sig(mut self, value: Option<bytes::Bytes>) -> Self {
252        self.__unsafe_private_named.4 = value;
253        self
254    }
255}
256
257impl<'a, S> LabelBuilder<'a, S>
258where
259    S: label_state::State,
260    S::Src: label_state::IsUnset,
261{
262    /// Set the `src` field (required)
263    pub fn src(
264        mut self,
265        value: impl Into<jacquard_common::types::string::Did<'a>>,
266    ) -> LabelBuilder<'a, label_state::SetSrc<S>> {
267        self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
268        LabelBuilder {
269            _phantom_state: ::core::marker::PhantomData,
270            __unsafe_private_named: self.__unsafe_private_named,
271            _phantom: ::core::marker::PhantomData,
272        }
273    }
274}
275
276impl<'a, S> LabelBuilder<'a, S>
277where
278    S: label_state::State,
279    S::Uri: label_state::IsUnset,
280{
281    /// Set the `uri` field (required)
282    pub fn uri(
283        mut self,
284        value: impl Into<jacquard_common::types::string::Uri<'a>>,
285    ) -> LabelBuilder<'a, label_state::SetUri<S>> {
286        self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
287        LabelBuilder {
288            _phantom_state: ::core::marker::PhantomData,
289            __unsafe_private_named: self.__unsafe_private_named,
290            _phantom: ::core::marker::PhantomData,
291        }
292    }
293}
294
295impl<'a, S> LabelBuilder<'a, S>
296where
297    S: label_state::State,
298    S::Val: label_state::IsUnset,
299{
300    /// Set the `val` field (required)
301    pub fn val(
302        mut self,
303        value: impl Into<jacquard_common::CowStr<'a>>,
304    ) -> LabelBuilder<'a, label_state::SetVal<S>> {
305        self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
306        LabelBuilder {
307            _phantom_state: ::core::marker::PhantomData,
308            __unsafe_private_named: self.__unsafe_private_named,
309            _phantom: ::core::marker::PhantomData,
310        }
311    }
312}
313
314impl<'a, S: label_state::State> LabelBuilder<'a, S> {
315    /// Set the `ver` field (optional)
316    pub fn ver(mut self, value: impl Into<Option<i64>>) -> Self {
317        self.__unsafe_private_named.8 = value.into();
318        self
319    }
320    /// Set the `ver` field to an Option value (optional)
321    pub fn maybe_ver(mut self, value: Option<i64>) -> Self {
322        self.__unsafe_private_named.8 = value;
323        self
324    }
325}
326
327impl<'a, S> LabelBuilder<'a, S>
328where
329    S: label_state::State,
330    S::Src: label_state::IsSet,
331    S::Uri: label_state::IsSet,
332    S::Val: label_state::IsSet,
333    S::Cts: label_state::IsSet,
334{
335    /// Build the final struct
336    pub fn build(self) -> Label<'a> {
337        Label {
338            cid: self.__unsafe_private_named.0,
339            cts: self.__unsafe_private_named.1.unwrap(),
340            exp: self.__unsafe_private_named.2,
341            neg: self.__unsafe_private_named.3,
342            sig: self.__unsafe_private_named.4,
343            src: self.__unsafe_private_named.5.unwrap(),
344            uri: self.__unsafe_private_named.6.unwrap(),
345            val: self.__unsafe_private_named.7.unwrap(),
346            ver: self.__unsafe_private_named.8,
347            extra_data: Default::default(),
348        }
349    }
350    /// Build the final struct with custom extra_data
351    pub fn build_with_data(
352        self,
353        extra_data: std::collections::BTreeMap<
354            jacquard_common::smol_str::SmolStr,
355            jacquard_common::types::value::Data<'a>,
356        >,
357    ) -> Label<'a> {
358        Label {
359            cid: self.__unsafe_private_named.0,
360            cts: self.__unsafe_private_named.1.unwrap(),
361            exp: self.__unsafe_private_named.2,
362            neg: self.__unsafe_private_named.3,
363            sig: self.__unsafe_private_named.4,
364            src: self.__unsafe_private_named.5.unwrap(),
365            uri: self.__unsafe_private_named.6.unwrap(),
366            val: self.__unsafe_private_named.7.unwrap(),
367            ver: self.__unsafe_private_named.8,
368            extra_data: Some(extra_data),
369        }
370    }
371}
372
373fn lexicon_doc_com_atproto_label_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
374    'static,
375> {
376    ::jacquard_lexicon::lexicon::LexiconDoc {
377        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
378        id: ::jacquard_common::CowStr::new_static("com.atproto.label.defs"),
379        revision: None,
380        description: None,
381        defs: {
382            let mut map = ::std::collections::BTreeMap::new();
383            map.insert(
384                ::jacquard_common::smol_str::SmolStr::new_static("label"),
385                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
386                    description: Some(
387                        ::jacquard_common::CowStr::new_static(
388                            "Metadata tag on an atproto resource (eg, repo or record).",
389                        ),
390                    ),
391                    required: Some(
392                        vec![
393                            ::jacquard_common::smol_str::SmolStr::new_static("src"),
394                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
395                            ::jacquard_common::smol_str::SmolStr::new_static("val"),
396                            ::jacquard_common::smol_str::SmolStr::new_static("cts")
397                        ],
398                    ),
399                    nullable: None,
400                    properties: {
401                        #[allow(unused_mut)]
402                        let mut map = ::std::collections::BTreeMap::new();
403                        map.insert(
404                            ::jacquard_common::smol_str::SmolStr::new_static("cid"),
405                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
406                                description: Some(
407                                    ::jacquard_common::CowStr::new_static(
408                                        "Optionally, CID specifying the specific version of 'uri' resource this label applies to.",
409                                    ),
410                                ),
411                                format: Some(
412                                    ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
413                                ),
414                                default: None,
415                                min_length: None,
416                                max_length: None,
417                                min_graphemes: None,
418                                max_graphemes: None,
419                                r#enum: None,
420                                r#const: None,
421                                known_values: None,
422                            }),
423                        );
424                        map.insert(
425                            ::jacquard_common::smol_str::SmolStr::new_static("cts"),
426                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
427                                description: Some(
428                                    ::jacquard_common::CowStr::new_static(
429                                        "Timestamp when this label was created.",
430                                    ),
431                                ),
432                                format: Some(
433                                    ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
434                                ),
435                                default: None,
436                                min_length: None,
437                                max_length: None,
438                                min_graphemes: None,
439                                max_graphemes: None,
440                                r#enum: None,
441                                r#const: None,
442                                known_values: None,
443                            }),
444                        );
445                        map.insert(
446                            ::jacquard_common::smol_str::SmolStr::new_static("exp"),
447                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
448                                description: Some(
449                                    ::jacquard_common::CowStr::new_static(
450                                        "Timestamp at which this label expires (no longer applies).",
451                                    ),
452                                ),
453                                format: Some(
454                                    ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
455                                ),
456                                default: None,
457                                min_length: None,
458                                max_length: None,
459                                min_graphemes: None,
460                                max_graphemes: None,
461                                r#enum: None,
462                                r#const: None,
463                                known_values: None,
464                            }),
465                        );
466                        map.insert(
467                            ::jacquard_common::smol_str::SmolStr::new_static("neg"),
468                            ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
469                                description: None,
470                                default: None,
471                                r#const: None,
472                            }),
473                        );
474                        map.insert(
475                            ::jacquard_common::smol_str::SmolStr::new_static("sig"),
476                            ::jacquard_lexicon::lexicon::LexObjectProperty::Bytes(::jacquard_lexicon::lexicon::LexBytes {
477                                description: None,
478                                max_length: None,
479                                min_length: None,
480                            }),
481                        );
482                        map.insert(
483                            ::jacquard_common::smol_str::SmolStr::new_static("src"),
484                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
485                                description: Some(
486                                    ::jacquard_common::CowStr::new_static(
487                                        "DID of the actor who created this label.",
488                                    ),
489                                ),
490                                format: Some(
491                                    ::jacquard_lexicon::lexicon::LexStringFormat::Did,
492                                ),
493                                default: None,
494                                min_length: None,
495                                max_length: None,
496                                min_graphemes: None,
497                                max_graphemes: None,
498                                r#enum: None,
499                                r#const: None,
500                                known_values: None,
501                            }),
502                        );
503                        map.insert(
504                            ::jacquard_common::smol_str::SmolStr::new_static("uri"),
505                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
506                                description: Some(
507                                    ::jacquard_common::CowStr::new_static(
508                                        "AT URI of the record, repository (account), or other resource that this label applies to.",
509                                    ),
510                                ),
511                                format: Some(
512                                    ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
513                                ),
514                                default: None,
515                                min_length: None,
516                                max_length: None,
517                                min_graphemes: None,
518                                max_graphemes: None,
519                                r#enum: None,
520                                r#const: None,
521                                known_values: None,
522                            }),
523                        );
524                        map.insert(
525                            ::jacquard_common::smol_str::SmolStr::new_static("val"),
526                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
527                                description: Some(
528                                    ::jacquard_common::CowStr::new_static(
529                                        "The short string name of the value or type of this label.",
530                                    ),
531                                ),
532                                format: None,
533                                default: None,
534                                min_length: None,
535                                max_length: Some(128usize),
536                                min_graphemes: None,
537                                max_graphemes: None,
538                                r#enum: None,
539                                r#const: None,
540                                known_values: None,
541                            }),
542                        );
543                        map.insert(
544                            ::jacquard_common::smol_str::SmolStr::new_static("ver"),
545                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
546                                description: None,
547                                default: None,
548                                minimum: None,
549                                maximum: None,
550                                r#enum: None,
551                                r#const: None,
552                            }),
553                        );
554                        map
555                    },
556                }),
557            );
558            map.insert(
559                ::jacquard_common::smol_str::SmolStr::new_static("labelValue"),
560                ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString {
561                    description: None,
562                    format: None,
563                    default: None,
564                    min_length: None,
565                    max_length: None,
566                    min_graphemes: None,
567                    max_graphemes: None,
568                    r#enum: None,
569                    r#const: None,
570                    known_values: None,
571                }),
572            );
573            map.insert(
574                ::jacquard_common::smol_str::SmolStr::new_static("labelValueDefinition"),
575                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
576                    description: Some(
577                        ::jacquard_common::CowStr::new_static(
578                            "Declares a label value and its expected interpretations and behaviors.",
579                        ),
580                    ),
581                    required: Some(
582                        vec![
583                            ::jacquard_common::smol_str::SmolStr::new_static("identifier"),
584                            ::jacquard_common::smol_str::SmolStr::new_static("severity"),
585                            ::jacquard_common::smol_str::SmolStr::new_static("blurs"),
586                            ::jacquard_common::smol_str::SmolStr::new_static("locales")
587                        ],
588                    ),
589                    nullable: None,
590                    properties: {
591                        #[allow(unused_mut)]
592                        let mut map = ::std::collections::BTreeMap::new();
593                        map.insert(
594                            ::jacquard_common::smol_str::SmolStr::new_static(
595                                "adultOnly",
596                            ),
597                            ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
598                                description: None,
599                                default: None,
600                                r#const: None,
601                            }),
602                        );
603                        map.insert(
604                            ::jacquard_common::smol_str::SmolStr::new_static("blurs"),
605                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
606                                description: Some(
607                                    ::jacquard_common::CowStr::new_static(
608                                        "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.",
609                                    ),
610                                ),
611                                format: None,
612                                default: None,
613                                min_length: None,
614                                max_length: None,
615                                min_graphemes: None,
616                                max_graphemes: None,
617                                r#enum: None,
618                                r#const: None,
619                                known_values: None,
620                            }),
621                        );
622                        map.insert(
623                            ::jacquard_common::smol_str::SmolStr::new_static(
624                                "defaultSetting",
625                            ),
626                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
627                                description: Some(
628                                    ::jacquard_common::CowStr::new_static(
629                                        "The default setting for this label.",
630                                    ),
631                                ),
632                                format: None,
633                                default: None,
634                                min_length: None,
635                                max_length: None,
636                                min_graphemes: None,
637                                max_graphemes: None,
638                                r#enum: None,
639                                r#const: None,
640                                known_values: None,
641                            }),
642                        );
643                        map.insert(
644                            ::jacquard_common::smol_str::SmolStr::new_static(
645                                "identifier",
646                            ),
647                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
648                                description: Some(
649                                    ::jacquard_common::CowStr::new_static(
650                                        "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).",
651                                    ),
652                                ),
653                                format: None,
654                                default: None,
655                                min_length: None,
656                                max_length: Some(100usize),
657                                min_graphemes: None,
658                                max_graphemes: Some(100usize),
659                                r#enum: None,
660                                r#const: None,
661                                known_values: None,
662                            }),
663                        );
664                        map.insert(
665                            ::jacquard_common::smol_str::SmolStr::new_static("locales"),
666                            ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
667                                description: None,
668                                items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
669                                    description: None,
670                                    r#ref: ::jacquard_common::CowStr::new_static(
671                                        "#labelValueDefinitionStrings",
672                                    ),
673                                }),
674                                min_length: None,
675                                max_length: None,
676                            }),
677                        );
678                        map.insert(
679                            ::jacquard_common::smol_str::SmolStr::new_static("severity"),
680                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
681                                description: Some(
682                                    ::jacquard_common::CowStr::new_static(
683                                        "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.",
684                                    ),
685                                ),
686                                format: None,
687                                default: None,
688                                min_length: None,
689                                max_length: None,
690                                min_graphemes: None,
691                                max_graphemes: None,
692                                r#enum: None,
693                                r#const: None,
694                                known_values: None,
695                            }),
696                        );
697                        map
698                    },
699                }),
700            );
701            map.insert(
702                ::jacquard_common::smol_str::SmolStr::new_static(
703                    "labelValueDefinitionStrings",
704                ),
705                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
706                    description: Some(
707                        ::jacquard_common::CowStr::new_static(
708                            "Strings which describe the label in the UI, localized into a specific language.",
709                        ),
710                    ),
711                    required: Some(
712                        vec![
713                            ::jacquard_common::smol_str::SmolStr::new_static("lang"),
714                            ::jacquard_common::smol_str::SmolStr::new_static("name"),
715                            ::jacquard_common::smol_str::SmolStr::new_static("description")
716                        ],
717                    ),
718                    nullable: None,
719                    properties: {
720                        #[allow(unused_mut)]
721                        let mut map = ::std::collections::BTreeMap::new();
722                        map.insert(
723                            ::jacquard_common::smol_str::SmolStr::new_static(
724                                "description",
725                            ),
726                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
727                                description: Some(
728                                    ::jacquard_common::CowStr::new_static(
729                                        "A longer description of what the label means and why it might be applied.",
730                                    ),
731                                ),
732                                format: None,
733                                default: None,
734                                min_length: None,
735                                max_length: Some(100000usize),
736                                min_graphemes: None,
737                                max_graphemes: Some(10000usize),
738                                r#enum: None,
739                                r#const: None,
740                                known_values: None,
741                            }),
742                        );
743                        map.insert(
744                            ::jacquard_common::smol_str::SmolStr::new_static("lang"),
745                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
746                                description: Some(
747                                    ::jacquard_common::CowStr::new_static(
748                                        "The code of the language these strings are written in.",
749                                    ),
750                                ),
751                                format: Some(
752                                    ::jacquard_lexicon::lexicon::LexStringFormat::Language,
753                                ),
754                                default: None,
755                                min_length: None,
756                                max_length: None,
757                                min_graphemes: None,
758                                max_graphemes: None,
759                                r#enum: None,
760                                r#const: None,
761                                known_values: None,
762                            }),
763                        );
764                        map.insert(
765                            ::jacquard_common::smol_str::SmolStr::new_static("name"),
766                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
767                                description: Some(
768                                    ::jacquard_common::CowStr::new_static(
769                                        "A short human-readable name for the label.",
770                                    ),
771                                ),
772                                format: None,
773                                default: None,
774                                min_length: None,
775                                max_length: Some(640usize),
776                                min_graphemes: None,
777                                max_graphemes: Some(64usize),
778                                r#enum: None,
779                                r#const: None,
780                                known_values: None,
781                            }),
782                        );
783                        map
784                    },
785                }),
786            );
787            map.insert(
788                ::jacquard_common::smol_str::SmolStr::new_static("selfLabel"),
789                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
790                    description: Some(
791                        ::jacquard_common::CowStr::new_static(
792                            "Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.",
793                        ),
794                    ),
795                    required: Some(
796                        vec![::jacquard_common::smol_str::SmolStr::new_static("val")],
797                    ),
798                    nullable: None,
799                    properties: {
800                        #[allow(unused_mut)]
801                        let mut map = ::std::collections::BTreeMap::new();
802                        map.insert(
803                            ::jacquard_common::smol_str::SmolStr::new_static("val"),
804                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
805                                description: Some(
806                                    ::jacquard_common::CowStr::new_static(
807                                        "The short string name of the value or type of this label.",
808                                    ),
809                                ),
810                                format: None,
811                                default: None,
812                                min_length: None,
813                                max_length: Some(128usize),
814                                min_graphemes: None,
815                                max_graphemes: None,
816                                r#enum: None,
817                                r#const: None,
818                                known_values: None,
819                            }),
820                        );
821                        map
822                    },
823                }),
824            );
825            map.insert(
826                ::jacquard_common::smol_str::SmolStr::new_static("selfLabels"),
827                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
828                    description: Some(
829                        ::jacquard_common::CowStr::new_static(
830                            "Metadata tags on an atproto record, published by the author within the record.",
831                        ),
832                    ),
833                    required: Some(
834                        vec![::jacquard_common::smol_str::SmolStr::new_static("values")],
835                    ),
836                    nullable: None,
837                    properties: {
838                        #[allow(unused_mut)]
839                        let mut map = ::std::collections::BTreeMap::new();
840                        map.insert(
841                            ::jacquard_common::smol_str::SmolStr::new_static("values"),
842                            ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
843                                description: None,
844                                items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
845                                    description: None,
846                                    r#ref: ::jacquard_common::CowStr::new_static("#selfLabel"),
847                                }),
848                                min_length: None,
849                                max_length: Some(10usize),
850                            }),
851                        );
852                        map
853                    },
854                }),
855            );
856            map
857        },
858    }
859}
860
861impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Label<'a> {
862    fn nsid() -> &'static str {
863        "com.atproto.label.defs"
864    }
865    fn def_name() -> &'static str {
866        "label"
867    }
868    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
869        lexicon_doc_com_atproto_label_defs()
870    }
871    fn validate(
872        &self,
873    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
874        {
875            let value = &self.val;
876            #[allow(unused_comparisons)]
877            if <str>::len(value.as_ref()) > 128usize {
878                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
879                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
880                        "val",
881                    ),
882                    max: 128usize,
883                    actual: <str>::len(value.as_ref()),
884                });
885            }
886        }
887        Ok(())
888    }
889}
890
891#[derive(Debug, Clone, PartialEq, Eq, Hash)]
892pub enum LabelValue<'a> {
893    Hide,
894    NoPromote,
895    Warn,
896    NoUnauthenticated,
897    DmcaViolation,
898    Doxxing,
899    Porn,
900    Sexual,
901    Nudity,
902    Nsfl,
903    Gore,
904    Other(jacquard_common::CowStr<'a>),
905}
906
907impl<'a> LabelValue<'a> {
908    pub fn as_str(&self) -> &str {
909        match self {
910            Self::Hide => "!hide",
911            Self::NoPromote => "!no-promote",
912            Self::Warn => "!warn",
913            Self::NoUnauthenticated => "!no-unauthenticated",
914            Self::DmcaViolation => "dmca-violation",
915            Self::Doxxing => "doxxing",
916            Self::Porn => "porn",
917            Self::Sexual => "sexual",
918            Self::Nudity => "nudity",
919            Self::Nsfl => "nsfl",
920            Self::Gore => "gore",
921            Self::Other(s) => s.as_ref(),
922        }
923    }
924}
925
926impl<'a> From<&'a str> for LabelValue<'a> {
927    fn from(s: &'a str) -> Self {
928        match s {
929            "!hide" => Self::Hide,
930            "!no-promote" => Self::NoPromote,
931            "!warn" => Self::Warn,
932            "!no-unauthenticated" => Self::NoUnauthenticated,
933            "dmca-violation" => Self::DmcaViolation,
934            "doxxing" => Self::Doxxing,
935            "porn" => Self::Porn,
936            "sexual" => Self::Sexual,
937            "nudity" => Self::Nudity,
938            "nsfl" => Self::Nsfl,
939            "gore" => Self::Gore,
940            _ => Self::Other(jacquard_common::CowStr::from(s)),
941        }
942    }
943}
944
945impl<'a> From<String> for LabelValue<'a> {
946    fn from(s: String) -> Self {
947        match s.as_str() {
948            "!hide" => Self::Hide,
949            "!no-promote" => Self::NoPromote,
950            "!warn" => Self::Warn,
951            "!no-unauthenticated" => Self::NoUnauthenticated,
952            "dmca-violation" => Self::DmcaViolation,
953            "doxxing" => Self::Doxxing,
954            "porn" => Self::Porn,
955            "sexual" => Self::Sexual,
956            "nudity" => Self::Nudity,
957            "nsfl" => Self::Nsfl,
958            "gore" => Self::Gore,
959            _ => Self::Other(jacquard_common::CowStr::from(s)),
960        }
961    }
962}
963
964impl<'a> AsRef<str> for LabelValue<'a> {
965    fn as_ref(&self) -> &str {
966        self.as_str()
967    }
968}
969
970impl<'a> serde::Serialize for LabelValue<'a> {
971    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
972    where
973        S: serde::Serializer,
974    {
975        serializer.serialize_str(self.as_str())
976    }
977}
978
979impl<'de, 'a> serde::Deserialize<'de> for LabelValue<'a>
980where
981    'de: 'a,
982{
983    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
984    where
985        D: serde::Deserializer<'de>,
986    {
987        let s = <&'de str>::deserialize(deserializer)?;
988        Ok(Self::from(s))
989    }
990}
991
992impl jacquard_common::IntoStatic for LabelValue<'_> {
993    type Output = LabelValue<'static>;
994    fn into_static(self) -> Self::Output {
995        match self {
996            LabelValue::Hide => LabelValue::Hide,
997            LabelValue::NoPromote => LabelValue::NoPromote,
998            LabelValue::Warn => LabelValue::Warn,
999            LabelValue::NoUnauthenticated => LabelValue::NoUnauthenticated,
1000            LabelValue::DmcaViolation => LabelValue::DmcaViolation,
1001            LabelValue::Doxxing => LabelValue::Doxxing,
1002            LabelValue::Porn => LabelValue::Porn,
1003            LabelValue::Sexual => LabelValue::Sexual,
1004            LabelValue::Nudity => LabelValue::Nudity,
1005            LabelValue::Nsfl => LabelValue::Nsfl,
1006            LabelValue::Gore => LabelValue::Gore,
1007            LabelValue::Other(v) => LabelValue::Other(v.into_static()),
1008        }
1009    }
1010}
1011
1012/// Declares a label value and its expected interpretations and behaviors.
1013#[jacquard_derive::lexicon]
1014#[derive(
1015    serde::Serialize,
1016    serde::Deserialize,
1017    Debug,
1018    Clone,
1019    PartialEq,
1020    Eq,
1021    jacquard_derive::IntoStatic
1022)]
1023#[serde(rename_all = "camelCase")]
1024pub struct LabelValueDefinition<'a> {
1025    /// Does the user need to have adult content enabled in order to configure this label?
1026    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1027    pub adult_only: Option<bool>,
1028    /// What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.
1029    #[serde(borrow)]
1030    pub blurs: jacquard_common::CowStr<'a>,
1031    /// The default setting for this label.
1032    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1033    #[serde(borrow)]
1034    pub default_setting: Option<jacquard_common::CowStr<'a>>,
1035    /// The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).
1036    #[serde(borrow)]
1037    pub identifier: jacquard_common::CowStr<'a>,
1038    #[serde(borrow)]
1039    pub locales: Vec<crate::com_atproto::label::LabelValueDefinitionStrings<'a>>,
1040    /// How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.
1041    #[serde(borrow)]
1042    pub severity: jacquard_common::CowStr<'a>,
1043}
1044
1045pub mod label_value_definition_state {
1046
1047    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1048    #[allow(unused)]
1049    use ::core::marker::PhantomData;
1050    mod sealed {
1051        pub trait Sealed {}
1052    }
1053    /// State trait tracking which required fields have been set
1054    pub trait State: sealed::Sealed {
1055        type Identifier;
1056        type Severity;
1057        type Blurs;
1058        type Locales;
1059    }
1060    /// Empty state - all required fields are unset
1061    pub struct Empty(());
1062    impl sealed::Sealed for Empty {}
1063    impl State for Empty {
1064        type Identifier = Unset;
1065        type Severity = Unset;
1066        type Blurs = Unset;
1067        type Locales = Unset;
1068    }
1069    ///State transition - sets the `identifier` field to Set
1070    pub struct SetIdentifier<S: State = Empty>(PhantomData<fn() -> S>);
1071    impl<S: State> sealed::Sealed for SetIdentifier<S> {}
1072    impl<S: State> State for SetIdentifier<S> {
1073        type Identifier = Set<members::identifier>;
1074        type Severity = S::Severity;
1075        type Blurs = S::Blurs;
1076        type Locales = S::Locales;
1077    }
1078    ///State transition - sets the `severity` field to Set
1079    pub struct SetSeverity<S: State = Empty>(PhantomData<fn() -> S>);
1080    impl<S: State> sealed::Sealed for SetSeverity<S> {}
1081    impl<S: State> State for SetSeverity<S> {
1082        type Identifier = S::Identifier;
1083        type Severity = Set<members::severity>;
1084        type Blurs = S::Blurs;
1085        type Locales = S::Locales;
1086    }
1087    ///State transition - sets the `blurs` field to Set
1088    pub struct SetBlurs<S: State = Empty>(PhantomData<fn() -> S>);
1089    impl<S: State> sealed::Sealed for SetBlurs<S> {}
1090    impl<S: State> State for SetBlurs<S> {
1091        type Identifier = S::Identifier;
1092        type Severity = S::Severity;
1093        type Blurs = Set<members::blurs>;
1094        type Locales = S::Locales;
1095    }
1096    ///State transition - sets the `locales` field to Set
1097    pub struct SetLocales<S: State = Empty>(PhantomData<fn() -> S>);
1098    impl<S: State> sealed::Sealed for SetLocales<S> {}
1099    impl<S: State> State for SetLocales<S> {
1100        type Identifier = S::Identifier;
1101        type Severity = S::Severity;
1102        type Blurs = S::Blurs;
1103        type Locales = Set<members::locales>;
1104    }
1105    /// Marker types for field names
1106    #[allow(non_camel_case_types)]
1107    pub mod members {
1108        ///Marker type for the `identifier` field
1109        pub struct identifier(());
1110        ///Marker type for the `severity` field
1111        pub struct severity(());
1112        ///Marker type for the `blurs` field
1113        pub struct blurs(());
1114        ///Marker type for the `locales` field
1115        pub struct locales(());
1116    }
1117}
1118
1119/// Builder for constructing an instance of this type
1120pub struct LabelValueDefinitionBuilder<'a, S: label_value_definition_state::State> {
1121    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1122    __unsafe_private_named: (
1123        ::core::option::Option<bool>,
1124        ::core::option::Option<jacquard_common::CowStr<'a>>,
1125        ::core::option::Option<jacquard_common::CowStr<'a>>,
1126        ::core::option::Option<jacquard_common::CowStr<'a>>,
1127        ::core::option::Option<
1128            Vec<crate::com_atproto::label::LabelValueDefinitionStrings<'a>>,
1129        >,
1130        ::core::option::Option<jacquard_common::CowStr<'a>>,
1131    ),
1132    _phantom: ::core::marker::PhantomData<&'a ()>,
1133}
1134
1135impl<'a> LabelValueDefinition<'a> {
1136    /// Create a new builder for this type
1137    pub fn new() -> LabelValueDefinitionBuilder<
1138        'a,
1139        label_value_definition_state::Empty,
1140    > {
1141        LabelValueDefinitionBuilder::new()
1142    }
1143}
1144
1145impl<'a> LabelValueDefinitionBuilder<'a, label_value_definition_state::Empty> {
1146    /// Create a new builder with all fields unset
1147    pub fn new() -> Self {
1148        LabelValueDefinitionBuilder {
1149            _phantom_state: ::core::marker::PhantomData,
1150            __unsafe_private_named: (None, None, None, None, None, None),
1151            _phantom: ::core::marker::PhantomData,
1152        }
1153    }
1154}
1155
1156impl<'a, S: label_value_definition_state::State> LabelValueDefinitionBuilder<'a, S> {
1157    /// Set the `adultOnly` field (optional)
1158    pub fn adult_only(mut self, value: impl Into<Option<bool>>) -> Self {
1159        self.__unsafe_private_named.0 = value.into();
1160        self
1161    }
1162    /// Set the `adultOnly` field to an Option value (optional)
1163    pub fn maybe_adult_only(mut self, value: Option<bool>) -> Self {
1164        self.__unsafe_private_named.0 = value;
1165        self
1166    }
1167}
1168
1169impl<'a, S> LabelValueDefinitionBuilder<'a, S>
1170where
1171    S: label_value_definition_state::State,
1172    S::Blurs: label_value_definition_state::IsUnset,
1173{
1174    /// Set the `blurs` field (required)
1175    pub fn blurs(
1176        mut self,
1177        value: impl Into<jacquard_common::CowStr<'a>>,
1178    ) -> LabelValueDefinitionBuilder<'a, label_value_definition_state::SetBlurs<S>> {
1179        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1180        LabelValueDefinitionBuilder {
1181            _phantom_state: ::core::marker::PhantomData,
1182            __unsafe_private_named: self.__unsafe_private_named,
1183            _phantom: ::core::marker::PhantomData,
1184        }
1185    }
1186}
1187
1188impl<'a, S: label_value_definition_state::State> LabelValueDefinitionBuilder<'a, S> {
1189    /// Set the `defaultSetting` field (optional)
1190    pub fn default_setting(
1191        mut self,
1192        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
1193    ) -> Self {
1194        self.__unsafe_private_named.2 = value.into();
1195        self
1196    }
1197    /// Set the `defaultSetting` field to an Option value (optional)
1198    pub fn maybe_default_setting(
1199        mut self,
1200        value: Option<jacquard_common::CowStr<'a>>,
1201    ) -> Self {
1202        self.__unsafe_private_named.2 = value;
1203        self
1204    }
1205}
1206
1207impl<'a, S> LabelValueDefinitionBuilder<'a, S>
1208where
1209    S: label_value_definition_state::State,
1210    S::Identifier: label_value_definition_state::IsUnset,
1211{
1212    /// Set the `identifier` field (required)
1213    pub fn identifier(
1214        mut self,
1215        value: impl Into<jacquard_common::CowStr<'a>>,
1216    ) -> LabelValueDefinitionBuilder<
1217        'a,
1218        label_value_definition_state::SetIdentifier<S>,
1219    > {
1220        self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
1221        LabelValueDefinitionBuilder {
1222            _phantom_state: ::core::marker::PhantomData,
1223            __unsafe_private_named: self.__unsafe_private_named,
1224            _phantom: ::core::marker::PhantomData,
1225        }
1226    }
1227}
1228
1229impl<'a, S> LabelValueDefinitionBuilder<'a, S>
1230where
1231    S: label_value_definition_state::State,
1232    S::Locales: label_value_definition_state::IsUnset,
1233{
1234    /// Set the `locales` field (required)
1235    pub fn locales(
1236        mut self,
1237        value: impl Into<Vec<crate::com_atproto::label::LabelValueDefinitionStrings<'a>>>,
1238    ) -> LabelValueDefinitionBuilder<'a, label_value_definition_state::SetLocales<S>> {
1239        self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
1240        LabelValueDefinitionBuilder {
1241            _phantom_state: ::core::marker::PhantomData,
1242            __unsafe_private_named: self.__unsafe_private_named,
1243            _phantom: ::core::marker::PhantomData,
1244        }
1245    }
1246}
1247
1248impl<'a, S> LabelValueDefinitionBuilder<'a, S>
1249where
1250    S: label_value_definition_state::State,
1251    S::Severity: label_value_definition_state::IsUnset,
1252{
1253    /// Set the `severity` field (required)
1254    pub fn severity(
1255        mut self,
1256        value: impl Into<jacquard_common::CowStr<'a>>,
1257    ) -> LabelValueDefinitionBuilder<'a, label_value_definition_state::SetSeverity<S>> {
1258        self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
1259        LabelValueDefinitionBuilder {
1260            _phantom_state: ::core::marker::PhantomData,
1261            __unsafe_private_named: self.__unsafe_private_named,
1262            _phantom: ::core::marker::PhantomData,
1263        }
1264    }
1265}
1266
1267impl<'a, S> LabelValueDefinitionBuilder<'a, S>
1268where
1269    S: label_value_definition_state::State,
1270    S::Identifier: label_value_definition_state::IsSet,
1271    S::Severity: label_value_definition_state::IsSet,
1272    S::Blurs: label_value_definition_state::IsSet,
1273    S::Locales: label_value_definition_state::IsSet,
1274{
1275    /// Build the final struct
1276    pub fn build(self) -> LabelValueDefinition<'a> {
1277        LabelValueDefinition {
1278            adult_only: self.__unsafe_private_named.0,
1279            blurs: self.__unsafe_private_named.1.unwrap(),
1280            default_setting: self.__unsafe_private_named.2,
1281            identifier: self.__unsafe_private_named.3.unwrap(),
1282            locales: self.__unsafe_private_named.4.unwrap(),
1283            severity: self.__unsafe_private_named.5.unwrap(),
1284            extra_data: Default::default(),
1285        }
1286    }
1287    /// Build the final struct with custom extra_data
1288    pub fn build_with_data(
1289        self,
1290        extra_data: std::collections::BTreeMap<
1291            jacquard_common::smol_str::SmolStr,
1292            jacquard_common::types::value::Data<'a>,
1293        >,
1294    ) -> LabelValueDefinition<'a> {
1295        LabelValueDefinition {
1296            adult_only: self.__unsafe_private_named.0,
1297            blurs: self.__unsafe_private_named.1.unwrap(),
1298            default_setting: self.__unsafe_private_named.2,
1299            identifier: self.__unsafe_private_named.3.unwrap(),
1300            locales: self.__unsafe_private_named.4.unwrap(),
1301            severity: self.__unsafe_private_named.5.unwrap(),
1302            extra_data: Some(extra_data),
1303        }
1304    }
1305}
1306
1307impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelValueDefinition<'a> {
1308    fn nsid() -> &'static str {
1309        "com.atproto.label.defs"
1310    }
1311    fn def_name() -> &'static str {
1312        "labelValueDefinition"
1313    }
1314    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1315        lexicon_doc_com_atproto_label_defs()
1316    }
1317    fn validate(
1318        &self,
1319    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1320        {
1321            let value = &self.identifier;
1322            #[allow(unused_comparisons)]
1323            if <str>::len(value.as_ref()) > 100usize {
1324                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1325                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1326                        "identifier",
1327                    ),
1328                    max: 100usize,
1329                    actual: <str>::len(value.as_ref()),
1330                });
1331            }
1332        }
1333        {
1334            let value = &self.identifier;
1335            {
1336                let count = ::unicode_segmentation::UnicodeSegmentation::graphemes(
1337                        value.as_ref(),
1338                        true,
1339                    )
1340                    .count();
1341                if count > 100usize {
1342                    return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
1343                        path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1344                            "identifier",
1345                        ),
1346                        max: 100usize,
1347                        actual: count,
1348                    });
1349                }
1350            }
1351        }
1352        Ok(())
1353    }
1354}
1355
1356/// Strings which describe the label in the UI, localized into a specific language.
1357#[jacquard_derive::lexicon]
1358#[derive(
1359    serde::Serialize,
1360    serde::Deserialize,
1361    Debug,
1362    Clone,
1363    PartialEq,
1364    Eq,
1365    jacquard_derive::IntoStatic
1366)]
1367#[serde(rename_all = "camelCase")]
1368pub struct LabelValueDefinitionStrings<'a> {
1369    /// A longer description of what the label means and why it might be applied.
1370    #[serde(borrow)]
1371    pub description: jacquard_common::CowStr<'a>,
1372    /// The code of the language these strings are written in.
1373    pub lang: jacquard_common::types::string::Language,
1374    /// A short human-readable name for the label.
1375    #[serde(borrow)]
1376    pub name: jacquard_common::CowStr<'a>,
1377}
1378
1379pub mod label_value_definition_strings_state {
1380
1381    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1382    #[allow(unused)]
1383    use ::core::marker::PhantomData;
1384    mod sealed {
1385        pub trait Sealed {}
1386    }
1387    /// State trait tracking which required fields have been set
1388    pub trait State: sealed::Sealed {
1389        type Lang;
1390        type Name;
1391        type Description;
1392    }
1393    /// Empty state - all required fields are unset
1394    pub struct Empty(());
1395    impl sealed::Sealed for Empty {}
1396    impl State for Empty {
1397        type Lang = Unset;
1398        type Name = Unset;
1399        type Description = Unset;
1400    }
1401    ///State transition - sets the `lang` field to Set
1402    pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>);
1403    impl<S: State> sealed::Sealed for SetLang<S> {}
1404    impl<S: State> State for SetLang<S> {
1405        type Lang = Set<members::lang>;
1406        type Name = S::Name;
1407        type Description = S::Description;
1408    }
1409    ///State transition - sets the `name` field to Set
1410    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
1411    impl<S: State> sealed::Sealed for SetName<S> {}
1412    impl<S: State> State for SetName<S> {
1413        type Lang = S::Lang;
1414        type Name = Set<members::name>;
1415        type Description = S::Description;
1416    }
1417    ///State transition - sets the `description` field to Set
1418    pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>);
1419    impl<S: State> sealed::Sealed for SetDescription<S> {}
1420    impl<S: State> State for SetDescription<S> {
1421        type Lang = S::Lang;
1422        type Name = S::Name;
1423        type Description = Set<members::description>;
1424    }
1425    /// Marker types for field names
1426    #[allow(non_camel_case_types)]
1427    pub mod members {
1428        ///Marker type for the `lang` field
1429        pub struct lang(());
1430        ///Marker type for the `name` field
1431        pub struct name(());
1432        ///Marker type for the `description` field
1433        pub struct description(());
1434    }
1435}
1436
1437/// Builder for constructing an instance of this type
1438pub struct LabelValueDefinitionStringsBuilder<
1439    'a,
1440    S: label_value_definition_strings_state::State,
1441> {
1442    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1443    __unsafe_private_named: (
1444        ::core::option::Option<jacquard_common::CowStr<'a>>,
1445        ::core::option::Option<jacquard_common::types::string::Language>,
1446        ::core::option::Option<jacquard_common::CowStr<'a>>,
1447    ),
1448    _phantom: ::core::marker::PhantomData<&'a ()>,
1449}
1450
1451impl<'a> LabelValueDefinitionStrings<'a> {
1452    /// Create a new builder for this type
1453    pub fn new() -> LabelValueDefinitionStringsBuilder<
1454        'a,
1455        label_value_definition_strings_state::Empty,
1456    > {
1457        LabelValueDefinitionStringsBuilder::new()
1458    }
1459}
1460
1461impl<
1462    'a,
1463> LabelValueDefinitionStringsBuilder<'a, label_value_definition_strings_state::Empty> {
1464    /// Create a new builder with all fields unset
1465    pub fn new() -> Self {
1466        LabelValueDefinitionStringsBuilder {
1467            _phantom_state: ::core::marker::PhantomData,
1468            __unsafe_private_named: (None, None, None),
1469            _phantom: ::core::marker::PhantomData,
1470        }
1471    }
1472}
1473
1474impl<'a, S> LabelValueDefinitionStringsBuilder<'a, S>
1475where
1476    S: label_value_definition_strings_state::State,
1477    S::Description: label_value_definition_strings_state::IsUnset,
1478{
1479    /// Set the `description` field (required)
1480    pub fn description(
1481        mut self,
1482        value: impl Into<jacquard_common::CowStr<'a>>,
1483    ) -> LabelValueDefinitionStringsBuilder<
1484        'a,
1485        label_value_definition_strings_state::SetDescription<S>,
1486    > {
1487        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1488        LabelValueDefinitionStringsBuilder {
1489            _phantom_state: ::core::marker::PhantomData,
1490            __unsafe_private_named: self.__unsafe_private_named,
1491            _phantom: ::core::marker::PhantomData,
1492        }
1493    }
1494}
1495
1496impl<'a, S> LabelValueDefinitionStringsBuilder<'a, S>
1497where
1498    S: label_value_definition_strings_state::State,
1499    S::Lang: label_value_definition_strings_state::IsUnset,
1500{
1501    /// Set the `lang` field (required)
1502    pub fn lang(
1503        mut self,
1504        value: impl Into<jacquard_common::types::string::Language>,
1505    ) -> LabelValueDefinitionStringsBuilder<
1506        'a,
1507        label_value_definition_strings_state::SetLang<S>,
1508    > {
1509        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1510        LabelValueDefinitionStringsBuilder {
1511            _phantom_state: ::core::marker::PhantomData,
1512            __unsafe_private_named: self.__unsafe_private_named,
1513            _phantom: ::core::marker::PhantomData,
1514        }
1515    }
1516}
1517
1518impl<'a, S> LabelValueDefinitionStringsBuilder<'a, S>
1519where
1520    S: label_value_definition_strings_state::State,
1521    S::Name: label_value_definition_strings_state::IsUnset,
1522{
1523    /// Set the `name` field (required)
1524    pub fn name(
1525        mut self,
1526        value: impl Into<jacquard_common::CowStr<'a>>,
1527    ) -> LabelValueDefinitionStringsBuilder<
1528        'a,
1529        label_value_definition_strings_state::SetName<S>,
1530    > {
1531        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
1532        LabelValueDefinitionStringsBuilder {
1533            _phantom_state: ::core::marker::PhantomData,
1534            __unsafe_private_named: self.__unsafe_private_named,
1535            _phantom: ::core::marker::PhantomData,
1536        }
1537    }
1538}
1539
1540impl<'a, S> LabelValueDefinitionStringsBuilder<'a, S>
1541where
1542    S: label_value_definition_strings_state::State,
1543    S::Lang: label_value_definition_strings_state::IsSet,
1544    S::Name: label_value_definition_strings_state::IsSet,
1545    S::Description: label_value_definition_strings_state::IsSet,
1546{
1547    /// Build the final struct
1548    pub fn build(self) -> LabelValueDefinitionStrings<'a> {
1549        LabelValueDefinitionStrings {
1550            description: self.__unsafe_private_named.0.unwrap(),
1551            lang: self.__unsafe_private_named.1.unwrap(),
1552            name: self.__unsafe_private_named.2.unwrap(),
1553            extra_data: Default::default(),
1554        }
1555    }
1556    /// Build the final struct with custom extra_data
1557    pub fn build_with_data(
1558        self,
1559        extra_data: std::collections::BTreeMap<
1560            jacquard_common::smol_str::SmolStr,
1561            jacquard_common::types::value::Data<'a>,
1562        >,
1563    ) -> LabelValueDefinitionStrings<'a> {
1564        LabelValueDefinitionStrings {
1565            description: self.__unsafe_private_named.0.unwrap(),
1566            lang: self.__unsafe_private_named.1.unwrap(),
1567            name: self.__unsafe_private_named.2.unwrap(),
1568            extra_data: Some(extra_data),
1569        }
1570    }
1571}
1572
1573impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelValueDefinitionStrings<'a> {
1574    fn nsid() -> &'static str {
1575        "com.atproto.label.defs"
1576    }
1577    fn def_name() -> &'static str {
1578        "labelValueDefinitionStrings"
1579    }
1580    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1581        lexicon_doc_com_atproto_label_defs()
1582    }
1583    fn validate(
1584        &self,
1585    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1586        {
1587            let value = &self.description;
1588            #[allow(unused_comparisons)]
1589            if <str>::len(value.as_ref()) > 100000usize {
1590                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1591                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1592                        "description",
1593                    ),
1594                    max: 100000usize,
1595                    actual: <str>::len(value.as_ref()),
1596                });
1597            }
1598        }
1599        {
1600            let value = &self.description;
1601            {
1602                let count = ::unicode_segmentation::UnicodeSegmentation::graphemes(
1603                        value.as_ref(),
1604                        true,
1605                    )
1606                    .count();
1607                if count > 10000usize {
1608                    return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
1609                        path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1610                            "description",
1611                        ),
1612                        max: 10000usize,
1613                        actual: count,
1614                    });
1615                }
1616            }
1617        }
1618        {
1619            let value = &self.name;
1620            #[allow(unused_comparisons)]
1621            if <str>::len(value.as_ref()) > 640usize {
1622                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1623                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1624                        "name",
1625                    ),
1626                    max: 640usize,
1627                    actual: <str>::len(value.as_ref()),
1628                });
1629            }
1630        }
1631        {
1632            let value = &self.name;
1633            {
1634                let count = ::unicode_segmentation::UnicodeSegmentation::graphemes(
1635                        value.as_ref(),
1636                        true,
1637                    )
1638                    .count();
1639                if count > 64usize {
1640                    return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
1641                        path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1642                            "name",
1643                        ),
1644                        max: 64usize,
1645                        actual: count,
1646                    });
1647                }
1648            }
1649        }
1650        Ok(())
1651    }
1652}
1653
1654/// Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.
1655#[jacquard_derive::lexicon]
1656#[derive(
1657    serde::Serialize,
1658    serde::Deserialize,
1659    Debug,
1660    Clone,
1661    PartialEq,
1662    Eq,
1663    jacquard_derive::IntoStatic,
1664    Default
1665)]
1666#[serde(rename_all = "camelCase")]
1667pub struct SelfLabel<'a> {
1668    /// The short string name of the value or type of this label.
1669    #[serde(borrow)]
1670    pub val: jacquard_common::CowStr<'a>,
1671}
1672
1673impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SelfLabel<'a> {
1674    fn nsid() -> &'static str {
1675        "com.atproto.label.defs"
1676    }
1677    fn def_name() -> &'static str {
1678        "selfLabel"
1679    }
1680    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1681        lexicon_doc_com_atproto_label_defs()
1682    }
1683    fn validate(
1684        &self,
1685    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1686        {
1687            let value = &self.val;
1688            #[allow(unused_comparisons)]
1689            if <str>::len(value.as_ref()) > 128usize {
1690                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1691                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1692                        "val",
1693                    ),
1694                    max: 128usize,
1695                    actual: <str>::len(value.as_ref()),
1696                });
1697            }
1698        }
1699        Ok(())
1700    }
1701}
1702
1703/// Metadata tags on an atproto record, published by the author within the record.
1704#[jacquard_derive::lexicon]
1705#[derive(
1706    serde::Serialize,
1707    serde::Deserialize,
1708    Debug,
1709    Clone,
1710    PartialEq,
1711    Eq,
1712    jacquard_derive::IntoStatic
1713)]
1714#[serde(rename_all = "camelCase")]
1715pub struct SelfLabels<'a> {
1716    #[serde(borrow)]
1717    pub values: Vec<crate::com_atproto::label::SelfLabel<'a>>,
1718}
1719
1720pub mod self_labels_state {
1721
1722    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1723    #[allow(unused)]
1724    use ::core::marker::PhantomData;
1725    mod sealed {
1726        pub trait Sealed {}
1727    }
1728    /// State trait tracking which required fields have been set
1729    pub trait State: sealed::Sealed {
1730        type Values;
1731    }
1732    /// Empty state - all required fields are unset
1733    pub struct Empty(());
1734    impl sealed::Sealed for Empty {}
1735    impl State for Empty {
1736        type Values = Unset;
1737    }
1738    ///State transition - sets the `values` field to Set
1739    pub struct SetValues<S: State = Empty>(PhantomData<fn() -> S>);
1740    impl<S: State> sealed::Sealed for SetValues<S> {}
1741    impl<S: State> State for SetValues<S> {
1742        type Values = Set<members::values>;
1743    }
1744    /// Marker types for field names
1745    #[allow(non_camel_case_types)]
1746    pub mod members {
1747        ///Marker type for the `values` field
1748        pub struct values(());
1749    }
1750}
1751
1752/// Builder for constructing an instance of this type
1753pub struct SelfLabelsBuilder<'a, S: self_labels_state::State> {
1754    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1755    __unsafe_private_named: (
1756        ::core::option::Option<Vec<crate::com_atproto::label::SelfLabel<'a>>>,
1757    ),
1758    _phantom: ::core::marker::PhantomData<&'a ()>,
1759}
1760
1761impl<'a> SelfLabels<'a> {
1762    /// Create a new builder for this type
1763    pub fn new() -> SelfLabelsBuilder<'a, self_labels_state::Empty> {
1764        SelfLabelsBuilder::new()
1765    }
1766}
1767
1768impl<'a> SelfLabelsBuilder<'a, self_labels_state::Empty> {
1769    /// Create a new builder with all fields unset
1770    pub fn new() -> Self {
1771        SelfLabelsBuilder {
1772            _phantom_state: ::core::marker::PhantomData,
1773            __unsafe_private_named: (None,),
1774            _phantom: ::core::marker::PhantomData,
1775        }
1776    }
1777}
1778
1779impl<'a, S> SelfLabelsBuilder<'a, S>
1780where
1781    S: self_labels_state::State,
1782    S::Values: self_labels_state::IsUnset,
1783{
1784    /// Set the `values` field (required)
1785    pub fn values(
1786        mut self,
1787        value: impl Into<Vec<crate::com_atproto::label::SelfLabel<'a>>>,
1788    ) -> SelfLabelsBuilder<'a, self_labels_state::SetValues<S>> {
1789        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1790        SelfLabelsBuilder {
1791            _phantom_state: ::core::marker::PhantomData,
1792            __unsafe_private_named: self.__unsafe_private_named,
1793            _phantom: ::core::marker::PhantomData,
1794        }
1795    }
1796}
1797
1798impl<'a, S> SelfLabelsBuilder<'a, S>
1799where
1800    S: self_labels_state::State,
1801    S::Values: self_labels_state::IsSet,
1802{
1803    /// Build the final struct
1804    pub fn build(self) -> SelfLabels<'a> {
1805        SelfLabels {
1806            values: self.__unsafe_private_named.0.unwrap(),
1807            extra_data: Default::default(),
1808        }
1809    }
1810    /// Build the final struct with custom extra_data
1811    pub fn build_with_data(
1812        self,
1813        extra_data: std::collections::BTreeMap<
1814            jacquard_common::smol_str::SmolStr,
1815            jacquard_common::types::value::Data<'a>,
1816        >,
1817    ) -> SelfLabels<'a> {
1818        SelfLabels {
1819            values: self.__unsafe_private_named.0.unwrap(),
1820            extra_data: Some(extra_data),
1821        }
1822    }
1823}
1824
1825impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SelfLabels<'a> {
1826    fn nsid() -> &'static str {
1827        "com.atproto.label.defs"
1828    }
1829    fn def_name() -> &'static str {
1830        "selfLabels"
1831    }
1832    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1833        lexicon_doc_com_atproto_label_defs()
1834    }
1835    fn validate(
1836        &self,
1837    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1838        {
1839            let value = &self.values;
1840            #[allow(unused_comparisons)]
1841            if value.len() > 10usize {
1842                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
1843                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
1844                        "values",
1845                    ),
1846                    max: 10usize,
1847                    actual: value.len(),
1848                });
1849            }
1850        }
1851        Ok(())
1852    }
1853}