jacquard_api/pub_leaflet/
comment.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: pub.leaflet.comment
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 LinearDocumentQuote<'a> {
20    #[serde(borrow)]
21    pub document: jacquard_common::types::string::AtUri<'a>,
22    #[serde(borrow)]
23    pub quote: crate::pub_leaflet::pages::linear_document::Quote<'a>,
24}
25
26pub mod linear_document_quote_state {
27
28    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
29    #[allow(unused)]
30    use ::core::marker::PhantomData;
31    mod sealed {
32        pub trait Sealed {}
33    }
34    /// State trait tracking which required fields have been set
35    pub trait State: sealed::Sealed {
36        type Document;
37        type Quote;
38    }
39    /// Empty state - all required fields are unset
40    pub struct Empty(());
41    impl sealed::Sealed for Empty {}
42    impl State for Empty {
43        type Document = Unset;
44        type Quote = Unset;
45    }
46    ///State transition - sets the `document` field to Set
47    pub struct SetDocument<S: State = Empty>(PhantomData<fn() -> S>);
48    impl<S: State> sealed::Sealed for SetDocument<S> {}
49    impl<S: State> State for SetDocument<S> {
50        type Document = Set<members::document>;
51        type Quote = S::Quote;
52    }
53    ///State transition - sets the `quote` field to Set
54    pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>);
55    impl<S: State> sealed::Sealed for SetQuote<S> {}
56    impl<S: State> State for SetQuote<S> {
57        type Document = S::Document;
58        type Quote = Set<members::quote>;
59    }
60    /// Marker types for field names
61    #[allow(non_camel_case_types)]
62    pub mod members {
63        ///Marker type for the `document` field
64        pub struct document(());
65        ///Marker type for the `quote` field
66        pub struct quote(());
67    }
68}
69
70/// Builder for constructing an instance of this type
71pub struct LinearDocumentQuoteBuilder<'a, S: linear_document_quote_state::State> {
72    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
73    __unsafe_private_named: (
74        ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
75        ::core::option::Option<crate::pub_leaflet::pages::linear_document::Quote<'a>>,
76    ),
77    _phantom: ::core::marker::PhantomData<&'a ()>,
78}
79
80impl<'a> LinearDocumentQuote<'a> {
81    /// Create a new builder for this type
82    pub fn new() -> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::Empty> {
83        LinearDocumentQuoteBuilder::new()
84    }
85}
86
87impl<'a> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::Empty> {
88    /// Create a new builder with all fields unset
89    pub fn new() -> Self {
90        LinearDocumentQuoteBuilder {
91            _phantom_state: ::core::marker::PhantomData,
92            __unsafe_private_named: (None, None),
93            _phantom: ::core::marker::PhantomData,
94        }
95    }
96}
97
98impl<'a, S> LinearDocumentQuoteBuilder<'a, S>
99where
100    S: linear_document_quote_state::State,
101    S::Document: linear_document_quote_state::IsUnset,
102{
103    /// Set the `document` field (required)
104    pub fn document(
105        mut self,
106        value: impl Into<jacquard_common::types::string::AtUri<'a>>,
107    ) -> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::SetDocument<S>> {
108        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
109        LinearDocumentQuoteBuilder {
110            _phantom_state: ::core::marker::PhantomData,
111            __unsafe_private_named: self.__unsafe_private_named,
112            _phantom: ::core::marker::PhantomData,
113        }
114    }
115}
116
117impl<'a, S> LinearDocumentQuoteBuilder<'a, S>
118where
119    S: linear_document_quote_state::State,
120    S::Quote: linear_document_quote_state::IsUnset,
121{
122    /// Set the `quote` field (required)
123    pub fn quote(
124        mut self,
125        value: impl Into<crate::pub_leaflet::pages::linear_document::Quote<'a>>,
126    ) -> LinearDocumentQuoteBuilder<'a, linear_document_quote_state::SetQuote<S>> {
127        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
128        LinearDocumentQuoteBuilder {
129            _phantom_state: ::core::marker::PhantomData,
130            __unsafe_private_named: self.__unsafe_private_named,
131            _phantom: ::core::marker::PhantomData,
132        }
133    }
134}
135
136impl<'a, S> LinearDocumentQuoteBuilder<'a, S>
137where
138    S: linear_document_quote_state::State,
139    S::Document: linear_document_quote_state::IsSet,
140    S::Quote: linear_document_quote_state::IsSet,
141{
142    /// Build the final struct
143    pub fn build(self) -> LinearDocumentQuote<'a> {
144        LinearDocumentQuote {
145            document: self.__unsafe_private_named.0.unwrap(),
146            quote: self.__unsafe_private_named.1.unwrap(),
147            extra_data: Default::default(),
148        }
149    }
150    /// Build the final struct with custom extra_data
151    pub fn build_with_data(
152        self,
153        extra_data: std::collections::BTreeMap<
154            jacquard_common::smol_str::SmolStr,
155            jacquard_common::types::value::Data<'a>,
156        >,
157    ) -> LinearDocumentQuote<'a> {
158        LinearDocumentQuote {
159            document: self.__unsafe_private_named.0.unwrap(),
160            quote: self.__unsafe_private_named.1.unwrap(),
161            extra_data: Some(extra_data),
162        }
163    }
164}
165
166fn lexicon_doc_pub_leaflet_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc<
167    'static,
168> {
169    ::jacquard_lexicon::lexicon::LexiconDoc {
170        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
171        id: ::jacquard_common::CowStr::new_static("pub.leaflet.comment"),
172        revision: None,
173        description: None,
174        defs: {
175            let mut map = ::std::collections::BTreeMap::new();
176            map.insert(
177                ::jacquard_common::smol_str::SmolStr::new_static("linearDocumentQuote"),
178                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
179                    description: None,
180                    required: Some(
181                        vec![
182                            ::jacquard_common::smol_str::SmolStr::new_static("document"),
183                            ::jacquard_common::smol_str::SmolStr::new_static("quote")
184                        ],
185                    ),
186                    nullable: None,
187                    properties: {
188                        #[allow(unused_mut)]
189                        let mut map = ::std::collections::BTreeMap::new();
190                        map.insert(
191                            ::jacquard_common::smol_str::SmolStr::new_static("document"),
192                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
193                                description: None,
194                                format: Some(
195                                    ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
196                                ),
197                                default: None,
198                                min_length: None,
199                                max_length: None,
200                                min_graphemes: None,
201                                max_graphemes: None,
202                                r#enum: None,
203                                r#const: None,
204                                known_values: None,
205                            }),
206                        );
207                        map.insert(
208                            ::jacquard_common::smol_str::SmolStr::new_static("quote"),
209                            ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
210                                description: None,
211                                r#ref: ::jacquard_common::CowStr::new_static(
212                                    "pub.leaflet.pages.linearDocument#quote",
213                                ),
214                            }),
215                        );
216                        map
217                    },
218                }),
219            );
220            map.insert(
221                ::jacquard_common::smol_str::SmolStr::new_static("main"),
222                ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
223                    description: Some(
224                        ::jacquard_common::CowStr::new_static(
225                            "Record containing a comment",
226                        ),
227                    ),
228                    key: Some(::jacquard_common::CowStr::new_static("tid")),
229                    record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
230                        description: None,
231                        required: Some(
232                            vec![
233                                ::jacquard_common::smol_str::SmolStr::new_static("subject"),
234                                ::jacquard_common::smol_str::SmolStr::new_static("plaintext"),
235                                ::jacquard_common::smol_str::SmolStr::new_static("createdAt")
236                            ],
237                        ),
238                        nullable: None,
239                        properties: {
240                            #[allow(unused_mut)]
241                            let mut map = ::std::collections::BTreeMap::new();
242                            map.insert(
243                                ::jacquard_common::smol_str::SmolStr::new_static(
244                                    "attachment",
245                                ),
246                                ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
247                                    description: None,
248                                    refs: vec![
249                                        ::jacquard_common::CowStr::new_static("#linearDocumentQuote")
250                                    ],
251                                    closed: None,
252                                }),
253                            );
254                            map.insert(
255                                ::jacquard_common::smol_str::SmolStr::new_static(
256                                    "createdAt",
257                                ),
258                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
259                                    description: None,
260                                    format: Some(
261                                        ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
262                                    ),
263                                    default: None,
264                                    min_length: None,
265                                    max_length: None,
266                                    min_graphemes: None,
267                                    max_graphemes: None,
268                                    r#enum: None,
269                                    r#const: None,
270                                    known_values: None,
271                                }),
272                            );
273                            map.insert(
274                                ::jacquard_common::smol_str::SmolStr::new_static("facets"),
275                                ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
276                                    description: None,
277                                    items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
278                                        description: None,
279                                        r#ref: ::jacquard_common::CowStr::new_static(
280                                            "pub.leaflet.richtext.facet",
281                                        ),
282                                    }),
283                                    min_length: None,
284                                    max_length: None,
285                                }),
286                            );
287                            map.insert(
288                                ::jacquard_common::smol_str::SmolStr::new_static("onPage"),
289                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
290                                    description: None,
291                                    format: None,
292                                    default: None,
293                                    min_length: None,
294                                    max_length: None,
295                                    min_graphemes: None,
296                                    max_graphemes: None,
297                                    r#enum: None,
298                                    r#const: None,
299                                    known_values: None,
300                                }),
301                            );
302                            map.insert(
303                                ::jacquard_common::smol_str::SmolStr::new_static(
304                                    "plaintext",
305                                ),
306                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
307                                    description: None,
308                                    format: None,
309                                    default: None,
310                                    min_length: None,
311                                    max_length: None,
312                                    min_graphemes: None,
313                                    max_graphemes: None,
314                                    r#enum: None,
315                                    r#const: None,
316                                    known_values: None,
317                                }),
318                            );
319                            map.insert(
320                                ::jacquard_common::smol_str::SmolStr::new_static("reply"),
321                                ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
322                                    description: None,
323                                    r#ref: ::jacquard_common::CowStr::new_static("#replyRef"),
324                                }),
325                            );
326                            map.insert(
327                                ::jacquard_common::smol_str::SmolStr::new_static("subject"),
328                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
329                                    description: None,
330                                    format: Some(
331                                        ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
332                                    ),
333                                    default: None,
334                                    min_length: None,
335                                    max_length: None,
336                                    min_graphemes: None,
337                                    max_graphemes: None,
338                                    r#enum: None,
339                                    r#const: None,
340                                    known_values: None,
341                                }),
342                            );
343                            map
344                        },
345                    }),
346                }),
347            );
348            map.insert(
349                ::jacquard_common::smol_str::SmolStr::new_static("replyRef"),
350                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
351                    description: None,
352                    required: Some(
353                        vec![::jacquard_common::smol_str::SmolStr::new_static("parent")],
354                    ),
355                    nullable: None,
356                    properties: {
357                        #[allow(unused_mut)]
358                        let mut map = ::std::collections::BTreeMap::new();
359                        map.insert(
360                            ::jacquard_common::smol_str::SmolStr::new_static("parent"),
361                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
362                                description: None,
363                                format: Some(
364                                    ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
365                                ),
366                                default: None,
367                                min_length: None,
368                                max_length: None,
369                                min_graphemes: None,
370                                max_graphemes: None,
371                                r#enum: None,
372                                r#const: None,
373                                known_values: None,
374                            }),
375                        );
376                        map
377                    },
378                }),
379            );
380            map
381        },
382    }
383}
384
385impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LinearDocumentQuote<'a> {
386    fn nsid() -> &'static str {
387        "pub.leaflet.comment"
388    }
389    fn def_name() -> &'static str {
390        "linearDocumentQuote"
391    }
392    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
393        lexicon_doc_pub_leaflet_comment()
394    }
395    fn validate(
396        &self,
397    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
398        Ok(())
399    }
400}
401
402/// Record containing a comment
403#[jacquard_derive::lexicon]
404#[derive(
405    serde::Serialize,
406    serde::Deserialize,
407    Debug,
408    Clone,
409    PartialEq,
410    Eq,
411    jacquard_derive::IntoStatic
412)]
413#[serde(rename_all = "camelCase")]
414pub struct Comment<'a> {
415    #[serde(skip_serializing_if = "std::option::Option::is_none")]
416    #[serde(borrow)]
417    pub attachment: Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>,
418    pub created_at: jacquard_common::types::string::Datetime,
419    #[serde(skip_serializing_if = "std::option::Option::is_none")]
420    #[serde(borrow)]
421    pub facets: Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
422    #[serde(skip_serializing_if = "std::option::Option::is_none")]
423    #[serde(borrow)]
424    pub on_page: Option<jacquard_common::CowStr<'a>>,
425    #[serde(borrow)]
426    pub plaintext: jacquard_common::CowStr<'a>,
427    #[serde(skip_serializing_if = "std::option::Option::is_none")]
428    #[serde(borrow)]
429    pub reply: Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
430    #[serde(borrow)]
431    pub subject: jacquard_common::types::string::AtUri<'a>,
432}
433
434pub mod comment_state {
435
436    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
437    #[allow(unused)]
438    use ::core::marker::PhantomData;
439    mod sealed {
440        pub trait Sealed {}
441    }
442    /// State trait tracking which required fields have been set
443    pub trait State: sealed::Sealed {
444        type Subject;
445        type Plaintext;
446        type CreatedAt;
447    }
448    /// Empty state - all required fields are unset
449    pub struct Empty(());
450    impl sealed::Sealed for Empty {}
451    impl State for Empty {
452        type Subject = Unset;
453        type Plaintext = Unset;
454        type CreatedAt = Unset;
455    }
456    ///State transition - sets the `subject` field to Set
457    pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
458    impl<S: State> sealed::Sealed for SetSubject<S> {}
459    impl<S: State> State for SetSubject<S> {
460        type Subject = Set<members::subject>;
461        type Plaintext = S::Plaintext;
462        type CreatedAt = S::CreatedAt;
463    }
464    ///State transition - sets the `plaintext` field to Set
465    pub struct SetPlaintext<S: State = Empty>(PhantomData<fn() -> S>);
466    impl<S: State> sealed::Sealed for SetPlaintext<S> {}
467    impl<S: State> State for SetPlaintext<S> {
468        type Subject = S::Subject;
469        type Plaintext = Set<members::plaintext>;
470        type CreatedAt = S::CreatedAt;
471    }
472    ///State transition - sets the `created_at` field to Set
473    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
474    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
475    impl<S: State> State for SetCreatedAt<S> {
476        type Subject = S::Subject;
477        type Plaintext = S::Plaintext;
478        type CreatedAt = Set<members::created_at>;
479    }
480    /// Marker types for field names
481    #[allow(non_camel_case_types)]
482    pub mod members {
483        ///Marker type for the `subject` field
484        pub struct subject(());
485        ///Marker type for the `plaintext` field
486        pub struct plaintext(());
487        ///Marker type for the `created_at` field
488        pub struct created_at(());
489    }
490}
491
492/// Builder for constructing an instance of this type
493pub struct CommentBuilder<'a, S: comment_state::State> {
494    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
495    __unsafe_private_named: (
496        ::core::option::Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>,
497        ::core::option::Option<jacquard_common::types::string::Datetime>,
498        ::core::option::Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
499        ::core::option::Option<jacquard_common::CowStr<'a>>,
500        ::core::option::Option<jacquard_common::CowStr<'a>>,
501        ::core::option::Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
502        ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
503    ),
504    _phantom: ::core::marker::PhantomData<&'a ()>,
505}
506
507impl<'a> Comment<'a> {
508    /// Create a new builder for this type
509    pub fn new() -> CommentBuilder<'a, comment_state::Empty> {
510        CommentBuilder::new()
511    }
512}
513
514impl<'a> CommentBuilder<'a, comment_state::Empty> {
515    /// Create a new builder with all fields unset
516    pub fn new() -> Self {
517        CommentBuilder {
518            _phantom_state: ::core::marker::PhantomData,
519            __unsafe_private_named: (None, None, None, None, None, None, None),
520            _phantom: ::core::marker::PhantomData,
521        }
522    }
523}
524
525impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
526    /// Set the `attachment` field (optional)
527    pub fn attachment(
528        mut self,
529        value: impl Into<Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>>,
530    ) -> Self {
531        self.__unsafe_private_named.0 = value.into();
532        self
533    }
534    /// Set the `attachment` field to an Option value (optional)
535    pub fn maybe_attachment(
536        mut self,
537        value: Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>,
538    ) -> Self {
539        self.__unsafe_private_named.0 = value;
540        self
541    }
542}
543
544impl<'a, S> CommentBuilder<'a, S>
545where
546    S: comment_state::State,
547    S::CreatedAt: comment_state::IsUnset,
548{
549    /// Set the `createdAt` field (required)
550    pub fn created_at(
551        mut self,
552        value: impl Into<jacquard_common::types::string::Datetime>,
553    ) -> CommentBuilder<'a, comment_state::SetCreatedAt<S>> {
554        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
555        CommentBuilder {
556            _phantom_state: ::core::marker::PhantomData,
557            __unsafe_private_named: self.__unsafe_private_named,
558            _phantom: ::core::marker::PhantomData,
559        }
560    }
561}
562
563impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
564    /// Set the `facets` field (optional)
565    pub fn facets(
566        mut self,
567        value: impl Into<Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>>,
568    ) -> Self {
569        self.__unsafe_private_named.2 = value.into();
570        self
571    }
572    /// Set the `facets` field to an Option value (optional)
573    pub fn maybe_facets(
574        mut self,
575        value: Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
576    ) -> Self {
577        self.__unsafe_private_named.2 = value;
578        self
579    }
580}
581
582impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
583    /// Set the `onPage` field (optional)
584    pub fn on_page(
585        mut self,
586        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
587    ) -> Self {
588        self.__unsafe_private_named.3 = value.into();
589        self
590    }
591    /// Set the `onPage` field to an Option value (optional)
592    pub fn maybe_on_page(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
593        self.__unsafe_private_named.3 = value;
594        self
595    }
596}
597
598impl<'a, S> CommentBuilder<'a, S>
599where
600    S: comment_state::State,
601    S::Plaintext: comment_state::IsUnset,
602{
603    /// Set the `plaintext` field (required)
604    pub fn plaintext(
605        mut self,
606        value: impl Into<jacquard_common::CowStr<'a>>,
607    ) -> CommentBuilder<'a, comment_state::SetPlaintext<S>> {
608        self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
609        CommentBuilder {
610            _phantom_state: ::core::marker::PhantomData,
611            __unsafe_private_named: self.__unsafe_private_named,
612            _phantom: ::core::marker::PhantomData,
613        }
614    }
615}
616
617impl<'a, S: comment_state::State> CommentBuilder<'a, S> {
618    /// Set the `reply` field (optional)
619    pub fn reply(
620        mut self,
621        value: impl Into<Option<crate::pub_leaflet::comment::ReplyRef<'a>>>,
622    ) -> Self {
623        self.__unsafe_private_named.5 = value.into();
624        self
625    }
626    /// Set the `reply` field to an Option value (optional)
627    pub fn maybe_reply(
628        mut self,
629        value: Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
630    ) -> Self {
631        self.__unsafe_private_named.5 = value;
632        self
633    }
634}
635
636impl<'a, S> CommentBuilder<'a, S>
637where
638    S: comment_state::State,
639    S::Subject: comment_state::IsUnset,
640{
641    /// Set the `subject` field (required)
642    pub fn subject(
643        mut self,
644        value: impl Into<jacquard_common::types::string::AtUri<'a>>,
645    ) -> CommentBuilder<'a, comment_state::SetSubject<S>> {
646        self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
647        CommentBuilder {
648            _phantom_state: ::core::marker::PhantomData,
649            __unsafe_private_named: self.__unsafe_private_named,
650            _phantom: ::core::marker::PhantomData,
651        }
652    }
653}
654
655impl<'a, S> CommentBuilder<'a, S>
656where
657    S: comment_state::State,
658    S::Subject: comment_state::IsSet,
659    S::Plaintext: comment_state::IsSet,
660    S::CreatedAt: comment_state::IsSet,
661{
662    /// Build the final struct
663    pub fn build(self) -> Comment<'a> {
664        Comment {
665            attachment: self.__unsafe_private_named.0,
666            created_at: self.__unsafe_private_named.1.unwrap(),
667            facets: self.__unsafe_private_named.2,
668            on_page: self.__unsafe_private_named.3,
669            plaintext: self.__unsafe_private_named.4.unwrap(),
670            reply: self.__unsafe_private_named.5,
671            subject: self.__unsafe_private_named.6.unwrap(),
672            extra_data: Default::default(),
673        }
674    }
675    /// Build the final struct with custom extra_data
676    pub fn build_with_data(
677        self,
678        extra_data: std::collections::BTreeMap<
679            jacquard_common::smol_str::SmolStr,
680            jacquard_common::types::value::Data<'a>,
681        >,
682    ) -> Comment<'a> {
683        Comment {
684            attachment: self.__unsafe_private_named.0,
685            created_at: self.__unsafe_private_named.1.unwrap(),
686            facets: self.__unsafe_private_named.2,
687            on_page: self.__unsafe_private_named.3,
688            plaintext: self.__unsafe_private_named.4.unwrap(),
689            reply: self.__unsafe_private_named.5,
690            subject: self.__unsafe_private_named.6.unwrap(),
691            extra_data: Some(extra_data),
692        }
693    }
694}
695
696impl<'a> Comment<'a> {
697    pub fn uri(
698        uri: impl Into<jacquard_common::CowStr<'a>>,
699    ) -> Result<
700        jacquard_common::types::uri::RecordUri<'a, CommentRecord>,
701        jacquard_common::types::uri::UriError,
702    > {
703        jacquard_common::types::uri::RecordUri::try_from_uri(
704            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
705        )
706    }
707}
708
709/// Typed wrapper for GetRecord response with this collection's record type.
710#[derive(
711    serde::Serialize,
712    serde::Deserialize,
713    Debug,
714    Clone,
715    PartialEq,
716    Eq,
717    jacquard_derive::IntoStatic
718)]
719#[serde(rename_all = "camelCase")]
720pub struct CommentGetRecordOutput<'a> {
721    #[serde(skip_serializing_if = "std::option::Option::is_none")]
722    #[serde(borrow)]
723    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
724    #[serde(borrow)]
725    pub uri: jacquard_common::types::string::AtUri<'a>,
726    #[serde(borrow)]
727    pub value: Comment<'a>,
728}
729
730impl From<CommentGetRecordOutput<'_>> for Comment<'_> {
731    fn from(output: CommentGetRecordOutput<'_>) -> Self {
732        use jacquard_common::IntoStatic;
733        output.value.into_static()
734    }
735}
736
737impl jacquard_common::types::collection::Collection for Comment<'_> {
738    const NSID: &'static str = "pub.leaflet.comment";
739    type Record = CommentRecord;
740}
741
742/// Marker type for deserializing records from this collection.
743#[derive(Debug, serde::Serialize, serde::Deserialize)]
744pub struct CommentRecord;
745impl jacquard_common::xrpc::XrpcResp for CommentRecord {
746    const NSID: &'static str = "pub.leaflet.comment";
747    const ENCODING: &'static str = "application/json";
748    type Output<'de> = CommentGetRecordOutput<'de>;
749    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
750}
751
752impl jacquard_common::types::collection::Collection for CommentRecord {
753    const NSID: &'static str = "pub.leaflet.comment";
754    type Record = CommentRecord;
755}
756
757impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Comment<'a> {
758    fn nsid() -> &'static str {
759        "pub.leaflet.comment"
760    }
761    fn def_name() -> &'static str {
762        "main"
763    }
764    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
765        lexicon_doc_pub_leaflet_comment()
766    }
767    fn validate(
768        &self,
769    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
770        Ok(())
771    }
772}
773
774#[jacquard_derive::lexicon]
775#[derive(
776    serde::Serialize,
777    serde::Deserialize,
778    Debug,
779    Clone,
780    PartialEq,
781    Eq,
782    jacquard_derive::IntoStatic
783)]
784#[serde(rename_all = "camelCase")]
785pub struct ReplyRef<'a> {
786    #[serde(borrow)]
787    pub parent: jacquard_common::types::string::AtUri<'a>,
788}
789
790pub mod reply_ref_state {
791
792    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
793    #[allow(unused)]
794    use ::core::marker::PhantomData;
795    mod sealed {
796        pub trait Sealed {}
797    }
798    /// State trait tracking which required fields have been set
799    pub trait State: sealed::Sealed {
800        type Parent;
801    }
802    /// Empty state - all required fields are unset
803    pub struct Empty(());
804    impl sealed::Sealed for Empty {}
805    impl State for Empty {
806        type Parent = Unset;
807    }
808    ///State transition - sets the `parent` field to Set
809    pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>);
810    impl<S: State> sealed::Sealed for SetParent<S> {}
811    impl<S: State> State for SetParent<S> {
812        type Parent = Set<members::parent>;
813    }
814    /// Marker types for field names
815    #[allow(non_camel_case_types)]
816    pub mod members {
817        ///Marker type for the `parent` field
818        pub struct parent(());
819    }
820}
821
822/// Builder for constructing an instance of this type
823pub struct ReplyRefBuilder<'a, S: reply_ref_state::State> {
824    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
825    __unsafe_private_named: (
826        ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
827    ),
828    _phantom: ::core::marker::PhantomData<&'a ()>,
829}
830
831impl<'a> ReplyRef<'a> {
832    /// Create a new builder for this type
833    pub fn new() -> ReplyRefBuilder<'a, reply_ref_state::Empty> {
834        ReplyRefBuilder::new()
835    }
836}
837
838impl<'a> ReplyRefBuilder<'a, reply_ref_state::Empty> {
839    /// Create a new builder with all fields unset
840    pub fn new() -> Self {
841        ReplyRefBuilder {
842            _phantom_state: ::core::marker::PhantomData,
843            __unsafe_private_named: (None,),
844            _phantom: ::core::marker::PhantomData,
845        }
846    }
847}
848
849impl<'a, S> ReplyRefBuilder<'a, S>
850where
851    S: reply_ref_state::State,
852    S::Parent: reply_ref_state::IsUnset,
853{
854    /// Set the `parent` field (required)
855    pub fn parent(
856        mut self,
857        value: impl Into<jacquard_common::types::string::AtUri<'a>>,
858    ) -> ReplyRefBuilder<'a, reply_ref_state::SetParent<S>> {
859        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
860        ReplyRefBuilder {
861            _phantom_state: ::core::marker::PhantomData,
862            __unsafe_private_named: self.__unsafe_private_named,
863            _phantom: ::core::marker::PhantomData,
864        }
865    }
866}
867
868impl<'a, S> ReplyRefBuilder<'a, S>
869where
870    S: reply_ref_state::State,
871    S::Parent: reply_ref_state::IsSet,
872{
873    /// Build the final struct
874    pub fn build(self) -> ReplyRef<'a> {
875        ReplyRef {
876            parent: self.__unsafe_private_named.0.unwrap(),
877            extra_data: Default::default(),
878        }
879    }
880    /// Build the final struct with custom extra_data
881    pub fn build_with_data(
882        self,
883        extra_data: std::collections::BTreeMap<
884            jacquard_common::smol_str::SmolStr,
885            jacquard_common::types::value::Data<'a>,
886        >,
887    ) -> ReplyRef<'a> {
888        ReplyRef {
889            parent: self.__unsafe_private_named.0.unwrap(),
890            extra_data: Some(extra_data),
891        }
892    }
893}
894
895impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> {
896    fn nsid() -> &'static str {
897        "pub.leaflet.comment"
898    }
899    fn def_name() -> &'static str {
900        "replyRef"
901    }
902    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
903        lexicon_doc_pub_leaflet_comment()
904    }
905    fn validate(
906        &self,
907    ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
908        Ok(())
909    }
910}