jacquard_api/com_atproto/temp/
check_handle_availability.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.temp.checkHandleAvailability
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9    serde::Serialize,
10    serde::Deserialize,
11    Debug,
12    Clone,
13    PartialEq,
14    Eq,
15    jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct CheckHandleAvailability<'a> {
19    #[serde(skip_serializing_if = "std::option::Option::is_none")]
20    pub birth_date: std::option::Option<jacquard_common::types::string::Datetime>,
21    #[serde(skip_serializing_if = "std::option::Option::is_none")]
22    #[serde(borrow)]
23    pub email: std::option::Option<jacquard_common::CowStr<'a>>,
24    #[serde(borrow)]
25    pub handle: jacquard_common::types::string::Handle<'a>,
26}
27
28pub mod check_handle_availability_state {
29
30    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
31    #[allow(unused)]
32    use ::core::marker::PhantomData;
33    mod sealed {
34        pub trait Sealed {}
35    }
36    /// State trait tracking which required fields have been set
37    pub trait State: sealed::Sealed {
38        type Handle;
39    }
40    /// Empty state - all required fields are unset
41    pub struct Empty(());
42    impl sealed::Sealed for Empty {}
43    impl State for Empty {
44        type Handle = Unset;
45    }
46    ///State transition - sets the `handle` field to Set
47    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
48    impl<S: State> sealed::Sealed for SetHandle<S> {}
49    impl<S: State> State for SetHandle<S> {
50        type Handle = Set<members::handle>;
51    }
52    /// Marker types for field names
53    #[allow(non_camel_case_types)]
54    pub mod members {
55        ///Marker type for the `handle` field
56        pub struct handle(());
57    }
58}
59
60/// Builder for constructing an instance of this type
61pub struct CheckHandleAvailabilityBuilder<
62    'a,
63    S: check_handle_availability_state::State,
64> {
65    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
66    __unsafe_private_named: (
67        ::core::option::Option<jacquard_common::types::string::Datetime>,
68        ::core::option::Option<jacquard_common::CowStr<'a>>,
69        ::core::option::Option<jacquard_common::types::string::Handle<'a>>,
70    ),
71    _phantom: ::core::marker::PhantomData<&'a ()>,
72}
73
74impl<'a> CheckHandleAvailability<'a> {
75    /// Create a new builder for this type
76    pub fn new() -> CheckHandleAvailabilityBuilder<
77        'a,
78        check_handle_availability_state::Empty,
79    > {
80        CheckHandleAvailabilityBuilder::new()
81    }
82}
83
84impl<'a> CheckHandleAvailabilityBuilder<'a, check_handle_availability_state::Empty> {
85    /// Create a new builder with all fields unset
86    pub fn new() -> Self {
87        CheckHandleAvailabilityBuilder {
88            _phantom_state: ::core::marker::PhantomData,
89            __unsafe_private_named: (None, None, None),
90            _phantom: ::core::marker::PhantomData,
91        }
92    }
93}
94
95impl<
96    'a,
97    S: check_handle_availability_state::State,
98> CheckHandleAvailabilityBuilder<'a, S> {
99    /// Set the `birthDate` field (optional)
100    pub fn birth_date(
101        mut self,
102        value: impl Into<Option<jacquard_common::types::string::Datetime>>,
103    ) -> Self {
104        self.__unsafe_private_named.0 = value.into();
105        self
106    }
107    /// Set the `birthDate` field to an Option value (optional)
108    pub fn maybe_birth_date(
109        mut self,
110        value: Option<jacquard_common::types::string::Datetime>,
111    ) -> Self {
112        self.__unsafe_private_named.0 = value;
113        self
114    }
115}
116
117impl<
118    'a,
119    S: check_handle_availability_state::State,
120> CheckHandleAvailabilityBuilder<'a, S> {
121    /// Set the `email` field (optional)
122    pub fn email(
123        mut self,
124        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
125    ) -> Self {
126        self.__unsafe_private_named.1 = value.into();
127        self
128    }
129    /// Set the `email` field to an Option value (optional)
130    pub fn maybe_email(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
131        self.__unsafe_private_named.1 = value;
132        self
133    }
134}
135
136impl<'a, S> CheckHandleAvailabilityBuilder<'a, S>
137where
138    S: check_handle_availability_state::State,
139    S::Handle: check_handle_availability_state::IsUnset,
140{
141    /// Set the `handle` field (required)
142    pub fn handle(
143        mut self,
144        value: impl Into<jacquard_common::types::string::Handle<'a>>,
145    ) -> CheckHandleAvailabilityBuilder<
146        'a,
147        check_handle_availability_state::SetHandle<S>,
148    > {
149        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
150        CheckHandleAvailabilityBuilder {
151            _phantom_state: ::core::marker::PhantomData,
152            __unsafe_private_named: self.__unsafe_private_named,
153            _phantom: ::core::marker::PhantomData,
154        }
155    }
156}
157
158impl<'a, S> CheckHandleAvailabilityBuilder<'a, S>
159where
160    S: check_handle_availability_state::State,
161    S::Handle: check_handle_availability_state::IsSet,
162{
163    /// Build the final struct
164    pub fn build(self) -> CheckHandleAvailability<'a> {
165        CheckHandleAvailability {
166            birth_date: self.__unsafe_private_named.0,
167            email: self.__unsafe_private_named.1,
168            handle: self.__unsafe_private_named.2.unwrap(),
169        }
170    }
171}
172
173#[jacquard_derive::lexicon]
174#[derive(
175    serde::Serialize,
176    serde::Deserialize,
177    Debug,
178    Clone,
179    PartialEq,
180    Eq,
181    jacquard_derive::IntoStatic
182)]
183#[serde(rename_all = "camelCase")]
184pub struct CheckHandleAvailabilityOutput<'a> {
185    /// Echo of the input handle.
186    #[serde(borrow)]
187    pub handle: jacquard_common::types::string::Handle<'a>,
188    #[serde(borrow)]
189    pub result: CheckHandleAvailabilityOutputResult<'a>,
190}
191
192#[jacquard_derive::open_union]
193#[derive(
194    serde::Serialize,
195    serde::Deserialize,
196    Debug,
197    Clone,
198    PartialEq,
199    Eq,
200    jacquard_derive::IntoStatic
201)]
202#[serde(tag = "$type")]
203#[serde(bound(deserialize = "'de: 'a"))]
204pub enum CheckHandleAvailabilityOutputResult<'a> {
205    #[serde(rename = "com.atproto.temp.checkHandleAvailability#resultAvailable")]
206    ResultAvailable(
207        Box<crate::com_atproto::temp::check_handle_availability::ResultAvailable<'a>>,
208    ),
209    #[serde(rename = "com.atproto.temp.checkHandleAvailability#resultUnavailable")]
210    ResultUnavailable(
211        Box<crate::com_atproto::temp::check_handle_availability::ResultUnavailable<'a>>,
212    ),
213}
214
215#[jacquard_derive::open_union]
216#[derive(
217    serde::Serialize,
218    serde::Deserialize,
219    Debug,
220    Clone,
221    PartialEq,
222    Eq,
223    thiserror::Error,
224    miette::Diagnostic,
225    jacquard_derive::IntoStatic
226)]
227#[serde(tag = "error", content = "message")]
228#[serde(bound(deserialize = "'de: 'a"))]
229pub enum CheckHandleAvailabilityError<'a> {
230    /// An invalid email was provided.
231    #[serde(rename = "InvalidEmail")]
232    InvalidEmail(std::option::Option<String>),
233}
234
235impl std::fmt::Display for CheckHandleAvailabilityError<'_> {
236    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
237        match self {
238            Self::InvalidEmail(msg) => {
239                write!(f, "InvalidEmail")?;
240                if let Some(msg) = msg {
241                    write!(f, ": {}", msg)?;
242                }
243                Ok(())
244            }
245            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
246        }
247    }
248}
249
250/// Response type for
251///com.atproto.temp.checkHandleAvailability
252pub struct CheckHandleAvailabilityResponse;
253impl jacquard_common::xrpc::XrpcResp for CheckHandleAvailabilityResponse {
254    const NSID: &'static str = "com.atproto.temp.checkHandleAvailability";
255    const ENCODING: &'static str = "application/json";
256    type Output<'de> = CheckHandleAvailabilityOutput<'de>;
257    type Err<'de> = CheckHandleAvailabilityError<'de>;
258}
259
260impl<'a> jacquard_common::xrpc::XrpcRequest for CheckHandleAvailability<'a> {
261    const NSID: &'static str = "com.atproto.temp.checkHandleAvailability";
262    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
263    type Response = CheckHandleAvailabilityResponse;
264}
265
266/// Endpoint type for
267///com.atproto.temp.checkHandleAvailability
268pub struct CheckHandleAvailabilityRequest;
269impl jacquard_common::xrpc::XrpcEndpoint for CheckHandleAvailabilityRequest {
270    const PATH: &'static str = "/xrpc/com.atproto.temp.checkHandleAvailability";
271    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
272    type Request<'de> = CheckHandleAvailability<'de>;
273    type Response = CheckHandleAvailabilityResponse;
274}
275
276/// Indicates the provided handle is available.
277#[jacquard_derive::lexicon]
278#[derive(
279    serde::Serialize,
280    serde::Deserialize,
281    Debug,
282    Clone,
283    PartialEq,
284    Eq,
285    jacquard_derive::IntoStatic,
286    Default
287)]
288#[serde(rename_all = "camelCase")]
289pub struct ResultAvailable<'a> {}
290fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> ::jacquard_lexicon::lexicon::LexiconDoc<
291    'static,
292> {
293    ::jacquard_lexicon::lexicon::LexiconDoc {
294        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
295        id: ::jacquard_common::CowStr::new_static(
296            "com.atproto.temp.checkHandleAvailability",
297        ),
298        revision: None,
299        description: None,
300        defs: {
301            let mut map = ::std::collections::BTreeMap::new();
302            map.insert(
303                ::jacquard_common::smol_str::SmolStr::new_static("main"),
304                ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
305                    description: None,
306                    parameters: Some(
307                        ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
308                            description: None,
309                            required: Some(
310                                vec![
311                                    ::jacquard_common::smol_str::SmolStr::new_static("handle")
312                                ],
313                            ),
314                            properties: {
315                                #[allow(unused_mut)]
316                                let mut map = ::std::collections::BTreeMap::new();
317                                map.insert(
318                                    ::jacquard_common::smol_str::SmolStr::new_static(
319                                        "birthDate",
320                                    ),
321                                    ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
322                                        description: Some(
323                                            ::jacquard_common::CowStr::new_static(
324                                                "User-provided birth date. Might be used to build handle suggestions.",
325                                            ),
326                                        ),
327                                        format: Some(
328                                            ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
329                                        ),
330                                        default: None,
331                                        min_length: None,
332                                        max_length: None,
333                                        min_graphemes: None,
334                                        max_graphemes: None,
335                                        r#enum: None,
336                                        r#const: None,
337                                        known_values: None,
338                                    }),
339                                );
340                                map.insert(
341                                    ::jacquard_common::smol_str::SmolStr::new_static("email"),
342                                    ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
343                                        description: Some(
344                                            ::jacquard_common::CowStr::new_static(
345                                                "User-provided email. Might be used to build handle suggestions.",
346                                            ),
347                                        ),
348                                        format: None,
349                                        default: None,
350                                        min_length: None,
351                                        max_length: None,
352                                        min_graphemes: None,
353                                        max_graphemes: None,
354                                        r#enum: None,
355                                        r#const: None,
356                                        known_values: None,
357                                    }),
358                                );
359                                map.insert(
360                                    ::jacquard_common::smol_str::SmolStr::new_static("handle"),
361                                    ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
362                                        description: Some(
363                                            ::jacquard_common::CowStr::new_static(
364                                                "Tentative handle. Will be checked for availability or used to build handle suggestions.",
365                                            ),
366                                        ),
367                                        format: Some(
368                                            ::jacquard_lexicon::lexicon::LexStringFormat::Handle,
369                                        ),
370                                        default: None,
371                                        min_length: None,
372                                        max_length: None,
373                                        min_graphemes: None,
374                                        max_graphemes: None,
375                                        r#enum: None,
376                                        r#const: None,
377                                        known_values: None,
378                                    }),
379                                );
380                                map
381                            },
382                        }),
383                    ),
384                    output: None,
385                    errors: None,
386                }),
387            );
388            map.insert(
389                ::jacquard_common::smol_str::SmolStr::new_static("resultAvailable"),
390                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
391                    description: Some(
392                        ::jacquard_common::CowStr::new_static(
393                            "Indicates the provided handle is available.",
394                        ),
395                    ),
396                    required: None,
397                    nullable: None,
398                    properties: {
399                        #[allow(unused_mut)]
400                        let mut map = ::std::collections::BTreeMap::new();
401                        map
402                    },
403                }),
404            );
405            map.insert(
406                ::jacquard_common::smol_str::SmolStr::new_static("resultUnavailable"),
407                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
408                    description: Some(
409                        ::jacquard_common::CowStr::new_static(
410                            "Indicates the provided handle is unavailable and gives suggestions of available handles.",
411                        ),
412                    ),
413                    required: Some(
414                        vec![
415                            ::jacquard_common::smol_str::SmolStr::new_static("suggestions")
416                        ],
417                    ),
418                    nullable: None,
419                    properties: {
420                        #[allow(unused_mut)]
421                        let mut map = ::std::collections::BTreeMap::new();
422                        map.insert(
423                            ::jacquard_common::smol_str::SmolStr::new_static(
424                                "suggestions",
425                            ),
426                            ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
427                                description: Some(
428                                    ::jacquard_common::CowStr::new_static(
429                                        "List of suggested handles based on the provided inputs.",
430                                    ),
431                                ),
432                                items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
433                                    description: None,
434                                    r#ref: ::jacquard_common::CowStr::new_static("#suggestion"),
435                                }),
436                                min_length: None,
437                                max_length: None,
438                            }),
439                        );
440                        map
441                    },
442                }),
443            );
444            map.insert(
445                ::jacquard_common::smol_str::SmolStr::new_static("suggestion"),
446                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
447                    description: None,
448                    required: Some(
449                        vec![
450                            ::jacquard_common::smol_str::SmolStr::new_static("handle"),
451                            ::jacquard_common::smol_str::SmolStr::new_static("method")
452                        ],
453                    ),
454                    nullable: None,
455                    properties: {
456                        #[allow(unused_mut)]
457                        let mut map = ::std::collections::BTreeMap::new();
458                        map.insert(
459                            ::jacquard_common::smol_str::SmolStr::new_static("handle"),
460                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
461                                description: None,
462                                format: Some(
463                                    ::jacquard_lexicon::lexicon::LexStringFormat::Handle,
464                                ),
465                                default: None,
466                                min_length: None,
467                                max_length: None,
468                                min_graphemes: None,
469                                max_graphemes: None,
470                                r#enum: None,
471                                r#const: None,
472                                known_values: None,
473                            }),
474                        );
475                        map.insert(
476                            ::jacquard_common::smol_str::SmolStr::new_static("method"),
477                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
478                                description: Some(
479                                    ::jacquard_common::CowStr::new_static(
480                                        "Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics.",
481                                    ),
482                                ),
483                                format: None,
484                                default: None,
485                                min_length: None,
486                                max_length: None,
487                                min_graphemes: None,
488                                max_graphemes: None,
489                                r#enum: None,
490                                r#const: None,
491                                known_values: None,
492                            }),
493                        );
494                        map
495                    },
496                }),
497            );
498            map
499        },
500    }
501}
502
503impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ResultAvailable<'a> {
504    fn nsid() -> &'static str {
505        "com.atproto.temp.checkHandleAvailability"
506    }
507    fn def_name() -> &'static str {
508        "resultAvailable"
509    }
510    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
511        lexicon_doc_com_atproto_temp_checkHandleAvailability()
512    }
513    fn validate(
514        &self,
515    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
516        Ok(())
517    }
518}
519
520/// Indicates the provided handle is unavailable and gives suggestions of available handles.
521#[jacquard_derive::lexicon]
522#[derive(
523    serde::Serialize,
524    serde::Deserialize,
525    Debug,
526    Clone,
527    PartialEq,
528    Eq,
529    jacquard_derive::IntoStatic
530)]
531#[serde(rename_all = "camelCase")]
532pub struct ResultUnavailable<'a> {
533    /// List of suggested handles based on the provided inputs.
534    #[serde(borrow)]
535    pub suggestions: Vec<
536        crate::com_atproto::temp::check_handle_availability::Suggestion<'a>,
537    >,
538}
539
540pub mod result_unavailable_state {
541
542    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
543    #[allow(unused)]
544    use ::core::marker::PhantomData;
545    mod sealed {
546        pub trait Sealed {}
547    }
548    /// State trait tracking which required fields have been set
549    pub trait State: sealed::Sealed {
550        type Suggestions;
551    }
552    /// Empty state - all required fields are unset
553    pub struct Empty(());
554    impl sealed::Sealed for Empty {}
555    impl State for Empty {
556        type Suggestions = Unset;
557    }
558    ///State transition - sets the `suggestions` field to Set
559    pub struct SetSuggestions<S: State = Empty>(PhantomData<fn() -> S>);
560    impl<S: State> sealed::Sealed for SetSuggestions<S> {}
561    impl<S: State> State for SetSuggestions<S> {
562        type Suggestions = Set<members::suggestions>;
563    }
564    /// Marker types for field names
565    #[allow(non_camel_case_types)]
566    pub mod members {
567        ///Marker type for the `suggestions` field
568        pub struct suggestions(());
569    }
570}
571
572/// Builder for constructing an instance of this type
573pub struct ResultUnavailableBuilder<'a, S: result_unavailable_state::State> {
574    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
575    __unsafe_private_named: (
576        ::core::option::Option<
577            Vec<crate::com_atproto::temp::check_handle_availability::Suggestion<'a>>,
578        >,
579    ),
580    _phantom: ::core::marker::PhantomData<&'a ()>,
581}
582
583impl<'a> ResultUnavailable<'a> {
584    /// Create a new builder for this type
585    pub fn new() -> ResultUnavailableBuilder<'a, result_unavailable_state::Empty> {
586        ResultUnavailableBuilder::new()
587    }
588}
589
590impl<'a> ResultUnavailableBuilder<'a, result_unavailable_state::Empty> {
591    /// Create a new builder with all fields unset
592    pub fn new() -> Self {
593        ResultUnavailableBuilder {
594            _phantom_state: ::core::marker::PhantomData,
595            __unsafe_private_named: (None,),
596            _phantom: ::core::marker::PhantomData,
597        }
598    }
599}
600
601impl<'a, S> ResultUnavailableBuilder<'a, S>
602where
603    S: result_unavailable_state::State,
604    S::Suggestions: result_unavailable_state::IsUnset,
605{
606    /// Set the `suggestions` field (required)
607    pub fn suggestions(
608        mut self,
609        value: impl Into<
610            Vec<crate::com_atproto::temp::check_handle_availability::Suggestion<'a>>,
611        >,
612    ) -> ResultUnavailableBuilder<'a, result_unavailable_state::SetSuggestions<S>> {
613        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
614        ResultUnavailableBuilder {
615            _phantom_state: ::core::marker::PhantomData,
616            __unsafe_private_named: self.__unsafe_private_named,
617            _phantom: ::core::marker::PhantomData,
618        }
619    }
620}
621
622impl<'a, S> ResultUnavailableBuilder<'a, S>
623where
624    S: result_unavailable_state::State,
625    S::Suggestions: result_unavailable_state::IsSet,
626{
627    /// Build the final struct
628    pub fn build(self) -> ResultUnavailable<'a> {
629        ResultUnavailable {
630            suggestions: self.__unsafe_private_named.0.unwrap(),
631            extra_data: Default::default(),
632        }
633    }
634    /// Build the final struct with custom extra_data
635    pub fn build_with_data(
636        self,
637        extra_data: std::collections::BTreeMap<
638            jacquard_common::smol_str::SmolStr,
639            jacquard_common::types::value::Data<'a>,
640        >,
641    ) -> ResultUnavailable<'a> {
642        ResultUnavailable {
643            suggestions: self.__unsafe_private_named.0.unwrap(),
644            extra_data: Some(extra_data),
645        }
646    }
647}
648
649impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ResultUnavailable<'a> {
650    fn nsid() -> &'static str {
651        "com.atproto.temp.checkHandleAvailability"
652    }
653    fn def_name() -> &'static str {
654        "resultUnavailable"
655    }
656    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
657        lexicon_doc_com_atproto_temp_checkHandleAvailability()
658    }
659    fn validate(
660        &self,
661    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
662        Ok(())
663    }
664}
665
666#[jacquard_derive::lexicon]
667#[derive(
668    serde::Serialize,
669    serde::Deserialize,
670    Debug,
671    Clone,
672    PartialEq,
673    Eq,
674    jacquard_derive::IntoStatic
675)]
676#[serde(rename_all = "camelCase")]
677pub struct Suggestion<'a> {
678    #[serde(borrow)]
679    pub handle: jacquard_common::types::string::Handle<'a>,
680    /// Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics.
681    #[serde(borrow)]
682    pub method: jacquard_common::CowStr<'a>,
683}
684
685pub mod suggestion_state {
686
687    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
688    #[allow(unused)]
689    use ::core::marker::PhantomData;
690    mod sealed {
691        pub trait Sealed {}
692    }
693    /// State trait tracking which required fields have been set
694    pub trait State: sealed::Sealed {
695        type Handle;
696        type Method;
697    }
698    /// Empty state - all required fields are unset
699    pub struct Empty(());
700    impl sealed::Sealed for Empty {}
701    impl State for Empty {
702        type Handle = Unset;
703        type Method = Unset;
704    }
705    ///State transition - sets the `handle` field to Set
706    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
707    impl<S: State> sealed::Sealed for SetHandle<S> {}
708    impl<S: State> State for SetHandle<S> {
709        type Handle = Set<members::handle>;
710        type Method = S::Method;
711    }
712    ///State transition - sets the `method` field to Set
713    pub struct SetMethod<S: State = Empty>(PhantomData<fn() -> S>);
714    impl<S: State> sealed::Sealed for SetMethod<S> {}
715    impl<S: State> State for SetMethod<S> {
716        type Handle = S::Handle;
717        type Method = Set<members::method>;
718    }
719    /// Marker types for field names
720    #[allow(non_camel_case_types)]
721    pub mod members {
722        ///Marker type for the `handle` field
723        pub struct handle(());
724        ///Marker type for the `method` field
725        pub struct method(());
726    }
727}
728
729/// Builder for constructing an instance of this type
730pub struct SuggestionBuilder<'a, S: suggestion_state::State> {
731    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
732    __unsafe_private_named: (
733        ::core::option::Option<jacquard_common::types::string::Handle<'a>>,
734        ::core::option::Option<jacquard_common::CowStr<'a>>,
735    ),
736    _phantom: ::core::marker::PhantomData<&'a ()>,
737}
738
739impl<'a> Suggestion<'a> {
740    /// Create a new builder for this type
741    pub fn new() -> SuggestionBuilder<'a, suggestion_state::Empty> {
742        SuggestionBuilder::new()
743    }
744}
745
746impl<'a> SuggestionBuilder<'a, suggestion_state::Empty> {
747    /// Create a new builder with all fields unset
748    pub fn new() -> Self {
749        SuggestionBuilder {
750            _phantom_state: ::core::marker::PhantomData,
751            __unsafe_private_named: (None, None),
752            _phantom: ::core::marker::PhantomData,
753        }
754    }
755}
756
757impl<'a, S> SuggestionBuilder<'a, S>
758where
759    S: suggestion_state::State,
760    S::Handle: suggestion_state::IsUnset,
761{
762    /// Set the `handle` field (required)
763    pub fn handle(
764        mut self,
765        value: impl Into<jacquard_common::types::string::Handle<'a>>,
766    ) -> SuggestionBuilder<'a, suggestion_state::SetHandle<S>> {
767        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
768        SuggestionBuilder {
769            _phantom_state: ::core::marker::PhantomData,
770            __unsafe_private_named: self.__unsafe_private_named,
771            _phantom: ::core::marker::PhantomData,
772        }
773    }
774}
775
776impl<'a, S> SuggestionBuilder<'a, S>
777where
778    S: suggestion_state::State,
779    S::Method: suggestion_state::IsUnset,
780{
781    /// Set the `method` field (required)
782    pub fn method(
783        mut self,
784        value: impl Into<jacquard_common::CowStr<'a>>,
785    ) -> SuggestionBuilder<'a, suggestion_state::SetMethod<S>> {
786        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
787        SuggestionBuilder {
788            _phantom_state: ::core::marker::PhantomData,
789            __unsafe_private_named: self.__unsafe_private_named,
790            _phantom: ::core::marker::PhantomData,
791        }
792    }
793}
794
795impl<'a, S> SuggestionBuilder<'a, S>
796where
797    S: suggestion_state::State,
798    S::Handle: suggestion_state::IsSet,
799    S::Method: suggestion_state::IsSet,
800{
801    /// Build the final struct
802    pub fn build(self) -> Suggestion<'a> {
803        Suggestion {
804            handle: self.__unsafe_private_named.0.unwrap(),
805            method: self.__unsafe_private_named.1.unwrap(),
806            extra_data: Default::default(),
807        }
808    }
809    /// Build the final struct with custom extra_data
810    pub fn build_with_data(
811        self,
812        extra_data: std::collections::BTreeMap<
813            jacquard_common::smol_str::SmolStr,
814            jacquard_common::types::value::Data<'a>,
815        >,
816    ) -> Suggestion<'a> {
817        Suggestion {
818            handle: self.__unsafe_private_named.0.unwrap(),
819            method: self.__unsafe_private_named.1.unwrap(),
820            extra_data: Some(extra_data),
821        }
822    }
823}
824
825impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Suggestion<'a> {
826    fn nsid() -> &'static str {
827        "com.atproto.temp.checkHandleAvailability"
828    }
829    fn def_name() -> &'static str {
830        "suggestion"
831    }
832    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
833        lexicon_doc_com_atproto_temp_checkHandleAvailability()
834    }
835    fn validate(
836        &self,
837    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
838        Ok(())
839    }
840}