Skip to main content

jacquard_api/sh_weaver/
collab.rs

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