jacquard_api/sh_weaver/edit/
cursor.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.edit.cursor
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10    serde::Serialize,
11    serde::Deserialize,
12    Debug,
13    Clone,
14    PartialEq,
15    Eq,
16    jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct ContainerId<'a> {
20    #[serde(borrow)]
21    pub value: ContainerIdValue<'a>,
22}
23
24pub mod container_id_state {
25
26    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
27    #[allow(unused)]
28    use ::core::marker::PhantomData;
29    mod sealed {
30        pub trait Sealed {}
31    }
32    /// State trait tracking which required fields have been set
33    pub trait State: sealed::Sealed {
34        type Value;
35    }
36    /// Empty state - all required fields are unset
37    pub struct Empty(());
38    impl sealed::Sealed for Empty {}
39    impl State for Empty {
40        type Value = Unset;
41    }
42    ///State transition - sets the `value` field to Set
43    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
44    impl<S: State> sealed::Sealed for SetValue<S> {}
45    impl<S: State> State for SetValue<S> {
46        type Value = Set<members::value>;
47    }
48    /// Marker types for field names
49    #[allow(non_camel_case_types)]
50    pub mod members {
51        ///Marker type for the `value` field
52        pub struct value(());
53    }
54}
55
56/// Builder for constructing an instance of this type
57pub struct ContainerIdBuilder<'a, S: container_id_state::State> {
58    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
59    __unsafe_private_named: (::core::option::Option<ContainerIdValue<'a>>,),
60    _phantom: ::core::marker::PhantomData<&'a ()>,
61}
62
63impl<'a> ContainerId<'a> {
64    /// Create a new builder for this type
65    pub fn new() -> ContainerIdBuilder<'a, container_id_state::Empty> {
66        ContainerIdBuilder::new()
67    }
68}
69
70impl<'a> ContainerIdBuilder<'a, container_id_state::Empty> {
71    /// Create a new builder with all fields unset
72    pub fn new() -> Self {
73        ContainerIdBuilder {
74            _phantom_state: ::core::marker::PhantomData,
75            __unsafe_private_named: (None,),
76            _phantom: ::core::marker::PhantomData,
77        }
78    }
79}
80
81impl<'a, S> ContainerIdBuilder<'a, S>
82where
83    S: container_id_state::State,
84    S::Value: container_id_state::IsUnset,
85{
86    /// Set the `value` field (required)
87    pub fn value(
88        mut self,
89        value: impl Into<ContainerIdValue<'a>>,
90    ) -> ContainerIdBuilder<'a, container_id_state::SetValue<S>> {
91        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
92        ContainerIdBuilder {
93            _phantom_state: ::core::marker::PhantomData,
94            __unsafe_private_named: self.__unsafe_private_named,
95            _phantom: ::core::marker::PhantomData,
96        }
97    }
98}
99
100impl<'a, S> ContainerIdBuilder<'a, S>
101where
102    S: container_id_state::State,
103    S::Value: container_id_state::IsSet,
104{
105    /// Build the final struct
106    pub fn build(self) -> ContainerId<'a> {
107        ContainerId {
108            value: self.__unsafe_private_named.0.unwrap(),
109            extra_data: Default::default(),
110        }
111    }
112    /// Build the final struct with custom extra_data
113    pub fn build_with_data(
114        self,
115        extra_data: std::collections::BTreeMap<
116            jacquard_common::smol_str::SmolStr,
117            jacquard_common::types::value::Data<'a>,
118        >,
119    ) -> ContainerId<'a> {
120        ContainerId {
121            value: self.__unsafe_private_named.0.unwrap(),
122            extra_data: Some(extra_data),
123        }
124    }
125}
126
127#[jacquard_derive::open_union]
128#[derive(
129    serde::Serialize,
130    serde::Deserialize,
131    Debug,
132    Clone,
133    PartialEq,
134    Eq,
135    jacquard_derive::IntoStatic
136)]
137#[serde(tag = "$type")]
138#[serde(bound(deserialize = "'de: 'a"))]
139pub enum ContainerIdValue<'a> {
140    #[serde(rename = "sh.weaver.edit.cursor#normalContainerId")]
141    NormalContainerId(Box<crate::sh_weaver::edit::cursor::NormalContainerId<'a>>),
142    #[serde(rename = "sh.weaver.edit.cursor#rootContainerId")]
143    RootContainerId(Box<crate::sh_weaver::edit::cursor::RootContainerId<'a>>),
144}
145
146fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDoc<
147    'static,
148> {
149    ::jacquard_lexicon::lexicon::LexiconDoc {
150        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
151        id: ::jacquard_common::CowStr::new_static("sh.weaver.edit.cursor"),
152        revision: None,
153        description: None,
154        defs: {
155            let mut map = ::std::collections::BTreeMap::new();
156            map.insert(
157                ::jacquard_common::smol_str::SmolStr::new_static("containerId"),
158                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
159                    description: None,
160                    required: Some(
161                        vec![::jacquard_common::smol_str::SmolStr::new_static("value")],
162                    ),
163                    nullable: None,
164                    properties: {
165                        #[allow(unused_mut)]
166                        let mut map = ::std::collections::BTreeMap::new();
167                        map.insert(
168                            ::jacquard_common::smol_str::SmolStr::new_static("value"),
169                            ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
170                                description: None,
171                                refs: vec![
172                                    ::jacquard_common::CowStr::new_static("#normalContainerId"),
173                                    ::jacquard_common::CowStr::new_static("#rootContainerId")
174                                ],
175                                closed: None,
176                            }),
177                        );
178                        map
179                    },
180                }),
181            );
182            map.insert(
183                ::jacquard_common::smol_str::SmolStr::new_static("cursorSide"),
184                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
185                    description: None,
186                    required: Some(
187                        vec![::jacquard_common::smol_str::SmolStr::new_static("value")],
188                    ),
189                    nullable: None,
190                    properties: {
191                        #[allow(unused_mut)]
192                        let mut map = ::std::collections::BTreeMap::new();
193                        map.insert(
194                            ::jacquard_common::smol_str::SmolStr::new_static("value"),
195                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
196                                description: None,
197                                default: None,
198                                minimum: None,
199                                maximum: None,
200                                r#enum: None,
201                                r#const: None,
202                            }),
203                        );
204                        map
205                    },
206                }),
207            );
208            map.insert(
209                ::jacquard_common::smol_str::SmolStr::new_static("id"),
210                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
211                    description: None,
212                    required: Some(
213                        vec![
214                            ::jacquard_common::smol_str::SmolStr::new_static("peer"),
215                            ::jacquard_common::smol_str::SmolStr::new_static("counter")
216                        ],
217                    ),
218                    nullable: None,
219                    properties: {
220                        #[allow(unused_mut)]
221                        let mut map = ::std::collections::BTreeMap::new();
222                        map.insert(
223                            ::jacquard_common::smol_str::SmolStr::new_static("counter"),
224                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
225                                description: None,
226                                default: None,
227                                minimum: None,
228                                maximum: None,
229                                r#enum: None,
230                                r#const: None,
231                            }),
232                        );
233                        map.insert(
234                            ::jacquard_common::smol_str::SmolStr::new_static("peer"),
235                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
236                                description: None,
237                                default: None,
238                                minimum: None,
239                                maximum: None,
240                                r#enum: None,
241                                r#const: None,
242                            }),
243                        );
244                        map
245                    },
246                }),
247            );
248            map.insert(
249                ::jacquard_common::smol_str::SmolStr::new_static("main"),
250                ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
251                    description: Some(
252                        ::jacquard_common::CowStr::new_static(
253                            "An edit record for a notebook.",
254                        ),
255                    ),
256                    key: Some(::jacquard_common::CowStr::new_static("tid")),
257                    record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
258                        description: None,
259                        required: Some(
260                            vec![
261                                ::jacquard_common::smol_str::SmolStr::new_static("container"),
262                                ::jacquard_common::smol_str::SmolStr::new_static("id")
263                            ],
264                        ),
265                        nullable: None,
266                        properties: {
267                            #[allow(unused_mut)]
268                            let mut map = ::std::collections::BTreeMap::new();
269                            map.insert(
270                                ::jacquard_common::smol_str::SmolStr::new_static(
271                                    "container",
272                                ),
273                                ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
274                                    description: None,
275                                    r#ref: ::jacquard_common::CowStr::new_static("#containerId"),
276                                }),
277                            );
278                            map.insert(
279                                ::jacquard_common::smol_str::SmolStr::new_static("id"),
280                                ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
281                                    description: None,
282                                    r#ref: ::jacquard_common::CowStr::new_static("#id"),
283                                }),
284                            );
285                            map.insert(
286                                ::jacquard_common::smol_str::SmolStr::new_static("side"),
287                                ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
288                                    description: None,
289                                    r#ref: ::jacquard_common::CowStr::new_static("#cursorSide"),
290                                }),
291                            );
292                            map
293                        },
294                    }),
295                }),
296            );
297            map.insert(
298                ::jacquard_common::smol_str::SmolStr::new_static("normalContainerId"),
299                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
300                    description: None,
301                    required: Some(
302                        vec![
303                            ::jacquard_common::smol_str::SmolStr::new_static("peer"),
304                            ::jacquard_common::smol_str::SmolStr::new_static("counter"),
305                            ::jacquard_common::smol_str::SmolStr::new_static("container_type")
306                        ],
307                    ),
308                    nullable: None,
309                    properties: {
310                        #[allow(unused_mut)]
311                        let mut map = ::std::collections::BTreeMap::new();
312                        map.insert(
313                            ::jacquard_common::smol_str::SmolStr::new_static(
314                                "container_type",
315                            ),
316                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
317                                description: None,
318                                format: None,
319                                default: None,
320                                min_length: None,
321                                max_length: None,
322                                min_graphemes: None,
323                                max_graphemes: None,
324                                r#enum: None,
325                                r#const: None,
326                                known_values: None,
327                            }),
328                        );
329                        map.insert(
330                            ::jacquard_common::smol_str::SmolStr::new_static("counter"),
331                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
332                                description: None,
333                                default: None,
334                                minimum: None,
335                                maximum: None,
336                                r#enum: None,
337                                r#const: None,
338                            }),
339                        );
340                        map.insert(
341                            ::jacquard_common::smol_str::SmolStr::new_static("peer"),
342                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
343                                description: None,
344                                default: None,
345                                minimum: None,
346                                maximum: None,
347                                r#enum: None,
348                                r#const: None,
349                            }),
350                        );
351                        map
352                    },
353                }),
354            );
355            map.insert(
356                ::jacquard_common::smol_str::SmolStr::new_static("rootContainerId"),
357                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
358                    description: None,
359                    required: Some(
360                        vec![
361                            ::jacquard_common::smol_str::SmolStr::new_static("name"),
362                            ::jacquard_common::smol_str::SmolStr::new_static("container_type")
363                        ],
364                    ),
365                    nullable: None,
366                    properties: {
367                        #[allow(unused_mut)]
368                        let mut map = ::std::collections::BTreeMap::new();
369                        map.insert(
370                            ::jacquard_common::smol_str::SmolStr::new_static(
371                                "container_type",
372                            ),
373                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
374                                description: None,
375                                format: None,
376                                default: None,
377                                min_length: None,
378                                max_length: None,
379                                min_graphemes: None,
380                                max_graphemes: None,
381                                r#enum: None,
382                                r#const: None,
383                                known_values: None,
384                            }),
385                        );
386                        map.insert(
387                            ::jacquard_common::smol_str::SmolStr::new_static("name"),
388                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
389                                description: None,
390                                format: None,
391                                default: None,
392                                min_length: None,
393                                max_length: None,
394                                min_graphemes: None,
395                                max_graphemes: None,
396                                r#enum: None,
397                                r#const: None,
398                                known_values: None,
399                            }),
400                        );
401                        map
402                    },
403                }),
404            );
405            map
406        },
407    }
408}
409
410impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContainerId<'a> {
411    fn nsid() -> &'static str {
412        "sh.weaver.edit.cursor"
413    }
414    fn def_name() -> &'static str {
415        "containerId"
416    }
417    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
418        lexicon_doc_sh_weaver_edit_cursor()
419    }
420    fn validate(
421        &self,
422    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
423        Ok(())
424    }
425}
426
427#[jacquard_derive::lexicon]
428#[derive(
429    serde::Serialize,
430    serde::Deserialize,
431    Debug,
432    Clone,
433    PartialEq,
434    Eq,
435    jacquard_derive::IntoStatic
436)]
437#[serde(rename_all = "camelCase")]
438pub struct CursorSide<'a> {
439    /// The side of an item the cursor is on (left = -1, right = 1, middle = 0)
440    pub value: i64,
441}
442
443pub mod cursor_side_state {
444
445    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
446    #[allow(unused)]
447    use ::core::marker::PhantomData;
448    mod sealed {
449        pub trait Sealed {}
450    }
451    /// State trait tracking which required fields have been set
452    pub trait State: sealed::Sealed {
453        type Value;
454    }
455    /// Empty state - all required fields are unset
456    pub struct Empty(());
457    impl sealed::Sealed for Empty {}
458    impl State for Empty {
459        type Value = Unset;
460    }
461    ///State transition - sets the `value` field to Set
462    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
463    impl<S: State> sealed::Sealed for SetValue<S> {}
464    impl<S: State> State for SetValue<S> {
465        type Value = Set<members::value>;
466    }
467    /// Marker types for field names
468    #[allow(non_camel_case_types)]
469    pub mod members {
470        ///Marker type for the `value` field
471        pub struct value(());
472    }
473}
474
475/// Builder for constructing an instance of this type
476pub struct CursorSideBuilder<'a, S: cursor_side_state::State> {
477    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
478    __unsafe_private_named: (::core::option::Option<i64>,),
479    _phantom: ::core::marker::PhantomData<&'a ()>,
480}
481
482impl<'a> CursorSide<'a> {
483    /// Create a new builder for this type
484    pub fn new() -> CursorSideBuilder<'a, cursor_side_state::Empty> {
485        CursorSideBuilder::new()
486    }
487}
488
489impl<'a> CursorSideBuilder<'a, cursor_side_state::Empty> {
490    /// Create a new builder with all fields unset
491    pub fn new() -> Self {
492        CursorSideBuilder {
493            _phantom_state: ::core::marker::PhantomData,
494            __unsafe_private_named: (None,),
495            _phantom: ::core::marker::PhantomData,
496        }
497    }
498}
499
500impl<'a, S> CursorSideBuilder<'a, S>
501where
502    S: cursor_side_state::State,
503    S::Value: cursor_side_state::IsUnset,
504{
505    /// Set the `value` field (required)
506    pub fn value(
507        mut self,
508        value: impl Into<i64>,
509    ) -> CursorSideBuilder<'a, cursor_side_state::SetValue<S>> {
510        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
511        CursorSideBuilder {
512            _phantom_state: ::core::marker::PhantomData,
513            __unsafe_private_named: self.__unsafe_private_named,
514            _phantom: ::core::marker::PhantomData,
515        }
516    }
517}
518
519impl<'a, S> CursorSideBuilder<'a, S>
520where
521    S: cursor_side_state::State,
522    S::Value: cursor_side_state::IsSet,
523{
524    /// Build the final struct
525    pub fn build(self) -> CursorSide<'a> {
526        CursorSide {
527            value: self.__unsafe_private_named.0.unwrap(),
528            extra_data: Default::default(),
529        }
530    }
531    /// Build the final struct with custom extra_data
532    pub fn build_with_data(
533        self,
534        extra_data: std::collections::BTreeMap<
535            jacquard_common::smol_str::SmolStr,
536            jacquard_common::types::value::Data<'a>,
537        >,
538    ) -> CursorSide<'a> {
539        CursorSide {
540            value: self.__unsafe_private_named.0.unwrap(),
541            extra_data: Some(extra_data),
542        }
543    }
544}
545
546impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CursorSide<'a> {
547    fn nsid() -> &'static str {
548        "sh.weaver.edit.cursor"
549    }
550    fn def_name() -> &'static str {
551        "cursorSide"
552    }
553    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
554        lexicon_doc_sh_weaver_edit_cursor()
555    }
556    fn validate(
557        &self,
558    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
559        Ok(())
560    }
561}
562
563#[jacquard_derive::lexicon]
564#[derive(
565    serde::Serialize,
566    serde::Deserialize,
567    Debug,
568    Clone,
569    PartialEq,
570    Eq,
571    jacquard_derive::IntoStatic
572)]
573#[serde(rename_all = "camelCase")]
574pub struct Id<'a> {
575    pub counter: i64,
576    pub peer: i64,
577}
578
579pub mod id_state {
580
581    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
582    #[allow(unused)]
583    use ::core::marker::PhantomData;
584    mod sealed {
585        pub trait Sealed {}
586    }
587    /// State trait tracking which required fields have been set
588    pub trait State: sealed::Sealed {
589        type Peer;
590        type Counter;
591    }
592    /// Empty state - all required fields are unset
593    pub struct Empty(());
594    impl sealed::Sealed for Empty {}
595    impl State for Empty {
596        type Peer = Unset;
597        type Counter = Unset;
598    }
599    ///State transition - sets the `peer` field to Set
600    pub struct SetPeer<S: State = Empty>(PhantomData<fn() -> S>);
601    impl<S: State> sealed::Sealed for SetPeer<S> {}
602    impl<S: State> State for SetPeer<S> {
603        type Peer = Set<members::peer>;
604        type Counter = S::Counter;
605    }
606    ///State transition - sets the `counter` field to Set
607    pub struct SetCounter<S: State = Empty>(PhantomData<fn() -> S>);
608    impl<S: State> sealed::Sealed for SetCounter<S> {}
609    impl<S: State> State for SetCounter<S> {
610        type Peer = S::Peer;
611        type Counter = Set<members::counter>;
612    }
613    /// Marker types for field names
614    #[allow(non_camel_case_types)]
615    pub mod members {
616        ///Marker type for the `peer` field
617        pub struct peer(());
618        ///Marker type for the `counter` field
619        pub struct counter(());
620    }
621}
622
623/// Builder for constructing an instance of this type
624pub struct IdBuilder<'a, S: id_state::State> {
625    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
626    __unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>),
627    _phantom: ::core::marker::PhantomData<&'a ()>,
628}
629
630impl<'a> Id<'a> {
631    /// Create a new builder for this type
632    pub fn new() -> IdBuilder<'a, id_state::Empty> {
633        IdBuilder::new()
634    }
635}
636
637impl<'a> IdBuilder<'a, id_state::Empty> {
638    /// Create a new builder with all fields unset
639    pub fn new() -> Self {
640        IdBuilder {
641            _phantom_state: ::core::marker::PhantomData,
642            __unsafe_private_named: (None, None),
643            _phantom: ::core::marker::PhantomData,
644        }
645    }
646}
647
648impl<'a, S> IdBuilder<'a, S>
649where
650    S: id_state::State,
651    S::Counter: id_state::IsUnset,
652{
653    /// Set the `counter` field (required)
654    pub fn counter(
655        mut self,
656        value: impl Into<i64>,
657    ) -> IdBuilder<'a, id_state::SetCounter<S>> {
658        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
659        IdBuilder {
660            _phantom_state: ::core::marker::PhantomData,
661            __unsafe_private_named: self.__unsafe_private_named,
662            _phantom: ::core::marker::PhantomData,
663        }
664    }
665}
666
667impl<'a, S> IdBuilder<'a, S>
668where
669    S: id_state::State,
670    S::Peer: id_state::IsUnset,
671{
672    /// Set the `peer` field (required)
673    pub fn peer(mut self, value: impl Into<i64>) -> IdBuilder<'a, id_state::SetPeer<S>> {
674        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
675        IdBuilder {
676            _phantom_state: ::core::marker::PhantomData,
677            __unsafe_private_named: self.__unsafe_private_named,
678            _phantom: ::core::marker::PhantomData,
679        }
680    }
681}
682
683impl<'a, S> IdBuilder<'a, S>
684where
685    S: id_state::State,
686    S::Peer: id_state::IsSet,
687    S::Counter: id_state::IsSet,
688{
689    /// Build the final struct
690    pub fn build(self) -> Id<'a> {
691        Id {
692            counter: self.__unsafe_private_named.0.unwrap(),
693            peer: self.__unsafe_private_named.1.unwrap(),
694            extra_data: Default::default(),
695        }
696    }
697    /// Build the final struct with custom extra_data
698    pub fn build_with_data(
699        self,
700        extra_data: std::collections::BTreeMap<
701            jacquard_common::smol_str::SmolStr,
702            jacquard_common::types::value::Data<'a>,
703        >,
704    ) -> Id<'a> {
705        Id {
706            counter: self.__unsafe_private_named.0.unwrap(),
707            peer: self.__unsafe_private_named.1.unwrap(),
708            extra_data: Some(extra_data),
709        }
710    }
711}
712
713impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> {
714    fn nsid() -> &'static str {
715        "sh.weaver.edit.cursor"
716    }
717    fn def_name() -> &'static str {
718        "id"
719    }
720    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
721        lexicon_doc_sh_weaver_edit_cursor()
722    }
723    fn validate(
724        &self,
725    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
726        Ok(())
727    }
728}
729
730/// An edit record for a notebook.
731#[jacquard_derive::lexicon]
732#[derive(
733    serde::Serialize,
734    serde::Deserialize,
735    Debug,
736    Clone,
737    PartialEq,
738    Eq,
739    jacquard_derive::IntoStatic
740)]
741#[serde(rename_all = "camelCase")]
742pub struct Cursor<'a> {
743    #[serde(borrow)]
744    pub container: crate::sh_weaver::edit::cursor::ContainerId<'a>,
745    #[serde(borrow)]
746    pub id: crate::sh_weaver::edit::cursor::Id<'a>,
747    #[serde(skip_serializing_if = "std::option::Option::is_none")]
748    #[serde(borrow)]
749    pub side: Option<crate::sh_weaver::edit::cursor::CursorSide<'a>>,
750}
751
752pub mod cursor_state {
753
754    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
755    #[allow(unused)]
756    use ::core::marker::PhantomData;
757    mod sealed {
758        pub trait Sealed {}
759    }
760    /// State trait tracking which required fields have been set
761    pub trait State: sealed::Sealed {
762        type Container;
763        type Id;
764    }
765    /// Empty state - all required fields are unset
766    pub struct Empty(());
767    impl sealed::Sealed for Empty {}
768    impl State for Empty {
769        type Container = Unset;
770        type Id = Unset;
771    }
772    ///State transition - sets the `container` field to Set
773    pub struct SetContainer<S: State = Empty>(PhantomData<fn() -> S>);
774    impl<S: State> sealed::Sealed for SetContainer<S> {}
775    impl<S: State> State for SetContainer<S> {
776        type Container = Set<members::container>;
777        type Id = S::Id;
778    }
779    ///State transition - sets the `id` field to Set
780    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
781    impl<S: State> sealed::Sealed for SetId<S> {}
782    impl<S: State> State for SetId<S> {
783        type Container = S::Container;
784        type Id = Set<members::id>;
785    }
786    /// Marker types for field names
787    #[allow(non_camel_case_types)]
788    pub mod members {
789        ///Marker type for the `container` field
790        pub struct container(());
791        ///Marker type for the `id` field
792        pub struct id(());
793    }
794}
795
796/// Builder for constructing an instance of this type
797pub struct CursorBuilder<'a, S: cursor_state::State> {
798    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
799    __unsafe_private_named: (
800        ::core::option::Option<crate::sh_weaver::edit::cursor::ContainerId<'a>>,
801        ::core::option::Option<crate::sh_weaver::edit::cursor::Id<'a>>,
802        ::core::option::Option<crate::sh_weaver::edit::cursor::CursorSide<'a>>,
803    ),
804    _phantom: ::core::marker::PhantomData<&'a ()>,
805}
806
807impl<'a> Cursor<'a> {
808    /// Create a new builder for this type
809    pub fn new() -> CursorBuilder<'a, cursor_state::Empty> {
810        CursorBuilder::new()
811    }
812}
813
814impl<'a> CursorBuilder<'a, cursor_state::Empty> {
815    /// Create a new builder with all fields unset
816    pub fn new() -> Self {
817        CursorBuilder {
818            _phantom_state: ::core::marker::PhantomData,
819            __unsafe_private_named: (None, None, None),
820            _phantom: ::core::marker::PhantomData,
821        }
822    }
823}
824
825impl<'a, S> CursorBuilder<'a, S>
826where
827    S: cursor_state::State,
828    S::Container: cursor_state::IsUnset,
829{
830    /// Set the `container` field (required)
831    pub fn container(
832        mut self,
833        value: impl Into<crate::sh_weaver::edit::cursor::ContainerId<'a>>,
834    ) -> CursorBuilder<'a, cursor_state::SetContainer<S>> {
835        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
836        CursorBuilder {
837            _phantom_state: ::core::marker::PhantomData,
838            __unsafe_private_named: self.__unsafe_private_named,
839            _phantom: ::core::marker::PhantomData,
840        }
841    }
842}
843
844impl<'a, S> CursorBuilder<'a, S>
845where
846    S: cursor_state::State,
847    S::Id: cursor_state::IsUnset,
848{
849    /// Set the `id` field (required)
850    pub fn id(
851        mut self,
852        value: impl Into<crate::sh_weaver::edit::cursor::Id<'a>>,
853    ) -> CursorBuilder<'a, cursor_state::SetId<S>> {
854        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
855        CursorBuilder {
856            _phantom_state: ::core::marker::PhantomData,
857            __unsafe_private_named: self.__unsafe_private_named,
858            _phantom: ::core::marker::PhantomData,
859        }
860    }
861}
862
863impl<'a, S: cursor_state::State> CursorBuilder<'a, S> {
864    /// Set the `side` field (optional)
865    pub fn side(
866        mut self,
867        value: impl Into<Option<crate::sh_weaver::edit::cursor::CursorSide<'a>>>,
868    ) -> Self {
869        self.__unsafe_private_named.2 = value.into();
870        self
871    }
872    /// Set the `side` field to an Option value (optional)
873    pub fn maybe_side(
874        mut self,
875        value: Option<crate::sh_weaver::edit::cursor::CursorSide<'a>>,
876    ) -> Self {
877        self.__unsafe_private_named.2 = value;
878        self
879    }
880}
881
882impl<'a, S> CursorBuilder<'a, S>
883where
884    S: cursor_state::State,
885    S::Container: cursor_state::IsSet,
886    S::Id: cursor_state::IsSet,
887{
888    /// Build the final struct
889    pub fn build(self) -> Cursor<'a> {
890        Cursor {
891            container: self.__unsafe_private_named.0.unwrap(),
892            id: self.__unsafe_private_named.1.unwrap(),
893            side: self.__unsafe_private_named.2,
894            extra_data: Default::default(),
895        }
896    }
897    /// Build the final struct with custom extra_data
898    pub fn build_with_data(
899        self,
900        extra_data: std::collections::BTreeMap<
901            jacquard_common::smol_str::SmolStr,
902            jacquard_common::types::value::Data<'a>,
903        >,
904    ) -> Cursor<'a> {
905        Cursor {
906            container: self.__unsafe_private_named.0.unwrap(),
907            id: self.__unsafe_private_named.1.unwrap(),
908            side: self.__unsafe_private_named.2,
909            extra_data: Some(extra_data),
910        }
911    }
912}
913
914impl<'a> Cursor<'a> {
915    pub fn uri(
916        uri: impl Into<jacquard_common::CowStr<'a>>,
917    ) -> Result<
918        jacquard_common::types::uri::RecordUri<'a, CursorRecord>,
919        jacquard_common::types::uri::UriError,
920    > {
921        jacquard_common::types::uri::RecordUri::try_from_uri(
922            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
923        )
924    }
925}
926
927/// Typed wrapper for GetRecord response with this collection's record type.
928#[derive(
929    serde::Serialize,
930    serde::Deserialize,
931    Debug,
932    Clone,
933    PartialEq,
934    Eq,
935    jacquard_derive::IntoStatic
936)]
937#[serde(rename_all = "camelCase")]
938pub struct CursorGetRecordOutput<'a> {
939    #[serde(skip_serializing_if = "std::option::Option::is_none")]
940    #[serde(borrow)]
941    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
942    #[serde(borrow)]
943    pub uri: jacquard_common::types::string::AtUri<'a>,
944    #[serde(borrow)]
945    pub value: Cursor<'a>,
946}
947
948impl From<CursorGetRecordOutput<'_>> for Cursor<'_> {
949    fn from(output: CursorGetRecordOutput<'_>) -> Self {
950        use jacquard_common::IntoStatic;
951        output.value.into_static()
952    }
953}
954
955impl jacquard_common::types::collection::Collection for Cursor<'_> {
956    const NSID: &'static str = "sh.weaver.edit.cursor";
957    type Record = CursorRecord;
958}
959
960/// Marker type for deserializing records from this collection.
961#[derive(Debug, serde::Serialize, serde::Deserialize)]
962pub struct CursorRecord;
963impl jacquard_common::xrpc::XrpcResp for CursorRecord {
964    const NSID: &'static str = "sh.weaver.edit.cursor";
965    const ENCODING: &'static str = "application/json";
966    type Output<'de> = CursorGetRecordOutput<'de>;
967    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
968}
969
970impl jacquard_common::types::collection::Collection for CursorRecord {
971    const NSID: &'static str = "sh.weaver.edit.cursor";
972    type Record = CursorRecord;
973}
974
975impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Cursor<'a> {
976    fn nsid() -> &'static str {
977        "sh.weaver.edit.cursor"
978    }
979    fn def_name() -> &'static str {
980        "main"
981    }
982    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
983        lexicon_doc_sh_weaver_edit_cursor()
984    }
985    fn validate(
986        &self,
987    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
988        Ok(())
989    }
990}
991
992#[jacquard_derive::lexicon]
993#[derive(
994    serde::Serialize,
995    serde::Deserialize,
996    Debug,
997    Clone,
998    PartialEq,
999    Eq,
1000    jacquard_derive::IntoStatic
1001)]
1002#[serde(rename_all = "camelCase")]
1003pub struct NormalContainerId<'a> {
1004    #[serde(borrow)]
1005    pub container_type: jacquard_common::CowStr<'a>,
1006    pub counter: i64,
1007    pub peer: i64,
1008}
1009
1010pub mod normal_container_id_state {
1011
1012    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1013    #[allow(unused)]
1014    use ::core::marker::PhantomData;
1015    mod sealed {
1016        pub trait Sealed {}
1017    }
1018    /// State trait tracking which required fields have been set
1019    pub trait State: sealed::Sealed {
1020        type Peer;
1021        type Counter;
1022        type ContainerType;
1023    }
1024    /// Empty state - all required fields are unset
1025    pub struct Empty(());
1026    impl sealed::Sealed for Empty {}
1027    impl State for Empty {
1028        type Peer = Unset;
1029        type Counter = Unset;
1030        type ContainerType = Unset;
1031    }
1032    ///State transition - sets the `peer` field to Set
1033    pub struct SetPeer<S: State = Empty>(PhantomData<fn() -> S>);
1034    impl<S: State> sealed::Sealed for SetPeer<S> {}
1035    impl<S: State> State for SetPeer<S> {
1036        type Peer = Set<members::peer>;
1037        type Counter = S::Counter;
1038        type ContainerType = S::ContainerType;
1039    }
1040    ///State transition - sets the `counter` field to Set
1041    pub struct SetCounter<S: State = Empty>(PhantomData<fn() -> S>);
1042    impl<S: State> sealed::Sealed for SetCounter<S> {}
1043    impl<S: State> State for SetCounter<S> {
1044        type Peer = S::Peer;
1045        type Counter = Set<members::counter>;
1046        type ContainerType = S::ContainerType;
1047    }
1048    ///State transition - sets the `container_type` field to Set
1049    pub struct SetContainerType<S: State = Empty>(PhantomData<fn() -> S>);
1050    impl<S: State> sealed::Sealed for SetContainerType<S> {}
1051    impl<S: State> State for SetContainerType<S> {
1052        type Peer = S::Peer;
1053        type Counter = S::Counter;
1054        type ContainerType = Set<members::container_type>;
1055    }
1056    /// Marker types for field names
1057    #[allow(non_camel_case_types)]
1058    pub mod members {
1059        ///Marker type for the `peer` field
1060        pub struct peer(());
1061        ///Marker type for the `counter` field
1062        pub struct counter(());
1063        ///Marker type for the `container_type` field
1064        pub struct container_type(());
1065    }
1066}
1067
1068/// Builder for constructing an instance of this type
1069pub struct NormalContainerIdBuilder<'a, S: normal_container_id_state::State> {
1070    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1071    __unsafe_private_named: (
1072        ::core::option::Option<jacquard_common::CowStr<'a>>,
1073        ::core::option::Option<i64>,
1074        ::core::option::Option<i64>,
1075    ),
1076    _phantom: ::core::marker::PhantomData<&'a ()>,
1077}
1078
1079impl<'a> NormalContainerId<'a> {
1080    /// Create a new builder for this type
1081    pub fn new() -> NormalContainerIdBuilder<'a, normal_container_id_state::Empty> {
1082        NormalContainerIdBuilder::new()
1083    }
1084}
1085
1086impl<'a> NormalContainerIdBuilder<'a, normal_container_id_state::Empty> {
1087    /// Create a new builder with all fields unset
1088    pub fn new() -> Self {
1089        NormalContainerIdBuilder {
1090            _phantom_state: ::core::marker::PhantomData,
1091            __unsafe_private_named: (None, None, None),
1092            _phantom: ::core::marker::PhantomData,
1093        }
1094    }
1095}
1096
1097impl<'a, S> NormalContainerIdBuilder<'a, S>
1098where
1099    S: normal_container_id_state::State,
1100    S::ContainerType: normal_container_id_state::IsUnset,
1101{
1102    /// Set the `container_type` field (required)
1103    pub fn container_type(
1104        mut self,
1105        value: impl Into<jacquard_common::CowStr<'a>>,
1106    ) -> NormalContainerIdBuilder<'a, normal_container_id_state::SetContainerType<S>> {
1107        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1108        NormalContainerIdBuilder {
1109            _phantom_state: ::core::marker::PhantomData,
1110            __unsafe_private_named: self.__unsafe_private_named,
1111            _phantom: ::core::marker::PhantomData,
1112        }
1113    }
1114}
1115
1116impl<'a, S> NormalContainerIdBuilder<'a, S>
1117where
1118    S: normal_container_id_state::State,
1119    S::Counter: normal_container_id_state::IsUnset,
1120{
1121    /// Set the `counter` field (required)
1122    pub fn counter(
1123        mut self,
1124        value: impl Into<i64>,
1125    ) -> NormalContainerIdBuilder<'a, normal_container_id_state::SetCounter<S>> {
1126        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1127        NormalContainerIdBuilder {
1128            _phantom_state: ::core::marker::PhantomData,
1129            __unsafe_private_named: self.__unsafe_private_named,
1130            _phantom: ::core::marker::PhantomData,
1131        }
1132    }
1133}
1134
1135impl<'a, S> NormalContainerIdBuilder<'a, S>
1136where
1137    S: normal_container_id_state::State,
1138    S::Peer: normal_container_id_state::IsUnset,
1139{
1140    /// Set the `peer` field (required)
1141    pub fn peer(
1142        mut self,
1143        value: impl Into<i64>,
1144    ) -> NormalContainerIdBuilder<'a, normal_container_id_state::SetPeer<S>> {
1145        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
1146        NormalContainerIdBuilder {
1147            _phantom_state: ::core::marker::PhantomData,
1148            __unsafe_private_named: self.__unsafe_private_named,
1149            _phantom: ::core::marker::PhantomData,
1150        }
1151    }
1152}
1153
1154impl<'a, S> NormalContainerIdBuilder<'a, S>
1155where
1156    S: normal_container_id_state::State,
1157    S::Peer: normal_container_id_state::IsSet,
1158    S::Counter: normal_container_id_state::IsSet,
1159    S::ContainerType: normal_container_id_state::IsSet,
1160{
1161    /// Build the final struct
1162    pub fn build(self) -> NormalContainerId<'a> {
1163        NormalContainerId {
1164            container_type: self.__unsafe_private_named.0.unwrap(),
1165            counter: self.__unsafe_private_named.1.unwrap(),
1166            peer: self.__unsafe_private_named.2.unwrap(),
1167            extra_data: Default::default(),
1168        }
1169    }
1170    /// Build the final struct with custom extra_data
1171    pub fn build_with_data(
1172        self,
1173        extra_data: std::collections::BTreeMap<
1174            jacquard_common::smol_str::SmolStr,
1175            jacquard_common::types::value::Data<'a>,
1176        >,
1177    ) -> NormalContainerId<'a> {
1178        NormalContainerId {
1179            container_type: self.__unsafe_private_named.0.unwrap(),
1180            counter: self.__unsafe_private_named.1.unwrap(),
1181            peer: self.__unsafe_private_named.2.unwrap(),
1182            extra_data: Some(extra_data),
1183        }
1184    }
1185}
1186
1187impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NormalContainerId<'a> {
1188    fn nsid() -> &'static str {
1189        "sh.weaver.edit.cursor"
1190    }
1191    fn def_name() -> &'static str {
1192        "normalContainerId"
1193    }
1194    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1195        lexicon_doc_sh_weaver_edit_cursor()
1196    }
1197    fn validate(
1198        &self,
1199    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1200        Ok(())
1201    }
1202}
1203
1204#[jacquard_derive::lexicon]
1205#[derive(
1206    serde::Serialize,
1207    serde::Deserialize,
1208    Debug,
1209    Clone,
1210    PartialEq,
1211    Eq,
1212    jacquard_derive::IntoStatic,
1213    Default
1214)]
1215#[serde(rename_all = "camelCase")]
1216pub struct RootContainerId<'a> {
1217    #[serde(borrow)]
1218    pub container_type: jacquard_common::CowStr<'a>,
1219    #[serde(borrow)]
1220    pub name: jacquard_common::CowStr<'a>,
1221}
1222
1223impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RootContainerId<'a> {
1224    fn nsid() -> &'static str {
1225        "sh.weaver.edit.cursor"
1226    }
1227    fn def_name() -> &'static str {
1228        "rootContainerId"
1229    }
1230    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1231        lexicon_doc_sh_weaver_edit_cursor()
1232    }
1233    fn validate(
1234        &self,
1235    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1236        Ok(())
1237    }
1238}