Skip to main content

jacquard_api/sh_weaver/
edit.rs

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