jacquard_api/net_anisota/feed/
draft.rs

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