// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.chronosky.schedule.listPosts
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Datetime, Language};
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::embed::external::ExternalRecord;
use crate::app_bsky::embed::images::Images;
use crate::app_bsky::embed::record::Record;
use crate::app_bsky::embed::record_with_media::RecordWithMedia;
use crate::app_bsky::embed::video::Video;
use crate::app_bsky::feed::threadgate::FollowerRule;
use crate::app_bsky::feed::threadgate::FollowingRule;
use crate::app_bsky::feed::threadgate::ListRule;
use crate::app_bsky::feed::threadgate::MentionRule;
use crate::app_bsky::richtext::facet::Facet;
use crate::com_atproto::label::SelfLabels;
use crate::app_chronosky::schedule::list_posts;
/// Image embed view with CID references. Similar to app.bsky.embed.images#view but includes cid on each image.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ImageView<'a> {
    ///List of image views with CID references.
    #[serde(borrow)]
    pub images: Vec<list_posts::ImageViewImage<'a>>,
}

/// Image view with CID for referencing in updatePost. Extends app.bsky.embed.images#viewImage with cid field.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ImageViewImage<'a> {
    ///Alt text for the image.
    #[serde(borrow)]
    pub alt: CowStr<'a>,
    ///CID of the image blob. Use this value with updatePost#imagesEmbed to reference this image without re-uploading.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<CowStr<'a>>,
    ///Full-size URL for the image.
    #[serde(borrow)]
    pub fullsize: CowStr<'a>,
    ///Thumbnail URL for the image.
    #[serde(borrow)]
    pub thumb: CowStr<'a>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ListPosts<'a> {
    ///Defaults to `20`. Min: 1. Max: 100.
    #[serde(default = "_default_limit")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    ///Defaults to `1`. Min: 1.
    #[serde(default = "_default_page")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    ///(max length: 20)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<CowStr<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ListPostsOutput<'a> {
    #[serde(borrow)]
    pub pagination: list_posts::Pagination<'a>,
    #[serde(borrow)]
    pub posts: Vec<list_posts::ScheduledPost<'a>>,
}

/// Pagination information.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Pagination<'a> {
    ///Posts per page.
    pub limit: i64,
    ///Current page number.
    pub page: i64,
    ///Total number of posts.
    pub total: i64,
    ///Total number of pages.
    pub total_pages: i64,
}

/// Scheduled post object with AT Protocol standard fields.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ScheduledPost<'a> {
    ///AT Protocol record key. Present after successful execution.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub at_rkey: Option<CowStr<'a>>,
    ///AT Protocol post URI (at://did:plc:.../app.bsky.feed.post/...). Present after successful execution.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub at_uri: Option<CowStr<'a>>,
    ///Child posts in thread. Only present for parent posts with children.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub children: Option<Vec<list_posts::ScheduledPost<'a>>>,
    ///Post creation datetime (ISO 8601).
    pub created_at: Datetime,
    ///Embedded content such as images, external links, or quoted posts. For image embeds, returned as #imageView with thumb/fullsize URLs and CID references.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub embed: Option<ScheduledPostEmbed<'a>>,
    ///Error message if execution failed. Present only when status is FAILED.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub error_msg: Option<CowStr<'a>>,
    ///Execution completion datetime (ISO 8601). Present only when status is COMPLETED or FAILED.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub executed_at: Option<Datetime>,
    ///Rich text facets for mentions, links, and hashtags (app.bsky.richtext.facet).
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub facets: Option<Vec<Facet<'a>>>,
    ///Post ID.
    #[serde(borrow)]
    pub id: CowStr<'a>,
    ///Self-applied content labels for content warnings (AT Protocol standard).
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub labels: Option<SelfLabels<'a>>,
    ///Language codes for post content (app.bsky.feed.post#langs). ISO 639-1 or 639-3 codes.
    pub langs: Vec<Language>,
    ///Parent post ID for thread posts. Null for root posts.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub parent_post_id: Option<CowStr<'a>>,
    ///CID for postgate record. Present after successful execution with postgate settings.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub postgate_cid: Option<CowStr<'a>>,
    ///Whether to disable quote posts and embeds for this post (app.bsky.feed.postgate).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub postgate_disable_embedding: Option<bool>,
    ///AT Protocol URI for postgate record. Present after successful execution with postgate settings.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub postgate_uri: Option<CowStr<'a>>,
    ///Number of execution retry attempts.
    pub retry_count: i64,
    ///Scheduled publication datetime (ISO 8601).
    pub scheduled_at: Datetime,
    ///Post status.
    #[serde(borrow)]
    pub status: CowStr<'a>,
    ///Post content text (app.bsky.feed.post#text). May be empty if embeds are present.
    #[serde(borrow)]
    pub text: CowStr<'a>,
    ///Thread depth level (0 for root post, 1 for direct reply, etc.).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thread_depth: Option<i64>,
    ///Position in thread (0-indexed). 0 for parent post, 1+ for children.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thread_position: Option<i64>,
    ///CID for threadgate record. Present after successful execution with threadgate rules.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub threadgate_cid: Option<CowStr<'a>>,
    ///Reply restriction rules (app.bsky.feed.threadgate). Defines who can reply to this post.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub threadgate_rules: Option<Vec<ScheduledPostThreadgateRulesItem<'a>>>,
    ///AT Protocol URI for threadgate record. Present after successful execution with threadgate rules.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub threadgate_uri: Option<CowStr<'a>>,
    ///Post last update datetime (ISO 8601).
    pub updated_at: Datetime,
    ///User ID who created this post.
    #[serde(borrow)]
    pub user_id: CowStr<'a>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ScheduledPostEmbed<'a> {
    #[serde(rename = "app.bsky.embed.images")]
    Images(Box<Images<'a>>),
    #[serde(rename = "app.chronosky.schedule.listPosts#imageView")]
    ImageView(Box<list_posts::ImageView<'a>>),
    #[serde(rename = "app.bsky.embed.external")]
    External(Box<ExternalRecord<'a>>),
    #[serde(rename = "app.bsky.embed.record")]
    Record(Box<Record<'a>>),
    #[serde(rename = "app.bsky.embed.video")]
    Video(Box<Video<'a>>),
    #[serde(rename = "app.bsky.embed.recordWithMedia")]
    RecordWithMedia(Box<RecordWithMedia<'a>>),
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ScheduledPostThreadgateRulesItem<'a> {
    #[serde(rename = "app.bsky.feed.threadgate#mentionRule")]
    ThreadgateMentionRule(Box<MentionRule<'a>>),
    #[serde(rename = "app.bsky.feed.threadgate#followerRule")]
    ThreadgateFollowerRule(Box<FollowerRule<'a>>),
    #[serde(rename = "app.bsky.feed.threadgate#followingRule")]
    ThreadgateFollowingRule(Box<FollowingRule<'a>>),
    #[serde(rename = "app.bsky.feed.threadgate#listRule")]
    ThreadgateListRule(Box<ListRule<'a>>),
}

impl<'a> LexiconSchema for ImageView<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.schedule.listPosts"
    }
    fn def_name() -> &'static str {
        "imageView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_schedule_listPosts()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.images;
            #[allow(unused_comparisons)]
            if value.len() > 4usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("images"),
                    max: 4usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for ImageViewImage<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.schedule.listPosts"
    }
    fn def_name() -> &'static str {
        "imageViewImage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_schedule_listPosts()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.cid {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("cid"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

/// Response type for app.chronosky.schedule.listPosts
pub struct ListPostsResponse;
impl jacquard_common::xrpc::XrpcResp for ListPostsResponse {
    const NSID: &'static str = "app.chronosky.schedule.listPosts";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = ListPostsOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for ListPosts<'a> {
    const NSID: &'static str = "app.chronosky.schedule.listPosts";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = ListPostsResponse;
}

/// Endpoint type for app.chronosky.schedule.listPosts
pub struct ListPostsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ListPostsRequest {
    const PATH: &'static str = "/xrpc/app.chronosky.schedule.listPosts";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = ListPosts<'de>;
    type Response = ListPostsResponse;
}

impl<'a> LexiconSchema for Pagination<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.schedule.listPosts"
    }
    fn def_name() -> &'static str {
        "pagination"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_schedule_listPosts()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.limit;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("limit"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.page;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("page"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.total;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("total"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.total_pages;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("total_pages"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for ScheduledPost<'a> {
    fn nsid() -> &'static str {
        "app.chronosky.schedule.listPosts"
    }
    fn def_name() -> &'static str {
        "scheduledPost"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_chronosky_schedule_listPosts()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.at_rkey {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("at_rkey"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.at_uri {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("at_uri"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.error_msg {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("error_msg"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.langs;
            #[allow(unused_comparisons)]
            if value.len() > 3usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("langs"),
                    max: 3usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.parent_post_id {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("parent_post_id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.postgate_cid {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("postgate_cid"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.postgate_uri {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("postgate_uri"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.retry_count;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("retry_count"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.status;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("status"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.text;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 3000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 3000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.text;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 300usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 300usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.thread_depth {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("thread_depth"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.thread_position {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("thread_position"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.threadgate_cid {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("threadgate_cid"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.threadgate_rules {
            #[allow(unused_comparisons)]
            if value.len() > 5usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("threadgate_rules"),
                    max: 5usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.threadgate_uri {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("threadgate_uri"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.user_id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("user_id"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

pub mod image_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Images;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Images = Unset;
    }
    ///State transition - sets the `images` field to Set
    pub struct SetImages<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetImages<S> {}
    impl<S: State> State for SetImages<S> {
        type Images = Set<members::images>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `images` field
        pub struct images(());
    }
}

/// Builder for constructing an instance of this type
pub struct ImageViewBuilder<'a, S: image_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<Vec<list_posts::ImageViewImage<'a>>>,),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ImageView<'a> {
    /// Create a new builder for this type
    pub fn new() -> ImageViewBuilder<'a, image_view_state::Empty> {
        ImageViewBuilder::new()
    }
}

impl<'a> ImageViewBuilder<'a, image_view_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        ImageViewBuilder {
            _state: PhantomData,
            _fields: (None,),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ImageViewBuilder<'a, S>
where
    S: image_view_state::State,
    S::Images: image_view_state::IsUnset,
{
    /// Set the `images` field (required)
    pub fn images(
        mut self,
        value: impl Into<Vec<list_posts::ImageViewImage<'a>>>,
    ) -> ImageViewBuilder<'a, image_view_state::SetImages<S>> {
        self._fields.0 = Option::Some(value.into());
        ImageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ImageViewBuilder<'a, S>
where
    S: image_view_state::State,
    S::Images: image_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ImageView<'a> {
        ImageView {
            images: self._fields.0.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ImageView<'a> {
        ImageView {
            images: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_app_chronosky_schedule_listPosts() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("app.chronosky.schedule.listPosts"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("imageView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Image embed view with CID references. Similar to app.bsky.embed.images#view but includes cid on each image.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("images")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("images"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "List of image views with CID references.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageViewImage"),
                                    ..Default::default()
                                }),
                                max_length: Some(4usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("imageViewImage"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Image view with CID for referencing in updatePost. Extends app.bsky.embed.images#viewImage with cid field.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("thumb"),
                            SmolStr::new_static("fullsize"), SmolStr::new_static("alt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Alt text for the image."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "CID of the image blob. Use this value with updatePost#imagesEmbed to reference this image without re-uploading.",
                                    ),
                                ),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("fullsize"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Full-size URL for the image."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("thumb"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Thumbnail URL for the image."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::XrpcQuery(LexXrpcQuery {
                    parameters: Some(
                        LexXrpcQueryParameter::Params(LexXrpcParameters {
                            properties: {
                                #[allow(unused_mut)]
                                let mut map = BTreeMap::new();
                                map.insert(
                                    SmolStr::new_static("limit"),
                                    LexXrpcParametersProperty::Integer(LexInteger {
                                        ..Default::default()
                                    }),
                                );
                                map.insert(
                                    SmolStr::new_static("page"),
                                    LexXrpcParametersProperty::Integer(LexInteger {
                                        ..Default::default()
                                    }),
                                );
                                map.insert(
                                    SmolStr::new_static("status"),
                                    LexXrpcParametersProperty::String(LexString {
                                        description: Some(
                                            CowStr::new_static("Filter by post status."),
                                        ),
                                        max_length: Some(20usize),
                                        ..Default::default()
                                    }),
                                );
                                map
                            },
                            ..Default::default()
                        }),
                    ),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pagination"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Pagination information.")),
                    required: Some(
                        vec![
                            SmolStr::new_static("page"), SmolStr::new_static("limit"),
                            SmolStr::new_static("total"),
                            SmolStr::new_static("totalPages")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("limit"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("page"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("total"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("totalPages"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("scheduledPost"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Scheduled post object with AT Protocol standard fields.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("userId"),
                            SmolStr::new_static("text"),
                            SmolStr::new_static("scheduledAt"),
                            SmolStr::new_static("status"),
                            SmolStr::new_static("createdAt"),
                            SmolStr::new_static("updatedAt"),
                            SmolStr::new_static("retryCount"),
                            SmolStr::new_static("langs")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("atRkey"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "AT Protocol record key. Present after successful execution.",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("atUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "AT Protocol post URI (at://did:plc:.../app.bsky.feed.post/...). Present after successful execution.",
                                    ),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("children"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Child posts in thread. Only present for parent posts with children.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#scheduledPost"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Post creation datetime (ISO 8601)."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("embed"),
                            LexObjectProperty::Union(LexRefUnion {
                                description: Some(
                                    CowStr::new_static(
                                        "Embedded content such as images, external links, or quoted posts. For image embeds, returned as #imageView with thumb/fullsize URLs and CID references.",
                                    ),
                                ),
                                refs: vec![
                                    CowStr::new_static("app.bsky.embed.images"),
                                    CowStr::new_static("#imageView"),
                                    CowStr::new_static("app.bsky.embed.external"),
                                    CowStr::new_static("app.bsky.embed.record"),
                                    CowStr::new_static("app.bsky.embed.video"),
                                    CowStr::new_static("app.bsky.embed.recordWithMedia")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("errorMsg"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Error message if execution failed. Present only when status is FAILED.",
                                    ),
                                ),
                                max_length: Some(2000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Execution completion datetime (ISO 8601). Present only when status is COMPLETED or FAILED.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("facets"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Rich text facets for mentions, links, and hashtags (app.bsky.richtext.facet).",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("app.bsky.richtext.facet"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Post ID.")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labels"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "com.atproto.label.defs#selfLabels",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("langs"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Language codes for post content (app.bsky.feed.post#langs). ISO 639-1 or 639-3 codes.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::Language),
                                    ..Default::default()
                                }),
                                max_length: Some(3usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("parentPostId"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Parent post ID for thread posts. Null for root posts.",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("postgateCid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "CID for postgate record. Present after successful execution with postgate settings.",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("postgateDisableEmbedding"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("postgateUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "AT Protocol URI for postgate record. Present after successful execution with postgate settings.",
                                    ),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("retryCount"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("scheduledAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Scheduled publication datetime (ISO 8601).",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Post status.")),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Post content text (app.bsky.feed.post#text). May be empty if embeds are present.",
                                    ),
                                ),
                                max_length: Some(3000usize),
                                max_graphemes: Some(300usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threadDepth"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threadPosition"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threadgateCid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "CID for threadgate record. Present after successful execution with threadgate rules.",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threadgateRules"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Reply restriction rules (app.bsky.feed.threadgate). Defines who can reply to this post.",
                                    ),
                                ),
                                items: LexArrayItem::Union(LexRefUnion {
                                    refs: vec![
                                        CowStr::new_static("app.bsky.feed.threadgate#mentionRule"),
                                        CowStr::new_static("app.bsky.feed.threadgate#followerRule"),
                                        CowStr::new_static("app.bsky.feed.threadgate#followingRule"),
                                        CowStr::new_static("app.bsky.feed.threadgate#listRule")
                                    ],
                                    ..Default::default()
                                }),
                                max_length: Some(5usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threadgateUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "AT Protocol URI for threadgate record. Present after successful execution with threadgate rules.",
                                    ),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Post last update datetime (ISO 8601)."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("userId"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("User ID who created this post."),
                                ),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

fn _default_limit() -> Option<i64> {
    Some(20i64)
}

fn _default_page() -> Option<i64> {
    Some(1i64)
}

pub mod list_posts_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type
pub struct ListPostsBuilder<'a, S: list_posts_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<i64>, Option<i64>, Option<CowStr<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ListPosts<'a> {
    /// Create a new builder for this type
    pub fn new() -> ListPostsBuilder<'a, list_posts_state::Empty> {
        ListPostsBuilder::new()
    }
}

impl<'a> ListPostsBuilder<'a, list_posts_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        ListPostsBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: list_posts_state::State> ListPostsBuilder<'a, S> {
    /// Set the `limit` field (optional)
    pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `limit` field to an Option value (optional)
    pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: list_posts_state::State> ListPostsBuilder<'a, S> {
    /// Set the `page` field (optional)
    pub fn page(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `page` field to an Option value (optional)
    pub fn maybe_page(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: list_posts_state::State> ListPostsBuilder<'a, S> {
    /// Set the `status` field (optional)
    pub fn status(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `status` field to an Option value (optional)
    pub fn maybe_status(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S> ListPostsBuilder<'a, S>
where
    S: list_posts_state::State,
{
    /// Build the final struct
    pub fn build(self) -> ListPosts<'a> {
        ListPosts {
            limit: self._fields.0,
            page: self._fields.1,
            status: self._fields.2,
        }
    }
}

pub mod pagination_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Total;
        type Page;
        type TotalPages;
        type Limit;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Total = Unset;
        type Page = Unset;
        type TotalPages = Unset;
        type Limit = Unset;
    }
    ///State transition - sets the `total` field to Set
    pub struct SetTotal<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTotal<S> {}
    impl<S: State> State for SetTotal<S> {
        type Total = Set<members::total>;
        type Page = S::Page;
        type TotalPages = S::TotalPages;
        type Limit = S::Limit;
    }
    ///State transition - sets the `page` field to Set
    pub struct SetPage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPage<S> {}
    impl<S: State> State for SetPage<S> {
        type Total = S::Total;
        type Page = Set<members::page>;
        type TotalPages = S::TotalPages;
        type Limit = S::Limit;
    }
    ///State transition - sets the `total_pages` field to Set
    pub struct SetTotalPages<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTotalPages<S> {}
    impl<S: State> State for SetTotalPages<S> {
        type Total = S::Total;
        type Page = S::Page;
        type TotalPages = Set<members::total_pages>;
        type Limit = S::Limit;
    }
    ///State transition - sets the `limit` field to Set
    pub struct SetLimit<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLimit<S> {}
    impl<S: State> State for SetLimit<S> {
        type Total = S::Total;
        type Page = S::Page;
        type TotalPages = S::TotalPages;
        type Limit = Set<members::limit>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `total` field
        pub struct total(());
        ///Marker type for the `page` field
        pub struct page(());
        ///Marker type for the `total_pages` field
        pub struct total_pages(());
        ///Marker type for the `limit` field
        pub struct limit(());
    }
}

/// Builder for constructing an instance of this type
pub struct PaginationBuilder<'a, S: pagination_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<i64>, Option<i64>, Option<i64>, Option<i64>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Pagination<'a> {
    /// Create a new builder for this type
    pub fn new() -> PaginationBuilder<'a, pagination_state::Empty> {
        PaginationBuilder::new()
    }
}

impl<'a> PaginationBuilder<'a, pagination_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        PaginationBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PaginationBuilder<'a, S>
where
    S: pagination_state::State,
    S::Limit: pagination_state::IsUnset,
{
    /// Set the `limit` field (required)
    pub fn limit(
        mut self,
        value: impl Into<i64>,
    ) -> PaginationBuilder<'a, pagination_state::SetLimit<S>> {
        self._fields.0 = Option::Some(value.into());
        PaginationBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PaginationBuilder<'a, S>
where
    S: pagination_state::State,
    S::Page: pagination_state::IsUnset,
{
    /// Set the `page` field (required)
    pub fn page(
        mut self,
        value: impl Into<i64>,
    ) -> PaginationBuilder<'a, pagination_state::SetPage<S>> {
        self._fields.1 = Option::Some(value.into());
        PaginationBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PaginationBuilder<'a, S>
where
    S: pagination_state::State,
    S::Total: pagination_state::IsUnset,
{
    /// Set the `total` field (required)
    pub fn total(
        mut self,
        value: impl Into<i64>,
    ) -> PaginationBuilder<'a, pagination_state::SetTotal<S>> {
        self._fields.2 = Option::Some(value.into());
        PaginationBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PaginationBuilder<'a, S>
where
    S: pagination_state::State,
    S::TotalPages: pagination_state::IsUnset,
{
    /// Set the `totalPages` field (required)
    pub fn total_pages(
        mut self,
        value: impl Into<i64>,
    ) -> PaginationBuilder<'a, pagination_state::SetTotalPages<S>> {
        self._fields.3 = Option::Some(value.into());
        PaginationBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PaginationBuilder<'a, S>
where
    S: pagination_state::State,
    S::Total: pagination_state::IsSet,
    S::Page: pagination_state::IsSet,
    S::TotalPages: pagination_state::IsSet,
    S::Limit: pagination_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Pagination<'a> {
        Pagination {
            limit: self._fields.0.unwrap(),
            page: self._fields.1.unwrap(),
            total: self._fields.2.unwrap(),
            total_pages: self._fields.3.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Pagination<'a> {
        Pagination {
            limit: self._fields.0.unwrap(),
            page: self._fields.1.unwrap(),
            total: self._fields.2.unwrap(),
            total_pages: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod scheduled_post_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Text;
        type ScheduledAt;
        type Id;
        type UpdatedAt;
        type CreatedAt;
        type Status;
        type UserId;
        type RetryCount;
        type Langs;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Text = Unset;
        type ScheduledAt = Unset;
        type Id = Unset;
        type UpdatedAt = Unset;
        type CreatedAt = Unset;
        type Status = Unset;
        type UserId = Unset;
        type RetryCount = Unset;
        type Langs = Unset;
    }
    ///State transition - sets the `text` field to Set
    pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetText<S> {}
    impl<S: State> State for SetText<S> {
        type Text = Set<members::text>;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `scheduled_at` field to Set
    pub struct SetScheduledAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetScheduledAt<S> {}
    impl<S: State> State for SetScheduledAt<S> {
        type Text = S::Text;
        type ScheduledAt = Set<members::scheduled_at>;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = Set<members::id>;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `updated_at` field to Set
    pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
    impl<S: State> State for SetUpdatedAt<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = Set<members::updated_at>;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = Set<members::created_at>;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `status` field to Set
    pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetStatus<S> {}
    impl<S: State> State for SetStatus<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = Set<members::status>;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `user_id` field to Set
    pub struct SetUserId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUserId<S> {}
    impl<S: State> State for SetUserId<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = Set<members::user_id>;
        type RetryCount = S::RetryCount;
        type Langs = S::Langs;
    }
    ///State transition - sets the `retry_count` field to Set
    pub struct SetRetryCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRetryCount<S> {}
    impl<S: State> State for SetRetryCount<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = Set<members::retry_count>;
        type Langs = S::Langs;
    }
    ///State transition - sets the `langs` field to Set
    pub struct SetLangs<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLangs<S> {}
    impl<S: State> State for SetLangs<S> {
        type Text = S::Text;
        type ScheduledAt = S::ScheduledAt;
        type Id = S::Id;
        type UpdatedAt = S::UpdatedAt;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
        type UserId = S::UserId;
        type RetryCount = S::RetryCount;
        type Langs = Set<members::langs>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `text` field
        pub struct text(());
        ///Marker type for the `scheduled_at` field
        pub struct scheduled_at(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `updated_at` field
        pub struct updated_at(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `status` field
        pub struct status(());
        ///Marker type for the `user_id` field
        pub struct user_id(());
        ///Marker type for the `retry_count` field
        pub struct retry_count(());
        ///Marker type for the `langs` field
        pub struct langs(());
    }
}

/// Builder for constructing an instance of this type
pub struct ScheduledPostBuilder<'a, S: scheduled_post_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<Vec<list_posts::ScheduledPost<'a>>>,
        Option<Datetime>,
        Option<ScheduledPostEmbed<'a>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<Vec<Facet<'a>>>,
        Option<CowStr<'a>>,
        Option<SelfLabels<'a>>,
        Option<Vec<Language>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<bool>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<i64>,
        Option<CowStr<'a>>,
        Option<Vec<ScheduledPostThreadgateRulesItem<'a>>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ScheduledPost<'a> {
    /// Create a new builder for this type
    pub fn new() -> ScheduledPostBuilder<'a, scheduled_post_state::Empty> {
        ScheduledPostBuilder::new()
    }
}

impl<'a> ScheduledPostBuilder<'a, scheduled_post_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: (
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
            ),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `atRkey` field (optional)
    pub fn at_rkey(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `atRkey` field to an Option value (optional)
    pub fn maybe_at_rkey(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `atUri` field (optional)
    pub fn at_uri(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `atUri` field to an Option value (optional)
    pub fn maybe_at_uri(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `children` field (optional)
    pub fn children(
        mut self,
        value: impl Into<Option<Vec<list_posts::ScheduledPost<'a>>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `children` field to an Option value (optional)
    pub fn maybe_children(
        mut self,
        value: Option<Vec<list_posts::ScheduledPost<'a>>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::CreatedAt: scheduled_post_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetCreatedAt<S>> {
        self._fields.3 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `embed` field (optional)
    pub fn embed(mut self, value: impl Into<Option<ScheduledPostEmbed<'a>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `embed` field to an Option value (optional)
    pub fn maybe_embed(mut self, value: Option<ScheduledPostEmbed<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `errorMsg` field (optional)
    pub fn error_msg(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `errorMsg` field to an Option value (optional)
    pub fn maybe_error_msg(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `executedAt` field (optional)
    pub fn executed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `executedAt` field to an Option value (optional)
    pub fn maybe_executed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `facets` field (optional)
    pub fn facets(mut self, value: impl Into<Option<Vec<Facet<'a>>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `facets` field to an Option value (optional)
    pub fn maybe_facets(mut self, value: Option<Vec<Facet<'a>>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::Id: scheduled_post_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetId<S>> {
        self._fields.8 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<SelfLabels<'a>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `labels` field to an Option value (optional)
    pub fn maybe_labels(mut self, value: Option<SelfLabels<'a>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::Langs: scheduled_post_state::IsUnset,
{
    /// Set the `langs` field (required)
    pub fn langs(
        mut self,
        value: impl Into<Vec<Language>>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetLangs<S>> {
        self._fields.10 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `parentPostId` field (optional)
    pub fn parent_post_id(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `parentPostId` field to an Option value (optional)
    pub fn maybe_parent_post_id(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `postgateCid` field (optional)
    pub fn postgate_cid(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `postgateCid` field to an Option value (optional)
    pub fn maybe_postgate_cid(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `postgateDisableEmbedding` field (optional)
    pub fn postgate_disable_embedding(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `postgateDisableEmbedding` field to an Option value (optional)
    pub fn maybe_postgate_disable_embedding(mut self, value: Option<bool>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `postgateUri` field (optional)
    pub fn postgate_uri(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `postgateUri` field to an Option value (optional)
    pub fn maybe_postgate_uri(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::RetryCount: scheduled_post_state::IsUnset,
{
    /// Set the `retryCount` field (required)
    pub fn retry_count(
        mut self,
        value: impl Into<i64>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetRetryCount<S>> {
        self._fields.15 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::ScheduledAt: scheduled_post_state::IsUnset,
{
    /// Set the `scheduledAt` field (required)
    pub fn scheduled_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetScheduledAt<S>> {
        self._fields.16 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::Status: scheduled_post_state::IsUnset,
{
    /// Set the `status` field (required)
    pub fn status(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetStatus<S>> {
        self._fields.17 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::Text: scheduled_post_state::IsUnset,
{
    /// Set the `text` field (required)
    pub fn text(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetText<S>> {
        self._fields.18 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `threadDepth` field (optional)
    pub fn thread_depth(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.19 = value.into();
        self
    }
    /// Set the `threadDepth` field to an Option value (optional)
    pub fn maybe_thread_depth(mut self, value: Option<i64>) -> Self {
        self._fields.19 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `threadPosition` field (optional)
    pub fn thread_position(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.20 = value.into();
        self
    }
    /// Set the `threadPosition` field to an Option value (optional)
    pub fn maybe_thread_position(mut self, value: Option<i64>) -> Self {
        self._fields.20 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `threadgateCid` field (optional)
    pub fn threadgate_cid(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.21 = value.into();
        self
    }
    /// Set the `threadgateCid` field to an Option value (optional)
    pub fn maybe_threadgate_cid(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.21 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `threadgateRules` field (optional)
    pub fn threadgate_rules(
        mut self,
        value: impl Into<Option<Vec<ScheduledPostThreadgateRulesItem<'a>>>>,
    ) -> Self {
        self._fields.22 = value.into();
        self
    }
    /// Set the `threadgateRules` field to an Option value (optional)
    pub fn maybe_threadgate_rules(
        mut self,
        value: Option<Vec<ScheduledPostThreadgateRulesItem<'a>>>,
    ) -> Self {
        self._fields.22 = value;
        self
    }
}

impl<'a, S: scheduled_post_state::State> ScheduledPostBuilder<'a, S> {
    /// Set the `threadgateUri` field (optional)
    pub fn threadgate_uri(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.23 = value.into();
        self
    }
    /// Set the `threadgateUri` field to an Option value (optional)
    pub fn maybe_threadgate_uri(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.23 = value;
        self
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::UpdatedAt: scheduled_post_state::IsUnset,
{
    /// Set the `updatedAt` field (required)
    pub fn updated_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetUpdatedAt<S>> {
        self._fields.24 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::UserId: scheduled_post_state::IsUnset,
{
    /// Set the `userId` field (required)
    pub fn user_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ScheduledPostBuilder<'a, scheduled_post_state::SetUserId<S>> {
        self._fields.25 = Option::Some(value.into());
        ScheduledPostBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ScheduledPostBuilder<'a, S>
where
    S: scheduled_post_state::State,
    S::Text: scheduled_post_state::IsSet,
    S::ScheduledAt: scheduled_post_state::IsSet,
    S::Id: scheduled_post_state::IsSet,
    S::UpdatedAt: scheduled_post_state::IsSet,
    S::CreatedAt: scheduled_post_state::IsSet,
    S::Status: scheduled_post_state::IsSet,
    S::UserId: scheduled_post_state::IsSet,
    S::RetryCount: scheduled_post_state::IsSet,
    S::Langs: scheduled_post_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ScheduledPost<'a> {
        ScheduledPost {
            at_rkey: self._fields.0,
            at_uri: self._fields.1,
            children: self._fields.2,
            created_at: self._fields.3.unwrap(),
            embed: self._fields.4,
            error_msg: self._fields.5,
            executed_at: self._fields.6,
            facets: self._fields.7,
            id: self._fields.8.unwrap(),
            labels: self._fields.9,
            langs: self._fields.10.unwrap(),
            parent_post_id: self._fields.11,
            postgate_cid: self._fields.12,
            postgate_disable_embedding: self._fields.13,
            postgate_uri: self._fields.14,
            retry_count: self._fields.15.unwrap(),
            scheduled_at: self._fields.16.unwrap(),
            status: self._fields.17.unwrap(),
            text: self._fields.18.unwrap(),
            thread_depth: self._fields.19,
            thread_position: self._fields.20,
            threadgate_cid: self._fields.21,
            threadgate_rules: self._fields.22,
            threadgate_uri: self._fields.23,
            updated_at: self._fields.24.unwrap(),
            user_id: self._fields.25.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ScheduledPost<'a> {
        ScheduledPost {
            at_rkey: self._fields.0,
            at_uri: self._fields.1,
            children: self._fields.2,
            created_at: self._fields.3.unwrap(),
            embed: self._fields.4,
            error_msg: self._fields.5,
            executed_at: self._fields.6,
            facets: self._fields.7,
            id: self._fields.8.unwrap(),
            labels: self._fields.9,
            langs: self._fields.10.unwrap(),
            parent_post_id: self._fields.11,
            postgate_cid: self._fields.12,
            postgate_disable_embedding: self._fields.13,
            postgate_uri: self._fields.14,
            retry_count: self._fields.15.unwrap(),
            scheduled_at: self._fields.16.unwrap(),
            status: self._fields.17.unwrap(),
            text: self._fields.18.unwrap(),
            thread_depth: self._fields.19,
            thread_position: self._fields.20,
            threadgate_cid: self._fields.21,
            threadgate_rules: self._fields.22,
            threadgate_uri: self._fields.23,
            updated_at: self._fields.24.unwrap(),
            user_id: self._fields.25.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}