Skip to main content

jacquard_api/games_gamesgamesgamesgames/
get_contribution.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: games.gamesgamesgamesgames.getContribution
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::deps::smol_str::SmolStr;
18use jacquard_common::types::string::{AtUri, Datetime, Did};
19use jacquard_common::types::value::Data;
20use jacquard_derive::IntoStatic;
21use jacquard_lexicon::lexicon::LexiconDoc;
22use jacquard_lexicon::schema::LexiconSchema;
23
24use crate::games_gamesgamesgamesgames::get_contribution;
25#[allow(unused_imports)]
26use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
27use serde::{Deserialize, Serialize};
28
29#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
30#[serde(
31    rename_all = "camelCase",
32    bound(deserialize = "S: Deserialize<'de> + BosStr")
33)]
34pub struct ContributionView<S: BosStr = DefaultStr> {
35    pub changes: Data<S>,
36    pub cid: S,
37    pub contribution_type: ContributionViewContributionType<S>,
38    pub contributor_did: Did<S>,
39    pub created_at: Datetime,
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub message: Option<S>,
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub patch: Option<get_contribution::PatchView<S>>,
44    #[serde(skip_serializing_if = "Option::is_none")]
45    pub review: Option<get_contribution::ReviewView<S>>,
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub subject: Option<AtUri<S>>,
48    ///Resolved name of the subject entity for display.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub subject_name: Option<S>,
51    pub uri: AtUri<S>,
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub verification: Option<get_contribution::VerificationView<S>>,
54    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
55    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
56}
57
58#[derive(Debug, Clone, PartialEq, Eq, Hash)]
59pub enum ContributionViewContributionType<S: BosStr = DefaultStr> {
60    Correction,
61    Addition,
62    NewGame,
63    Other(S),
64}
65
66impl<S: BosStr> ContributionViewContributionType<S> {
67    pub fn as_str(&self) -> &str {
68        match self {
69            Self::Correction => "correction",
70            Self::Addition => "addition",
71            Self::NewGame => "newGame",
72            Self::Other(s) => s.as_ref(),
73        }
74    }
75    /// Construct from a string-like value, matching known values.
76    pub fn from_value(s: S) -> Self {
77        match s.as_ref() {
78            "correction" => Self::Correction,
79            "addition" => Self::Addition,
80            "newGame" => Self::NewGame,
81            _ => Self::Other(s),
82        }
83    }
84}
85
86impl<S: BosStr> core::fmt::Display for ContributionViewContributionType<S> {
87    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
88        write!(f, "{}", self.as_str())
89    }
90}
91
92impl<S: BosStr> AsRef<str> for ContributionViewContributionType<S> {
93    fn as_ref(&self) -> &str {
94        self.as_str()
95    }
96}
97
98impl<S: BosStr> Serialize for ContributionViewContributionType<S> {
99    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
100    where
101        Ser: serde::Serializer,
102    {
103        serializer.serialize_str(self.as_str())
104    }
105}
106
107impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ContributionViewContributionType<S> {
108    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
109    where
110        D: serde::Deserializer<'de>,
111    {
112        let s = S::deserialize(deserializer)?;
113        Ok(Self::from_value(s))
114    }
115}
116
117impl<S: BosStr + Default> Default for ContributionViewContributionType<S> {
118    fn default() -> Self {
119        Self::Other(Default::default())
120    }
121}
122
123impl<S: BosStr> jacquard_common::IntoStatic for ContributionViewContributionType<S>
124where
125    S: BosStr + jacquard_common::IntoStatic,
126    S::Output: BosStr,
127{
128    type Output = ContributionViewContributionType<S::Output>;
129    fn into_static(self) -> Self::Output {
130        match self {
131            ContributionViewContributionType::Correction => {
132                ContributionViewContributionType::Correction
133            }
134            ContributionViewContributionType::Addition => {
135                ContributionViewContributionType::Addition
136            }
137            ContributionViewContributionType::NewGame => ContributionViewContributionType::NewGame,
138            ContributionViewContributionType::Other(v) => {
139                ContributionViewContributionType::Other(v.into_static())
140            }
141        }
142    }
143}
144
145#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
146#[serde(
147    rename_all = "camelCase",
148    bound(deserialize = "S: Deserialize<'de> + BosStr")
149)]
150pub struct GetContribution<S: BosStr = DefaultStr> {
151    pub uri: AtUri<S>,
152}
153
154#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
155#[serde(
156    rename_all = "camelCase",
157    bound(deserialize = "S: Deserialize<'de> + BosStr")
158)]
159pub struct GetContributionOutput<S: BosStr = DefaultStr> {
160    pub contribution: get_contribution::ContributionView<S>,
161    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
162    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
163}
164
165#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
166#[serde(
167    rename_all = "camelCase",
168    bound(deserialize = "S: Deserialize<'de> + BosStr")
169)]
170pub struct PatchView<S: BosStr = DefaultStr> {
171    pub changes: Data<S>,
172    pub created_at: Datetime,
173    pub subject: AtUri<S>,
174    pub uri: AtUri<S>,
175    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
176    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
177}
178
179#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
180#[serde(
181    rename_all = "camelCase",
182    bound(deserialize = "S: Deserialize<'de> + BosStr")
183)]
184pub struct ReviewView<S: BosStr = DefaultStr> {
185    pub created_at: Datetime,
186    #[serde(skip_serializing_if = "Option::is_none")]
187    pub reason: Option<S>,
188    pub reviewed_by: Did<S>,
189    pub status: ReviewViewStatus<S>,
190    pub uri: AtUri<S>,
191    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
192    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
193}
194
195#[derive(Debug, Clone, PartialEq, Eq, Hash)]
196pub enum ReviewViewStatus<S: BosStr = DefaultStr> {
197    Approved,
198    Denied,
199    NeedsRevision,
200    Other(S),
201}
202
203impl<S: BosStr> ReviewViewStatus<S> {
204    pub fn as_str(&self) -> &str {
205        match self {
206            Self::Approved => "approved",
207            Self::Denied => "denied",
208            Self::NeedsRevision => "needsRevision",
209            Self::Other(s) => s.as_ref(),
210        }
211    }
212    /// Construct from a string-like value, matching known values.
213    pub fn from_value(s: S) -> Self {
214        match s.as_ref() {
215            "approved" => Self::Approved,
216            "denied" => Self::Denied,
217            "needsRevision" => Self::NeedsRevision,
218            _ => Self::Other(s),
219        }
220    }
221}
222
223impl<S: BosStr> core::fmt::Display for ReviewViewStatus<S> {
224    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
225        write!(f, "{}", self.as_str())
226    }
227}
228
229impl<S: BosStr> AsRef<str> for ReviewViewStatus<S> {
230    fn as_ref(&self) -> &str {
231        self.as_str()
232    }
233}
234
235impl<S: BosStr> Serialize for ReviewViewStatus<S> {
236    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
237    where
238        Ser: serde::Serializer,
239    {
240        serializer.serialize_str(self.as_str())
241    }
242}
243
244impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ReviewViewStatus<S> {
245    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
246    where
247        D: serde::Deserializer<'de>,
248    {
249        let s = S::deserialize(deserializer)?;
250        Ok(Self::from_value(s))
251    }
252}
253
254impl<S: BosStr + Default> Default for ReviewViewStatus<S> {
255    fn default() -> Self {
256        Self::Other(Default::default())
257    }
258}
259
260impl<S: BosStr> jacquard_common::IntoStatic for ReviewViewStatus<S>
261where
262    S: BosStr + jacquard_common::IntoStatic,
263    S::Output: BosStr,
264{
265    type Output = ReviewViewStatus<S::Output>;
266    fn into_static(self) -> Self::Output {
267        match self {
268            ReviewViewStatus::Approved => ReviewViewStatus::Approved,
269            ReviewViewStatus::Denied => ReviewViewStatus::Denied,
270            ReviewViewStatus::NeedsRevision => ReviewViewStatus::NeedsRevision,
271            ReviewViewStatus::Other(v) => ReviewViewStatus::Other(v.into_static()),
272        }
273    }
274}
275
276#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
277#[serde(
278    rename_all = "camelCase",
279    bound(deserialize = "S: Deserialize<'de> + BosStr")
280)]
281pub struct VerificationView<S: BosStr = DefaultStr> {
282    pub accepted_by: VerificationViewAcceptedBy<S>,
283    pub contributor: Did<S>,
284    pub created_at: Datetime,
285    pub uri: AtUri<S>,
286    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
287    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
288}
289
290#[derive(Debug, Clone, PartialEq, Eq, Hash)]
291pub enum VerificationViewAcceptedBy<S: BosStr = DefaultStr> {
292    Mod,
293    Owner,
294    Both,
295    Other(S),
296}
297
298impl<S: BosStr> VerificationViewAcceptedBy<S> {
299    pub fn as_str(&self) -> &str {
300        match self {
301            Self::Mod => "mod",
302            Self::Owner => "owner",
303            Self::Both => "both",
304            Self::Other(s) => s.as_ref(),
305        }
306    }
307    /// Construct from a string-like value, matching known values.
308    pub fn from_value(s: S) -> Self {
309        match s.as_ref() {
310            "mod" => Self::Mod,
311            "owner" => Self::Owner,
312            "both" => Self::Both,
313            _ => Self::Other(s),
314        }
315    }
316}
317
318impl<S: BosStr> core::fmt::Display for VerificationViewAcceptedBy<S> {
319    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
320        write!(f, "{}", self.as_str())
321    }
322}
323
324impl<S: BosStr> AsRef<str> for VerificationViewAcceptedBy<S> {
325    fn as_ref(&self) -> &str {
326        self.as_str()
327    }
328}
329
330impl<S: BosStr> Serialize for VerificationViewAcceptedBy<S> {
331    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
332    where
333        Ser: serde::Serializer,
334    {
335        serializer.serialize_str(self.as_str())
336    }
337}
338
339impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for VerificationViewAcceptedBy<S> {
340    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
341    where
342        D: serde::Deserializer<'de>,
343    {
344        let s = S::deserialize(deserializer)?;
345        Ok(Self::from_value(s))
346    }
347}
348
349impl<S: BosStr + Default> Default for VerificationViewAcceptedBy<S> {
350    fn default() -> Self {
351        Self::Other(Default::default())
352    }
353}
354
355impl<S: BosStr> jacquard_common::IntoStatic for VerificationViewAcceptedBy<S>
356where
357    S: BosStr + jacquard_common::IntoStatic,
358    S::Output: BosStr,
359{
360    type Output = VerificationViewAcceptedBy<S::Output>;
361    fn into_static(self) -> Self::Output {
362        match self {
363            VerificationViewAcceptedBy::Mod => VerificationViewAcceptedBy::Mod,
364            VerificationViewAcceptedBy::Owner => VerificationViewAcceptedBy::Owner,
365            VerificationViewAcceptedBy::Both => VerificationViewAcceptedBy::Both,
366            VerificationViewAcceptedBy::Other(v) => {
367                VerificationViewAcceptedBy::Other(v.into_static())
368            }
369        }
370    }
371}
372
373impl<S: BosStr> LexiconSchema for ContributionView<S> {
374    fn nsid() -> &'static str {
375        "games.gamesgamesgamesgames.getContribution"
376    }
377    fn def_name() -> &'static str {
378        "contributionView"
379    }
380    fn lexicon_doc() -> LexiconDoc<'static> {
381        lexicon_doc_games_gamesgamesgamesgames_getContribution()
382    }
383    fn validate(&self) -> Result<(), ConstraintError> {
384        Ok(())
385    }
386}
387
388/** Response marker for the `games.gamesgamesgamesgames.getContribution` query.
389
390Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `GetContributionOutput<S>` for this endpoint.*/
391pub struct GetContributionResponse;
392impl jacquard_common::xrpc::XrpcResp for GetContributionResponse {
393    const NSID: &'static str = "games.gamesgamesgamesgames.getContribution";
394    const ENCODING: &'static str = "application/json";
395    type Output<S: BosStr> = GetContributionOutput<S>;
396    type Err = jacquard_common::xrpc::GenericError;
397}
398
399impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetContribution<S> {
400    const NSID: &'static str = "games.gamesgamesgamesgames.getContribution";
401    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
402    type Response = GetContributionResponse;
403}
404
405/** Endpoint marker for the `games.gamesgamesgamesgames.getContribution` query.
406
407Path: `/xrpc/games.gamesgamesgamesgames.getContribution`. The request payload type is `GetContribution<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
408pub struct GetContributionRequest;
409impl jacquard_common::xrpc::XrpcEndpoint for GetContributionRequest {
410    const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getContribution";
411    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
412    type Request<S: BosStr> = GetContribution<S>;
413    type Response = GetContributionResponse;
414}
415
416impl<S: BosStr> LexiconSchema for PatchView<S> {
417    fn nsid() -> &'static str {
418        "games.gamesgamesgamesgames.getContribution"
419    }
420    fn def_name() -> &'static str {
421        "patchView"
422    }
423    fn lexicon_doc() -> LexiconDoc<'static> {
424        lexicon_doc_games_gamesgamesgamesgames_getContribution()
425    }
426    fn validate(&self) -> Result<(), ConstraintError> {
427        Ok(())
428    }
429}
430
431impl<S: BosStr> LexiconSchema for ReviewView<S> {
432    fn nsid() -> &'static str {
433        "games.gamesgamesgamesgames.getContribution"
434    }
435    fn def_name() -> &'static str {
436        "reviewView"
437    }
438    fn lexicon_doc() -> LexiconDoc<'static> {
439        lexicon_doc_games_gamesgamesgamesgames_getContribution()
440    }
441    fn validate(&self) -> Result<(), ConstraintError> {
442        Ok(())
443    }
444}
445
446impl<S: BosStr> LexiconSchema for VerificationView<S> {
447    fn nsid() -> &'static str {
448        "games.gamesgamesgamesgames.getContribution"
449    }
450    fn def_name() -> &'static str {
451        "verificationView"
452    }
453    fn lexicon_doc() -> LexiconDoc<'static> {
454        lexicon_doc_games_gamesgamesgamesgames_getContribution()
455    }
456    fn validate(&self) -> Result<(), ConstraintError> {
457        Ok(())
458    }
459}
460
461pub mod contribution_view_state {
462
463    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
464    #[allow(unused)]
465    use ::core::marker::PhantomData;
466    mod sealed {
467        pub trait Sealed {}
468    }
469    /// State trait tracking which required fields have been set
470    pub trait State: sealed::Sealed {
471        type Changes;
472        type Cid;
473        type ContributionType;
474        type ContributorDid;
475        type CreatedAt;
476        type Uri;
477    }
478    /// Empty state - all required fields are unset
479    pub struct Empty(());
480    impl sealed::Sealed for Empty {}
481    impl State for Empty {
482        type Changes = Unset;
483        type Cid = Unset;
484        type ContributionType = Unset;
485        type ContributorDid = Unset;
486        type CreatedAt = Unset;
487        type Uri = Unset;
488    }
489    ///State transition - sets the `changes` field to Set
490    pub struct SetChanges<St: State = Empty>(PhantomData<fn() -> St>);
491    impl<St: State> sealed::Sealed for SetChanges<St> {}
492    impl<St: State> State for SetChanges<St> {
493        type Changes = Set<members::changes>;
494        type Cid = St::Cid;
495        type ContributionType = St::ContributionType;
496        type ContributorDid = St::ContributorDid;
497        type CreatedAt = St::CreatedAt;
498        type Uri = St::Uri;
499    }
500    ///State transition - sets the `cid` field to Set
501    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
502    impl<St: State> sealed::Sealed for SetCid<St> {}
503    impl<St: State> State for SetCid<St> {
504        type Changes = St::Changes;
505        type Cid = Set<members::cid>;
506        type ContributionType = St::ContributionType;
507        type ContributorDid = St::ContributorDid;
508        type CreatedAt = St::CreatedAt;
509        type Uri = St::Uri;
510    }
511    ///State transition - sets the `contribution_type` field to Set
512    pub struct SetContributionType<St: State = Empty>(PhantomData<fn() -> St>);
513    impl<St: State> sealed::Sealed for SetContributionType<St> {}
514    impl<St: State> State for SetContributionType<St> {
515        type Changes = St::Changes;
516        type Cid = St::Cid;
517        type ContributionType = Set<members::contribution_type>;
518        type ContributorDid = St::ContributorDid;
519        type CreatedAt = St::CreatedAt;
520        type Uri = St::Uri;
521    }
522    ///State transition - sets the `contributor_did` field to Set
523    pub struct SetContributorDid<St: State = Empty>(PhantomData<fn() -> St>);
524    impl<St: State> sealed::Sealed for SetContributorDid<St> {}
525    impl<St: State> State for SetContributorDid<St> {
526        type Changes = St::Changes;
527        type Cid = St::Cid;
528        type ContributionType = St::ContributionType;
529        type ContributorDid = Set<members::contributor_did>;
530        type CreatedAt = St::CreatedAt;
531        type Uri = St::Uri;
532    }
533    ///State transition - sets the `created_at` field to Set
534    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
535    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
536    impl<St: State> State for SetCreatedAt<St> {
537        type Changes = St::Changes;
538        type Cid = St::Cid;
539        type ContributionType = St::ContributionType;
540        type ContributorDid = St::ContributorDid;
541        type CreatedAt = Set<members::created_at>;
542        type Uri = St::Uri;
543    }
544    ///State transition - sets the `uri` field to Set
545    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
546    impl<St: State> sealed::Sealed for SetUri<St> {}
547    impl<St: State> State for SetUri<St> {
548        type Changes = St::Changes;
549        type Cid = St::Cid;
550        type ContributionType = St::ContributionType;
551        type ContributorDid = St::ContributorDid;
552        type CreatedAt = St::CreatedAt;
553        type Uri = Set<members::uri>;
554    }
555    /// Marker types for field names
556    #[allow(non_camel_case_types)]
557    pub mod members {
558        ///Marker type for the `changes` field
559        pub struct changes(());
560        ///Marker type for the `cid` field
561        pub struct cid(());
562        ///Marker type for the `contribution_type` field
563        pub struct contribution_type(());
564        ///Marker type for the `contributor_did` field
565        pub struct contributor_did(());
566        ///Marker type for the `created_at` field
567        pub struct created_at(());
568        ///Marker type for the `uri` field
569        pub struct uri(());
570    }
571}
572
573/// Builder for constructing an instance of this type.
574pub struct ContributionViewBuilder<St: contribution_view_state::State, S: BosStr = DefaultStr> {
575    _state: PhantomData<fn() -> St>,
576    _fields: (
577        Option<Data<S>>,
578        Option<S>,
579        Option<ContributionViewContributionType<S>>,
580        Option<Did<S>>,
581        Option<Datetime>,
582        Option<S>,
583        Option<get_contribution::PatchView<S>>,
584        Option<get_contribution::ReviewView<S>>,
585        Option<AtUri<S>>,
586        Option<S>,
587        Option<AtUri<S>>,
588        Option<get_contribution::VerificationView<S>>,
589    ),
590    _type: PhantomData<fn() -> S>,
591}
592
593impl ContributionView<DefaultStr> {
594    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
595    pub fn new() -> ContributionViewBuilder<contribution_view_state::Empty, DefaultStr> {
596        ContributionViewBuilder::new()
597    }
598}
599
600impl<S: BosStr> ContributionView<S> {
601    /// Create a new builder for this type
602    pub fn builder() -> ContributionViewBuilder<contribution_view_state::Empty, S> {
603        ContributionViewBuilder::builder()
604    }
605}
606
607impl ContributionViewBuilder<contribution_view_state::Empty, DefaultStr> {
608    /// Create a new builder with all fields unset, using the default string type, if needed
609    pub fn new() -> Self {
610        ContributionViewBuilder {
611            _state: PhantomData,
612            _fields: (
613                None, None, None, None, None, None, None, None, None, None, None, None,
614            ),
615            _type: PhantomData,
616        }
617    }
618}
619
620impl<S: BosStr> ContributionViewBuilder<contribution_view_state::Empty, S> {
621    /// Create a new builder with all fields unset
622    pub fn builder() -> Self {
623        ContributionViewBuilder {
624            _state: PhantomData,
625            _fields: (
626                None, None, None, None, None, None, None, None, None, None, None, None,
627            ),
628            _type: PhantomData,
629        }
630    }
631}
632
633impl<St, S: BosStr> ContributionViewBuilder<St, S>
634where
635    St: contribution_view_state::State,
636    St::Changes: contribution_view_state::IsUnset,
637{
638    /// Set the `changes` field (required)
639    pub fn changes(
640        mut self,
641        value: impl Into<Data<S>>,
642    ) -> ContributionViewBuilder<contribution_view_state::SetChanges<St>, S> {
643        self._fields.0 = Option::Some(value.into());
644        ContributionViewBuilder {
645            _state: PhantomData,
646            _fields: self._fields,
647            _type: PhantomData,
648        }
649    }
650}
651
652impl<St, S: BosStr> ContributionViewBuilder<St, S>
653where
654    St: contribution_view_state::State,
655    St::Cid: contribution_view_state::IsUnset,
656{
657    /// Set the `cid` field (required)
658    pub fn cid(
659        mut self,
660        value: impl Into<S>,
661    ) -> ContributionViewBuilder<contribution_view_state::SetCid<St>, S> {
662        self._fields.1 = Option::Some(value.into());
663        ContributionViewBuilder {
664            _state: PhantomData,
665            _fields: self._fields,
666            _type: PhantomData,
667        }
668    }
669}
670
671impl<St, S: BosStr> ContributionViewBuilder<St, S>
672where
673    St: contribution_view_state::State,
674    St::ContributionType: contribution_view_state::IsUnset,
675{
676    /// Set the `contributionType` field (required)
677    pub fn contribution_type(
678        mut self,
679        value: impl Into<ContributionViewContributionType<S>>,
680    ) -> ContributionViewBuilder<contribution_view_state::SetContributionType<St>, S> {
681        self._fields.2 = Option::Some(value.into());
682        ContributionViewBuilder {
683            _state: PhantomData,
684            _fields: self._fields,
685            _type: PhantomData,
686        }
687    }
688}
689
690impl<St, S: BosStr> ContributionViewBuilder<St, S>
691where
692    St: contribution_view_state::State,
693    St::ContributorDid: contribution_view_state::IsUnset,
694{
695    /// Set the `contributorDid` field (required)
696    pub fn contributor_did(
697        mut self,
698        value: impl Into<Did<S>>,
699    ) -> ContributionViewBuilder<contribution_view_state::SetContributorDid<St>, S> {
700        self._fields.3 = Option::Some(value.into());
701        ContributionViewBuilder {
702            _state: PhantomData,
703            _fields: self._fields,
704            _type: PhantomData,
705        }
706    }
707}
708
709impl<St, S: BosStr> ContributionViewBuilder<St, S>
710where
711    St: contribution_view_state::State,
712    St::CreatedAt: contribution_view_state::IsUnset,
713{
714    /// Set the `createdAt` field (required)
715    pub fn created_at(
716        mut self,
717        value: impl Into<Datetime>,
718    ) -> ContributionViewBuilder<contribution_view_state::SetCreatedAt<St>, S> {
719        self._fields.4 = Option::Some(value.into());
720        ContributionViewBuilder {
721            _state: PhantomData,
722            _fields: self._fields,
723            _type: PhantomData,
724        }
725    }
726}
727
728impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
729    /// Set the `message` field (optional)
730    pub fn message(mut self, value: impl Into<Option<S>>) -> Self {
731        self._fields.5 = value.into();
732        self
733    }
734    /// Set the `message` field to an Option value (optional)
735    pub fn maybe_message(mut self, value: Option<S>) -> Self {
736        self._fields.5 = value;
737        self
738    }
739}
740
741impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
742    /// Set the `patch` field (optional)
743    pub fn patch(mut self, value: impl Into<Option<get_contribution::PatchView<S>>>) -> Self {
744        self._fields.6 = value.into();
745        self
746    }
747    /// Set the `patch` field to an Option value (optional)
748    pub fn maybe_patch(mut self, value: Option<get_contribution::PatchView<S>>) -> Self {
749        self._fields.6 = value;
750        self
751    }
752}
753
754impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
755    /// Set the `review` field (optional)
756    pub fn review(mut self, value: impl Into<Option<get_contribution::ReviewView<S>>>) -> Self {
757        self._fields.7 = value.into();
758        self
759    }
760    /// Set the `review` field to an Option value (optional)
761    pub fn maybe_review(mut self, value: Option<get_contribution::ReviewView<S>>) -> Self {
762        self._fields.7 = value;
763        self
764    }
765}
766
767impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
768    /// Set the `subject` field (optional)
769    pub fn subject(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
770        self._fields.8 = value.into();
771        self
772    }
773    /// Set the `subject` field to an Option value (optional)
774    pub fn maybe_subject(mut self, value: Option<AtUri<S>>) -> Self {
775        self._fields.8 = value;
776        self
777    }
778}
779
780impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
781    /// Set the `subjectName` field (optional)
782    pub fn subject_name(mut self, value: impl Into<Option<S>>) -> Self {
783        self._fields.9 = value.into();
784        self
785    }
786    /// Set the `subjectName` field to an Option value (optional)
787    pub fn maybe_subject_name(mut self, value: Option<S>) -> Self {
788        self._fields.9 = value;
789        self
790    }
791}
792
793impl<St, S: BosStr> ContributionViewBuilder<St, S>
794where
795    St: contribution_view_state::State,
796    St::Uri: contribution_view_state::IsUnset,
797{
798    /// Set the `uri` field (required)
799    pub fn uri(
800        mut self,
801        value: impl Into<AtUri<S>>,
802    ) -> ContributionViewBuilder<contribution_view_state::SetUri<St>, S> {
803        self._fields.10 = Option::Some(value.into());
804        ContributionViewBuilder {
805            _state: PhantomData,
806            _fields: self._fields,
807            _type: PhantomData,
808        }
809    }
810}
811
812impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
813    /// Set the `verification` field (optional)
814    pub fn verification(
815        mut self,
816        value: impl Into<Option<get_contribution::VerificationView<S>>>,
817    ) -> Self {
818        self._fields.11 = value.into();
819        self
820    }
821    /// Set the `verification` field to an Option value (optional)
822    pub fn maybe_verification(
823        mut self,
824        value: Option<get_contribution::VerificationView<S>>,
825    ) -> Self {
826        self._fields.11 = value;
827        self
828    }
829}
830
831impl<St, S: BosStr> ContributionViewBuilder<St, S>
832where
833    St: contribution_view_state::State,
834    St::Changes: contribution_view_state::IsSet,
835    St::Cid: contribution_view_state::IsSet,
836    St::ContributionType: contribution_view_state::IsSet,
837    St::ContributorDid: contribution_view_state::IsSet,
838    St::CreatedAt: contribution_view_state::IsSet,
839    St::Uri: contribution_view_state::IsSet,
840{
841    /// Build the final struct.
842    pub fn build(self) -> ContributionView<S> {
843        ContributionView {
844            changes: self._fields.0.unwrap(),
845            cid: self._fields.1.unwrap(),
846            contribution_type: self._fields.2.unwrap(),
847            contributor_did: self._fields.3.unwrap(),
848            created_at: self._fields.4.unwrap(),
849            message: self._fields.5,
850            patch: self._fields.6,
851            review: self._fields.7,
852            subject: self._fields.8,
853            subject_name: self._fields.9,
854            uri: self._fields.10.unwrap(),
855            verification: self._fields.11,
856            extra_data: Default::default(),
857        }
858    }
859    /// Build the final struct with custom extra_data.
860    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ContributionView<S> {
861        ContributionView {
862            changes: self._fields.0.unwrap(),
863            cid: self._fields.1.unwrap(),
864            contribution_type: self._fields.2.unwrap(),
865            contributor_did: self._fields.3.unwrap(),
866            created_at: self._fields.4.unwrap(),
867            message: self._fields.5,
868            patch: self._fields.6,
869            review: self._fields.7,
870            subject: self._fields.8,
871            subject_name: self._fields.9,
872            uri: self._fields.10.unwrap(),
873            verification: self._fields.11,
874            extra_data: Some(extra_data),
875        }
876    }
877}
878
879fn lexicon_doc_games_gamesgamesgamesgames_getContribution() -> LexiconDoc<'static> {
880    use alloc::collections::BTreeMap;
881    #[allow(unused_imports)]
882    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
883    use jacquard_lexicon::lexicon::*;
884    LexiconDoc {
885        lexicon: Lexicon::Lexicon1,
886        id: CowStr::new_static("games.gamesgamesgamesgames.getContribution"),
887        defs: {
888            let mut map = BTreeMap::new();
889            map.insert(
890                SmolStr::new_static("contributionView"),
891                LexUserType::Object(LexObject {
892                    required: Some(vec![
893                        SmolStr::new_static("uri"),
894                        SmolStr::new_static("cid"),
895                        SmolStr::new_static("contributorDid"),
896                        SmolStr::new_static("contributionType"),
897                        SmolStr::new_static("changes"),
898                        SmolStr::new_static("createdAt"),
899                    ]),
900                    properties: {
901                        #[allow(unused_mut)]
902                        let mut map = BTreeMap::new();
903                        map.insert(
904                            SmolStr::new_static("changes"),
905                            LexObjectProperty::Unknown(LexUnknown {
906                                ..Default::default()
907                            }),
908                        );
909                        map.insert(
910                            SmolStr::new_static("cid"),
911                            LexObjectProperty::String(LexString {
912                                ..Default::default()
913                            }),
914                        );
915                        map.insert(
916                            SmolStr::new_static("contributionType"),
917                            LexObjectProperty::String(LexString {
918                                ..Default::default()
919                            }),
920                        );
921                        map.insert(
922                            SmolStr::new_static("contributorDid"),
923                            LexObjectProperty::String(LexString {
924                                format: Some(LexStringFormat::Did),
925                                ..Default::default()
926                            }),
927                        );
928                        map.insert(
929                            SmolStr::new_static("createdAt"),
930                            LexObjectProperty::String(LexString {
931                                format: Some(LexStringFormat::Datetime),
932                                ..Default::default()
933                            }),
934                        );
935                        map.insert(
936                            SmolStr::new_static("message"),
937                            LexObjectProperty::String(LexString {
938                                ..Default::default()
939                            }),
940                        );
941                        map.insert(
942                            SmolStr::new_static("patch"),
943                            LexObjectProperty::Ref(LexRef {
944                                r#ref: CowStr::new_static("#patchView"),
945                                ..Default::default()
946                            }),
947                        );
948                        map.insert(
949                            SmolStr::new_static("review"),
950                            LexObjectProperty::Ref(LexRef {
951                                r#ref: CowStr::new_static("#reviewView"),
952                                ..Default::default()
953                            }),
954                        );
955                        map.insert(
956                            SmolStr::new_static("subject"),
957                            LexObjectProperty::String(LexString {
958                                format: Some(LexStringFormat::AtUri),
959                                ..Default::default()
960                            }),
961                        );
962                        map.insert(
963                            SmolStr::new_static("subjectName"),
964                            LexObjectProperty::String(LexString {
965                                description: Some(CowStr::new_static(
966                                    "Resolved name of the subject entity for display.",
967                                )),
968                                ..Default::default()
969                            }),
970                        );
971                        map.insert(
972                            SmolStr::new_static("uri"),
973                            LexObjectProperty::String(LexString {
974                                format: Some(LexStringFormat::AtUri),
975                                ..Default::default()
976                            }),
977                        );
978                        map.insert(
979                            SmolStr::new_static("verification"),
980                            LexObjectProperty::Ref(LexRef {
981                                r#ref: CowStr::new_static("#verificationView"),
982                                ..Default::default()
983                            }),
984                        );
985                        map
986                    },
987                    ..Default::default()
988                }),
989            );
990            map.insert(
991                SmolStr::new_static("main"),
992                LexUserType::XrpcQuery(LexXrpcQuery {
993                    parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters {
994                        required: Some(vec![SmolStr::new_static("uri")]),
995                        properties: {
996                            #[allow(unused_mut)]
997                            let mut map = BTreeMap::new();
998                            map.insert(
999                                SmolStr::new_static("uri"),
1000                                LexXrpcParametersProperty::String(LexString {
1001                                    format: Some(LexStringFormat::AtUri),
1002                                    ..Default::default()
1003                                }),
1004                            );
1005                            map
1006                        },
1007                        ..Default::default()
1008                    })),
1009                    ..Default::default()
1010                }),
1011            );
1012            map.insert(
1013                SmolStr::new_static("patchView"),
1014                LexUserType::Object(LexObject {
1015                    required: Some(vec![
1016                        SmolStr::new_static("uri"),
1017                        SmolStr::new_static("subject"),
1018                        SmolStr::new_static("changes"),
1019                        SmolStr::new_static("createdAt"),
1020                    ]),
1021                    properties: {
1022                        #[allow(unused_mut)]
1023                        let mut map = BTreeMap::new();
1024                        map.insert(
1025                            SmolStr::new_static("changes"),
1026                            LexObjectProperty::Unknown(LexUnknown {
1027                                ..Default::default()
1028                            }),
1029                        );
1030                        map.insert(
1031                            SmolStr::new_static("createdAt"),
1032                            LexObjectProperty::String(LexString {
1033                                format: Some(LexStringFormat::Datetime),
1034                                ..Default::default()
1035                            }),
1036                        );
1037                        map.insert(
1038                            SmolStr::new_static("subject"),
1039                            LexObjectProperty::String(LexString {
1040                                format: Some(LexStringFormat::AtUri),
1041                                ..Default::default()
1042                            }),
1043                        );
1044                        map.insert(
1045                            SmolStr::new_static("uri"),
1046                            LexObjectProperty::String(LexString {
1047                                format: Some(LexStringFormat::AtUri),
1048                                ..Default::default()
1049                            }),
1050                        );
1051                        map
1052                    },
1053                    ..Default::default()
1054                }),
1055            );
1056            map.insert(
1057                SmolStr::new_static("reviewView"),
1058                LexUserType::Object(LexObject {
1059                    required: Some(vec![
1060                        SmolStr::new_static("uri"),
1061                        SmolStr::new_static("status"),
1062                        SmolStr::new_static("reviewedBy"),
1063                        SmolStr::new_static("createdAt"),
1064                    ]),
1065                    properties: {
1066                        #[allow(unused_mut)]
1067                        let mut map = BTreeMap::new();
1068                        map.insert(
1069                            SmolStr::new_static("createdAt"),
1070                            LexObjectProperty::String(LexString {
1071                                format: Some(LexStringFormat::Datetime),
1072                                ..Default::default()
1073                            }),
1074                        );
1075                        map.insert(
1076                            SmolStr::new_static("reason"),
1077                            LexObjectProperty::String(LexString {
1078                                ..Default::default()
1079                            }),
1080                        );
1081                        map.insert(
1082                            SmolStr::new_static("reviewedBy"),
1083                            LexObjectProperty::String(LexString {
1084                                format: Some(LexStringFormat::Did),
1085                                ..Default::default()
1086                            }),
1087                        );
1088                        map.insert(
1089                            SmolStr::new_static("status"),
1090                            LexObjectProperty::String(LexString {
1091                                ..Default::default()
1092                            }),
1093                        );
1094                        map.insert(
1095                            SmolStr::new_static("uri"),
1096                            LexObjectProperty::String(LexString {
1097                                format: Some(LexStringFormat::AtUri),
1098                                ..Default::default()
1099                            }),
1100                        );
1101                        map
1102                    },
1103                    ..Default::default()
1104                }),
1105            );
1106            map.insert(
1107                SmolStr::new_static("verificationView"),
1108                LexUserType::Object(LexObject {
1109                    required: Some(vec![
1110                        SmolStr::new_static("uri"),
1111                        SmolStr::new_static("contributor"),
1112                        SmolStr::new_static("acceptedBy"),
1113                        SmolStr::new_static("createdAt"),
1114                    ]),
1115                    properties: {
1116                        #[allow(unused_mut)]
1117                        let mut map = BTreeMap::new();
1118                        map.insert(
1119                            SmolStr::new_static("acceptedBy"),
1120                            LexObjectProperty::String(LexString {
1121                                ..Default::default()
1122                            }),
1123                        );
1124                        map.insert(
1125                            SmolStr::new_static("contributor"),
1126                            LexObjectProperty::String(LexString {
1127                                format: Some(LexStringFormat::Did),
1128                                ..Default::default()
1129                            }),
1130                        );
1131                        map.insert(
1132                            SmolStr::new_static("createdAt"),
1133                            LexObjectProperty::String(LexString {
1134                                format: Some(LexStringFormat::Datetime),
1135                                ..Default::default()
1136                            }),
1137                        );
1138                        map.insert(
1139                            SmolStr::new_static("uri"),
1140                            LexObjectProperty::String(LexString {
1141                                format: Some(LexStringFormat::AtUri),
1142                                ..Default::default()
1143                            }),
1144                        );
1145                        map
1146                    },
1147                    ..Default::default()
1148                }),
1149            );
1150            map
1151        },
1152        ..Default::default()
1153    }
1154}
1155
1156pub mod get_contribution_state {
1157
1158    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1159    #[allow(unused)]
1160    use ::core::marker::PhantomData;
1161    mod sealed {
1162        pub trait Sealed {}
1163    }
1164    /// State trait tracking which required fields have been set
1165    pub trait State: sealed::Sealed {
1166        type Uri;
1167    }
1168    /// Empty state - all required fields are unset
1169    pub struct Empty(());
1170    impl sealed::Sealed for Empty {}
1171    impl State for Empty {
1172        type Uri = Unset;
1173    }
1174    ///State transition - sets the `uri` field to Set
1175    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1176    impl<St: State> sealed::Sealed for SetUri<St> {}
1177    impl<St: State> State for SetUri<St> {
1178        type Uri = Set<members::uri>;
1179    }
1180    /// Marker types for field names
1181    #[allow(non_camel_case_types)]
1182    pub mod members {
1183        ///Marker type for the `uri` field
1184        pub struct uri(());
1185    }
1186}
1187
1188/// Builder for constructing an instance of this type.
1189pub struct GetContributionBuilder<St: get_contribution_state::State, S: BosStr = DefaultStr> {
1190    _state: PhantomData<fn() -> St>,
1191    _fields: (Option<AtUri<S>>,),
1192    _type: PhantomData<fn() -> S>,
1193}
1194
1195impl GetContribution<DefaultStr> {
1196    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1197    pub fn new() -> GetContributionBuilder<get_contribution_state::Empty, DefaultStr> {
1198        GetContributionBuilder::new()
1199    }
1200}
1201
1202impl<S: BosStr> GetContribution<S> {
1203    /// Create a new builder for this type
1204    pub fn builder() -> GetContributionBuilder<get_contribution_state::Empty, S> {
1205        GetContributionBuilder::builder()
1206    }
1207}
1208
1209impl GetContributionBuilder<get_contribution_state::Empty, DefaultStr> {
1210    /// Create a new builder with all fields unset, using the default string type, if needed
1211    pub fn new() -> Self {
1212        GetContributionBuilder {
1213            _state: PhantomData,
1214            _fields: (None,),
1215            _type: PhantomData,
1216        }
1217    }
1218}
1219
1220impl<S: BosStr> GetContributionBuilder<get_contribution_state::Empty, S> {
1221    /// Create a new builder with all fields unset
1222    pub fn builder() -> Self {
1223        GetContributionBuilder {
1224            _state: PhantomData,
1225            _fields: (None,),
1226            _type: PhantomData,
1227        }
1228    }
1229}
1230
1231impl<St, S: BosStr> GetContributionBuilder<St, S>
1232where
1233    St: get_contribution_state::State,
1234    St::Uri: get_contribution_state::IsUnset,
1235{
1236    /// Set the `uri` field (required)
1237    pub fn uri(
1238        mut self,
1239        value: impl Into<AtUri<S>>,
1240    ) -> GetContributionBuilder<get_contribution_state::SetUri<St>, S> {
1241        self._fields.0 = Option::Some(value.into());
1242        GetContributionBuilder {
1243            _state: PhantomData,
1244            _fields: self._fields,
1245            _type: PhantomData,
1246        }
1247    }
1248}
1249
1250impl<St, S: BosStr> GetContributionBuilder<St, S>
1251where
1252    St: get_contribution_state::State,
1253    St::Uri: get_contribution_state::IsSet,
1254{
1255    /// Build the final struct.
1256    pub fn build(self) -> GetContribution<S> {
1257        GetContribution {
1258            uri: self._fields.0.unwrap(),
1259        }
1260    }
1261}
1262
1263pub mod patch_view_state {
1264
1265    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1266    #[allow(unused)]
1267    use ::core::marker::PhantomData;
1268    mod sealed {
1269        pub trait Sealed {}
1270    }
1271    /// State trait tracking which required fields have been set
1272    pub trait State: sealed::Sealed {
1273        type Changes;
1274        type CreatedAt;
1275        type Subject;
1276        type Uri;
1277    }
1278    /// Empty state - all required fields are unset
1279    pub struct Empty(());
1280    impl sealed::Sealed for Empty {}
1281    impl State for Empty {
1282        type Changes = Unset;
1283        type CreatedAt = Unset;
1284        type Subject = Unset;
1285        type Uri = Unset;
1286    }
1287    ///State transition - sets the `changes` field to Set
1288    pub struct SetChanges<St: State = Empty>(PhantomData<fn() -> St>);
1289    impl<St: State> sealed::Sealed for SetChanges<St> {}
1290    impl<St: State> State for SetChanges<St> {
1291        type Changes = Set<members::changes>;
1292        type CreatedAt = St::CreatedAt;
1293        type Subject = St::Subject;
1294        type Uri = St::Uri;
1295    }
1296    ///State transition - sets the `created_at` field to Set
1297    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
1298    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
1299    impl<St: State> State for SetCreatedAt<St> {
1300        type Changes = St::Changes;
1301        type CreatedAt = Set<members::created_at>;
1302        type Subject = St::Subject;
1303        type Uri = St::Uri;
1304    }
1305    ///State transition - sets the `subject` field to Set
1306    pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
1307    impl<St: State> sealed::Sealed for SetSubject<St> {}
1308    impl<St: State> State for SetSubject<St> {
1309        type Changes = St::Changes;
1310        type CreatedAt = St::CreatedAt;
1311        type Subject = Set<members::subject>;
1312        type Uri = St::Uri;
1313    }
1314    ///State transition - sets the `uri` field to Set
1315    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1316    impl<St: State> sealed::Sealed for SetUri<St> {}
1317    impl<St: State> State for SetUri<St> {
1318        type Changes = St::Changes;
1319        type CreatedAt = St::CreatedAt;
1320        type Subject = St::Subject;
1321        type Uri = Set<members::uri>;
1322    }
1323    /// Marker types for field names
1324    #[allow(non_camel_case_types)]
1325    pub mod members {
1326        ///Marker type for the `changes` field
1327        pub struct changes(());
1328        ///Marker type for the `created_at` field
1329        pub struct created_at(());
1330        ///Marker type for the `subject` field
1331        pub struct subject(());
1332        ///Marker type for the `uri` field
1333        pub struct uri(());
1334    }
1335}
1336
1337/// Builder for constructing an instance of this type.
1338pub struct PatchViewBuilder<St: patch_view_state::State, S: BosStr = DefaultStr> {
1339    _state: PhantomData<fn() -> St>,
1340    _fields: (
1341        Option<Data<S>>,
1342        Option<Datetime>,
1343        Option<AtUri<S>>,
1344        Option<AtUri<S>>,
1345    ),
1346    _type: PhantomData<fn() -> S>,
1347}
1348
1349impl PatchView<DefaultStr> {
1350    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1351    pub fn new() -> PatchViewBuilder<patch_view_state::Empty, DefaultStr> {
1352        PatchViewBuilder::new()
1353    }
1354}
1355
1356impl<S: BosStr> PatchView<S> {
1357    /// Create a new builder for this type
1358    pub fn builder() -> PatchViewBuilder<patch_view_state::Empty, S> {
1359        PatchViewBuilder::builder()
1360    }
1361}
1362
1363impl PatchViewBuilder<patch_view_state::Empty, DefaultStr> {
1364    /// Create a new builder with all fields unset, using the default string type, if needed
1365    pub fn new() -> Self {
1366        PatchViewBuilder {
1367            _state: PhantomData,
1368            _fields: (None, None, None, None),
1369            _type: PhantomData,
1370        }
1371    }
1372}
1373
1374impl<S: BosStr> PatchViewBuilder<patch_view_state::Empty, S> {
1375    /// Create a new builder with all fields unset
1376    pub fn builder() -> Self {
1377        PatchViewBuilder {
1378            _state: PhantomData,
1379            _fields: (None, None, None, None),
1380            _type: PhantomData,
1381        }
1382    }
1383}
1384
1385impl<St, S: BosStr> PatchViewBuilder<St, S>
1386where
1387    St: patch_view_state::State,
1388    St::Changes: patch_view_state::IsUnset,
1389{
1390    /// Set the `changes` field (required)
1391    pub fn changes(
1392        mut self,
1393        value: impl Into<Data<S>>,
1394    ) -> PatchViewBuilder<patch_view_state::SetChanges<St>, S> {
1395        self._fields.0 = Option::Some(value.into());
1396        PatchViewBuilder {
1397            _state: PhantomData,
1398            _fields: self._fields,
1399            _type: PhantomData,
1400        }
1401    }
1402}
1403
1404impl<St, S: BosStr> PatchViewBuilder<St, S>
1405where
1406    St: patch_view_state::State,
1407    St::CreatedAt: patch_view_state::IsUnset,
1408{
1409    /// Set the `createdAt` field (required)
1410    pub fn created_at(
1411        mut self,
1412        value: impl Into<Datetime>,
1413    ) -> PatchViewBuilder<patch_view_state::SetCreatedAt<St>, S> {
1414        self._fields.1 = Option::Some(value.into());
1415        PatchViewBuilder {
1416            _state: PhantomData,
1417            _fields: self._fields,
1418            _type: PhantomData,
1419        }
1420    }
1421}
1422
1423impl<St, S: BosStr> PatchViewBuilder<St, S>
1424where
1425    St: patch_view_state::State,
1426    St::Subject: patch_view_state::IsUnset,
1427{
1428    /// Set the `subject` field (required)
1429    pub fn subject(
1430        mut self,
1431        value: impl Into<AtUri<S>>,
1432    ) -> PatchViewBuilder<patch_view_state::SetSubject<St>, S> {
1433        self._fields.2 = Option::Some(value.into());
1434        PatchViewBuilder {
1435            _state: PhantomData,
1436            _fields: self._fields,
1437            _type: PhantomData,
1438        }
1439    }
1440}
1441
1442impl<St, S: BosStr> PatchViewBuilder<St, S>
1443where
1444    St: patch_view_state::State,
1445    St::Uri: patch_view_state::IsUnset,
1446{
1447    /// Set the `uri` field (required)
1448    pub fn uri(
1449        mut self,
1450        value: impl Into<AtUri<S>>,
1451    ) -> PatchViewBuilder<patch_view_state::SetUri<St>, S> {
1452        self._fields.3 = Option::Some(value.into());
1453        PatchViewBuilder {
1454            _state: PhantomData,
1455            _fields: self._fields,
1456            _type: PhantomData,
1457        }
1458    }
1459}
1460
1461impl<St, S: BosStr> PatchViewBuilder<St, S>
1462where
1463    St: patch_view_state::State,
1464    St::Changes: patch_view_state::IsSet,
1465    St::CreatedAt: patch_view_state::IsSet,
1466    St::Subject: patch_view_state::IsSet,
1467    St::Uri: patch_view_state::IsSet,
1468{
1469    /// Build the final struct.
1470    pub fn build(self) -> PatchView<S> {
1471        PatchView {
1472            changes: self._fields.0.unwrap(),
1473            created_at: self._fields.1.unwrap(),
1474            subject: self._fields.2.unwrap(),
1475            uri: self._fields.3.unwrap(),
1476            extra_data: Default::default(),
1477        }
1478    }
1479    /// Build the final struct with custom extra_data.
1480    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> PatchView<S> {
1481        PatchView {
1482            changes: self._fields.0.unwrap(),
1483            created_at: self._fields.1.unwrap(),
1484            subject: self._fields.2.unwrap(),
1485            uri: self._fields.3.unwrap(),
1486            extra_data: Some(extra_data),
1487        }
1488    }
1489}
1490
1491pub mod review_view_state {
1492
1493    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1494    #[allow(unused)]
1495    use ::core::marker::PhantomData;
1496    mod sealed {
1497        pub trait Sealed {}
1498    }
1499    /// State trait tracking which required fields have been set
1500    pub trait State: sealed::Sealed {
1501        type CreatedAt;
1502        type ReviewedBy;
1503        type Status;
1504        type Uri;
1505    }
1506    /// Empty state - all required fields are unset
1507    pub struct Empty(());
1508    impl sealed::Sealed for Empty {}
1509    impl State for Empty {
1510        type CreatedAt = Unset;
1511        type ReviewedBy = Unset;
1512        type Status = Unset;
1513        type Uri = Unset;
1514    }
1515    ///State transition - sets the `created_at` field to Set
1516    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
1517    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
1518    impl<St: State> State for SetCreatedAt<St> {
1519        type CreatedAt = Set<members::created_at>;
1520        type ReviewedBy = St::ReviewedBy;
1521        type Status = St::Status;
1522        type Uri = St::Uri;
1523    }
1524    ///State transition - sets the `reviewed_by` field to Set
1525    pub struct SetReviewedBy<St: State = Empty>(PhantomData<fn() -> St>);
1526    impl<St: State> sealed::Sealed for SetReviewedBy<St> {}
1527    impl<St: State> State for SetReviewedBy<St> {
1528        type CreatedAt = St::CreatedAt;
1529        type ReviewedBy = Set<members::reviewed_by>;
1530        type Status = St::Status;
1531        type Uri = St::Uri;
1532    }
1533    ///State transition - sets the `status` field to Set
1534    pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
1535    impl<St: State> sealed::Sealed for SetStatus<St> {}
1536    impl<St: State> State for SetStatus<St> {
1537        type CreatedAt = St::CreatedAt;
1538        type ReviewedBy = St::ReviewedBy;
1539        type Status = Set<members::status>;
1540        type Uri = St::Uri;
1541    }
1542    ///State transition - sets the `uri` field to Set
1543    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1544    impl<St: State> sealed::Sealed for SetUri<St> {}
1545    impl<St: State> State for SetUri<St> {
1546        type CreatedAt = St::CreatedAt;
1547        type ReviewedBy = St::ReviewedBy;
1548        type Status = St::Status;
1549        type Uri = Set<members::uri>;
1550    }
1551    /// Marker types for field names
1552    #[allow(non_camel_case_types)]
1553    pub mod members {
1554        ///Marker type for the `created_at` field
1555        pub struct created_at(());
1556        ///Marker type for the `reviewed_by` field
1557        pub struct reviewed_by(());
1558        ///Marker type for the `status` field
1559        pub struct status(());
1560        ///Marker type for the `uri` field
1561        pub struct uri(());
1562    }
1563}
1564
1565/// Builder for constructing an instance of this type.
1566pub struct ReviewViewBuilder<St: review_view_state::State, S: BosStr = DefaultStr> {
1567    _state: PhantomData<fn() -> St>,
1568    _fields: (
1569        Option<Datetime>,
1570        Option<S>,
1571        Option<Did<S>>,
1572        Option<ReviewViewStatus<S>>,
1573        Option<AtUri<S>>,
1574    ),
1575    _type: PhantomData<fn() -> S>,
1576}
1577
1578impl ReviewView<DefaultStr> {
1579    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1580    pub fn new() -> ReviewViewBuilder<review_view_state::Empty, DefaultStr> {
1581        ReviewViewBuilder::new()
1582    }
1583}
1584
1585impl<S: BosStr> ReviewView<S> {
1586    /// Create a new builder for this type
1587    pub fn builder() -> ReviewViewBuilder<review_view_state::Empty, S> {
1588        ReviewViewBuilder::builder()
1589    }
1590}
1591
1592impl ReviewViewBuilder<review_view_state::Empty, DefaultStr> {
1593    /// Create a new builder with all fields unset, using the default string type, if needed
1594    pub fn new() -> Self {
1595        ReviewViewBuilder {
1596            _state: PhantomData,
1597            _fields: (None, None, None, None, None),
1598            _type: PhantomData,
1599        }
1600    }
1601}
1602
1603impl<S: BosStr> ReviewViewBuilder<review_view_state::Empty, S> {
1604    /// Create a new builder with all fields unset
1605    pub fn builder() -> Self {
1606        ReviewViewBuilder {
1607            _state: PhantomData,
1608            _fields: (None, None, None, None, None),
1609            _type: PhantomData,
1610        }
1611    }
1612}
1613
1614impl<St, S: BosStr> ReviewViewBuilder<St, S>
1615where
1616    St: review_view_state::State,
1617    St::CreatedAt: review_view_state::IsUnset,
1618{
1619    /// Set the `createdAt` field (required)
1620    pub fn created_at(
1621        mut self,
1622        value: impl Into<Datetime>,
1623    ) -> ReviewViewBuilder<review_view_state::SetCreatedAt<St>, S> {
1624        self._fields.0 = Option::Some(value.into());
1625        ReviewViewBuilder {
1626            _state: PhantomData,
1627            _fields: self._fields,
1628            _type: PhantomData,
1629        }
1630    }
1631}
1632
1633impl<St: review_view_state::State, S: BosStr> ReviewViewBuilder<St, S> {
1634    /// Set the `reason` field (optional)
1635    pub fn reason(mut self, value: impl Into<Option<S>>) -> Self {
1636        self._fields.1 = value.into();
1637        self
1638    }
1639    /// Set the `reason` field to an Option value (optional)
1640    pub fn maybe_reason(mut self, value: Option<S>) -> Self {
1641        self._fields.1 = value;
1642        self
1643    }
1644}
1645
1646impl<St, S: BosStr> ReviewViewBuilder<St, S>
1647where
1648    St: review_view_state::State,
1649    St::ReviewedBy: review_view_state::IsUnset,
1650{
1651    /// Set the `reviewedBy` field (required)
1652    pub fn reviewed_by(
1653        mut self,
1654        value: impl Into<Did<S>>,
1655    ) -> ReviewViewBuilder<review_view_state::SetReviewedBy<St>, S> {
1656        self._fields.2 = Option::Some(value.into());
1657        ReviewViewBuilder {
1658            _state: PhantomData,
1659            _fields: self._fields,
1660            _type: PhantomData,
1661        }
1662    }
1663}
1664
1665impl<St, S: BosStr> ReviewViewBuilder<St, S>
1666where
1667    St: review_view_state::State,
1668    St::Status: review_view_state::IsUnset,
1669{
1670    /// Set the `status` field (required)
1671    pub fn status(
1672        mut self,
1673        value: impl Into<ReviewViewStatus<S>>,
1674    ) -> ReviewViewBuilder<review_view_state::SetStatus<St>, S> {
1675        self._fields.3 = Option::Some(value.into());
1676        ReviewViewBuilder {
1677            _state: PhantomData,
1678            _fields: self._fields,
1679            _type: PhantomData,
1680        }
1681    }
1682}
1683
1684impl<St, S: BosStr> ReviewViewBuilder<St, S>
1685where
1686    St: review_view_state::State,
1687    St::Uri: review_view_state::IsUnset,
1688{
1689    /// Set the `uri` field (required)
1690    pub fn uri(
1691        mut self,
1692        value: impl Into<AtUri<S>>,
1693    ) -> ReviewViewBuilder<review_view_state::SetUri<St>, S> {
1694        self._fields.4 = Option::Some(value.into());
1695        ReviewViewBuilder {
1696            _state: PhantomData,
1697            _fields: self._fields,
1698            _type: PhantomData,
1699        }
1700    }
1701}
1702
1703impl<St, S: BosStr> ReviewViewBuilder<St, S>
1704where
1705    St: review_view_state::State,
1706    St::CreatedAt: review_view_state::IsSet,
1707    St::ReviewedBy: review_view_state::IsSet,
1708    St::Status: review_view_state::IsSet,
1709    St::Uri: review_view_state::IsSet,
1710{
1711    /// Build the final struct.
1712    pub fn build(self) -> ReviewView<S> {
1713        ReviewView {
1714            created_at: self._fields.0.unwrap(),
1715            reason: self._fields.1,
1716            reviewed_by: self._fields.2.unwrap(),
1717            status: self._fields.3.unwrap(),
1718            uri: self._fields.4.unwrap(),
1719            extra_data: Default::default(),
1720        }
1721    }
1722    /// Build the final struct with custom extra_data.
1723    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReviewView<S> {
1724        ReviewView {
1725            created_at: self._fields.0.unwrap(),
1726            reason: self._fields.1,
1727            reviewed_by: self._fields.2.unwrap(),
1728            status: self._fields.3.unwrap(),
1729            uri: self._fields.4.unwrap(),
1730            extra_data: Some(extra_data),
1731        }
1732    }
1733}
1734
1735pub mod verification_view_state {
1736
1737    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
1738    #[allow(unused)]
1739    use ::core::marker::PhantomData;
1740    mod sealed {
1741        pub trait Sealed {}
1742    }
1743    /// State trait tracking which required fields have been set
1744    pub trait State: sealed::Sealed {
1745        type AcceptedBy;
1746        type Contributor;
1747        type CreatedAt;
1748        type Uri;
1749    }
1750    /// Empty state - all required fields are unset
1751    pub struct Empty(());
1752    impl sealed::Sealed for Empty {}
1753    impl State for Empty {
1754        type AcceptedBy = Unset;
1755        type Contributor = Unset;
1756        type CreatedAt = Unset;
1757        type Uri = Unset;
1758    }
1759    ///State transition - sets the `accepted_by` field to Set
1760    pub struct SetAcceptedBy<St: State = Empty>(PhantomData<fn() -> St>);
1761    impl<St: State> sealed::Sealed for SetAcceptedBy<St> {}
1762    impl<St: State> State for SetAcceptedBy<St> {
1763        type AcceptedBy = Set<members::accepted_by>;
1764        type Contributor = St::Contributor;
1765        type CreatedAt = St::CreatedAt;
1766        type Uri = St::Uri;
1767    }
1768    ///State transition - sets the `contributor` field to Set
1769    pub struct SetContributor<St: State = Empty>(PhantomData<fn() -> St>);
1770    impl<St: State> sealed::Sealed for SetContributor<St> {}
1771    impl<St: State> State for SetContributor<St> {
1772        type AcceptedBy = St::AcceptedBy;
1773        type Contributor = Set<members::contributor>;
1774        type CreatedAt = St::CreatedAt;
1775        type Uri = St::Uri;
1776    }
1777    ///State transition - sets the `created_at` field to Set
1778    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
1779    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
1780    impl<St: State> State for SetCreatedAt<St> {
1781        type AcceptedBy = St::AcceptedBy;
1782        type Contributor = St::Contributor;
1783        type CreatedAt = Set<members::created_at>;
1784        type Uri = St::Uri;
1785    }
1786    ///State transition - sets the `uri` field to Set
1787    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
1788    impl<St: State> sealed::Sealed for SetUri<St> {}
1789    impl<St: State> State for SetUri<St> {
1790        type AcceptedBy = St::AcceptedBy;
1791        type Contributor = St::Contributor;
1792        type CreatedAt = St::CreatedAt;
1793        type Uri = Set<members::uri>;
1794    }
1795    /// Marker types for field names
1796    #[allow(non_camel_case_types)]
1797    pub mod members {
1798        ///Marker type for the `accepted_by` field
1799        pub struct accepted_by(());
1800        ///Marker type for the `contributor` field
1801        pub struct contributor(());
1802        ///Marker type for the `created_at` field
1803        pub struct created_at(());
1804        ///Marker type for the `uri` field
1805        pub struct uri(());
1806    }
1807}
1808
1809/// Builder for constructing an instance of this type.
1810pub struct VerificationViewBuilder<St: verification_view_state::State, S: BosStr = DefaultStr> {
1811    _state: PhantomData<fn() -> St>,
1812    _fields: (
1813        Option<VerificationViewAcceptedBy<S>>,
1814        Option<Did<S>>,
1815        Option<Datetime>,
1816        Option<AtUri<S>>,
1817    ),
1818    _type: PhantomData<fn() -> S>,
1819}
1820
1821impl VerificationView<DefaultStr> {
1822    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
1823    pub fn new() -> VerificationViewBuilder<verification_view_state::Empty, DefaultStr> {
1824        VerificationViewBuilder::new()
1825    }
1826}
1827
1828impl<S: BosStr> VerificationView<S> {
1829    /// Create a new builder for this type
1830    pub fn builder() -> VerificationViewBuilder<verification_view_state::Empty, S> {
1831        VerificationViewBuilder::builder()
1832    }
1833}
1834
1835impl VerificationViewBuilder<verification_view_state::Empty, DefaultStr> {
1836    /// Create a new builder with all fields unset, using the default string type, if needed
1837    pub fn new() -> Self {
1838        VerificationViewBuilder {
1839            _state: PhantomData,
1840            _fields: (None, None, None, None),
1841            _type: PhantomData,
1842        }
1843    }
1844}
1845
1846impl<S: BosStr> VerificationViewBuilder<verification_view_state::Empty, S> {
1847    /// Create a new builder with all fields unset
1848    pub fn builder() -> Self {
1849        VerificationViewBuilder {
1850            _state: PhantomData,
1851            _fields: (None, None, None, None),
1852            _type: PhantomData,
1853        }
1854    }
1855}
1856
1857impl<St, S: BosStr> VerificationViewBuilder<St, S>
1858where
1859    St: verification_view_state::State,
1860    St::AcceptedBy: verification_view_state::IsUnset,
1861{
1862    /// Set the `acceptedBy` field (required)
1863    pub fn accepted_by(
1864        mut self,
1865        value: impl Into<VerificationViewAcceptedBy<S>>,
1866    ) -> VerificationViewBuilder<verification_view_state::SetAcceptedBy<St>, S> {
1867        self._fields.0 = Option::Some(value.into());
1868        VerificationViewBuilder {
1869            _state: PhantomData,
1870            _fields: self._fields,
1871            _type: PhantomData,
1872        }
1873    }
1874}
1875
1876impl<St, S: BosStr> VerificationViewBuilder<St, S>
1877where
1878    St: verification_view_state::State,
1879    St::Contributor: verification_view_state::IsUnset,
1880{
1881    /// Set the `contributor` field (required)
1882    pub fn contributor(
1883        mut self,
1884        value: impl Into<Did<S>>,
1885    ) -> VerificationViewBuilder<verification_view_state::SetContributor<St>, S> {
1886        self._fields.1 = Option::Some(value.into());
1887        VerificationViewBuilder {
1888            _state: PhantomData,
1889            _fields: self._fields,
1890            _type: PhantomData,
1891        }
1892    }
1893}
1894
1895impl<St, S: BosStr> VerificationViewBuilder<St, S>
1896where
1897    St: verification_view_state::State,
1898    St::CreatedAt: verification_view_state::IsUnset,
1899{
1900    /// Set the `createdAt` field (required)
1901    pub fn created_at(
1902        mut self,
1903        value: impl Into<Datetime>,
1904    ) -> VerificationViewBuilder<verification_view_state::SetCreatedAt<St>, S> {
1905        self._fields.2 = Option::Some(value.into());
1906        VerificationViewBuilder {
1907            _state: PhantomData,
1908            _fields: self._fields,
1909            _type: PhantomData,
1910        }
1911    }
1912}
1913
1914impl<St, S: BosStr> VerificationViewBuilder<St, S>
1915where
1916    St: verification_view_state::State,
1917    St::Uri: verification_view_state::IsUnset,
1918{
1919    /// Set the `uri` field (required)
1920    pub fn uri(
1921        mut self,
1922        value: impl Into<AtUri<S>>,
1923    ) -> VerificationViewBuilder<verification_view_state::SetUri<St>, S> {
1924        self._fields.3 = Option::Some(value.into());
1925        VerificationViewBuilder {
1926            _state: PhantomData,
1927            _fields: self._fields,
1928            _type: PhantomData,
1929        }
1930    }
1931}
1932
1933impl<St, S: BosStr> VerificationViewBuilder<St, S>
1934where
1935    St: verification_view_state::State,
1936    St::AcceptedBy: verification_view_state::IsSet,
1937    St::Contributor: verification_view_state::IsSet,
1938    St::CreatedAt: verification_view_state::IsSet,
1939    St::Uri: verification_view_state::IsSet,
1940{
1941    /// Build the final struct.
1942    pub fn build(self) -> VerificationView<S> {
1943        VerificationView {
1944            accepted_by: self._fields.0.unwrap(),
1945            contributor: self._fields.1.unwrap(),
1946            created_at: self._fields.2.unwrap(),
1947            uri: self._fields.3.unwrap(),
1948            extra_data: Default::default(),
1949        }
1950    }
1951    /// Build the final struct with custom extra_data.
1952    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> VerificationView<S> {
1953        VerificationView {
1954            accepted_by: self._fields.0.unwrap(),
1955            contributor: self._fields.1.unwrap(),
1956            created_at: self._fields.2.unwrap(),
1957            uri: self._fields.3.unwrap(),
1958            extra_data: Some(extra_data),
1959        }
1960    }
1961}