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

pub mod declaration;
pub mod get_preferences;
pub mod get_unread_count;
pub mod list_activity_subscriptions;
pub mod list_notifications;
pub mod put_activity_subscription;
pub mod put_preferences;
pub mod put_preferences_v2;
pub mod register_push;
pub mod unregister_push;
pub mod update_seen;


#[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::Did;
use jacquard_derive::{IntoStatic, lexicon};
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::notification;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ActivitySubscription<'a> {
    pub post: bool,
    pub reply: bool,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ChatPreference<'a> {
    #[serde(borrow)]
    pub include: ChatPreferenceInclude<'a>,
    pub push: bool,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ChatPreferenceInclude<'a> {
    All,
    Accepted,
    Other(CowStr<'a>),
}

impl<'a> ChatPreferenceInclude<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::All => "all",
            Self::Accepted => "accepted",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ChatPreferenceInclude<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "all" => Self::All,
            "accepted" => Self::Accepted,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ChatPreferenceInclude<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "all" => Self::All,
            "accepted" => Self::Accepted,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> core::fmt::Display for ChatPreferenceInclude<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> AsRef<str> for ChatPreferenceInclude<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> serde::Serialize for ChatPreferenceInclude<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for ChatPreferenceInclude<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl<'a> Default for ChatPreferenceInclude<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ChatPreferenceInclude<'_> {
    type Output = ChatPreferenceInclude<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ChatPreferenceInclude::All => ChatPreferenceInclude::All,
            ChatPreferenceInclude::Accepted => ChatPreferenceInclude::Accepted,
            ChatPreferenceInclude::Other(v) => {
                ChatPreferenceInclude::Other(v.into_static())
            }
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct FilterablePreference<'a> {
    #[serde(borrow)]
    pub include: FilterablePreferenceInclude<'a>,
    pub list: bool,
    pub push: bool,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FilterablePreferenceInclude<'a> {
    All,
    Follows,
    Other(CowStr<'a>),
}

impl<'a> FilterablePreferenceInclude<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::All => "all",
            Self::Follows => "follows",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for FilterablePreferenceInclude<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "all" => Self::All,
            "follows" => Self::Follows,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for FilterablePreferenceInclude<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "all" => Self::All,
            "follows" => Self::Follows,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> core::fmt::Display for FilterablePreferenceInclude<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> AsRef<str> for FilterablePreferenceInclude<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> serde::Serialize for FilterablePreferenceInclude<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for FilterablePreferenceInclude<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl<'a> Default for FilterablePreferenceInclude<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for FilterablePreferenceInclude<'_> {
    type Output = FilterablePreferenceInclude<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            FilterablePreferenceInclude::All => FilterablePreferenceInclude::All,
            FilterablePreferenceInclude::Follows => FilterablePreferenceInclude::Follows,
            FilterablePreferenceInclude::Other(v) => {
                FilterablePreferenceInclude::Other(v.into_static())
            }
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Preference<'a> {
    pub list: bool,
    pub push: bool,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Preferences<'a> {
    #[serde(borrow)]
    pub chat: notification::ChatPreference<'a>,
    #[serde(borrow)]
    pub follow: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub like: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub like_via_repost: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub mention: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub quote: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub reply: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub repost: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub repost_via_repost: notification::FilterablePreference<'a>,
    #[serde(borrow)]
    pub starterpack_joined: notification::Preference<'a>,
    #[serde(borrow)]
    pub subscribed_post: notification::Preference<'a>,
    #[serde(borrow)]
    pub unverified: notification::Preference<'a>,
    #[serde(borrow)]
    pub verified: notification::Preference<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct RecordDeleted<'a> {}
/// Object used to store activity subscription data in stash.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SubjectActivitySubscription<'a> {
    #[serde(borrow)]
    pub activity_subscription: notification::ActivitySubscription<'a>,
    #[serde(borrow)]
    pub subject: Did<'a>,
}

impl<'a> LexiconSchema for ActivitySubscription<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "activitySubscription"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for ChatPreference<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "chatPreference"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for FilterablePreference<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "filterablePreference"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for Preference<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "preference"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for Preferences<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "preferences"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for RecordDeleted<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "recordDeleted"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for SubjectActivitySubscription<'a> {
    fn nsid() -> &'static str {
        "app.bsky.notification.defs"
    }
    fn def_name() -> &'static str {
        "subjectActivitySubscription"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_bsky_notification_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod activity_subscription_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 Reply;
        type Post;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Reply = Unset;
        type Post = Unset;
    }
    ///State transition - sets the `reply` field to Set
    pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReply<S> {}
    impl<S: State> State for SetReply<S> {
        type Reply = Set<members::reply>;
        type Post = S::Post;
    }
    ///State transition - sets the `post` field to Set
    pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPost<S> {}
    impl<S: State> State for SetPost<S> {
        type Reply = S::Reply;
        type Post = Set<members::post>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `reply` field
        pub struct reply(());
        ///Marker type for the `post` field
        pub struct post(());
    }
}

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

impl<'a> ActivitySubscription<'a> {
    /// Create a new builder for this type
    pub fn new() -> ActivitySubscriptionBuilder<'a, activity_subscription_state::Empty> {
        ActivitySubscriptionBuilder::new()
    }
}

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

impl<'a, S> ActivitySubscriptionBuilder<'a, S>
where
    S: activity_subscription_state::State,
    S::Post: activity_subscription_state::IsUnset,
{
    /// Set the `post` field (required)
    pub fn post(
        mut self,
        value: impl Into<bool>,
    ) -> ActivitySubscriptionBuilder<'a, activity_subscription_state::SetPost<S>> {
        self._fields.0 = Option::Some(value.into());
        ActivitySubscriptionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ActivitySubscriptionBuilder<'a, S>
where
    S: activity_subscription_state::State,
    S::Reply: activity_subscription_state::IsUnset,
{
    /// Set the `reply` field (required)
    pub fn reply(
        mut self,
        value: impl Into<bool>,
    ) -> ActivitySubscriptionBuilder<'a, activity_subscription_state::SetReply<S>> {
        self._fields.1 = Option::Some(value.into());
        ActivitySubscriptionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ActivitySubscriptionBuilder<'a, S>
where
    S: activity_subscription_state::State,
    S::Reply: activity_subscription_state::IsSet,
    S::Post: activity_subscription_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ActivitySubscription<'a> {
        ActivitySubscription {
            post: self._fields.0.unwrap(),
            reply: self._fields.1.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>,
        >,
    ) -> ActivitySubscription<'a> {
        ActivitySubscription {
            post: self._fields.0.unwrap(),
            reply: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_app_bsky_notification_defs() -> 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.bsky.notification.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("activitySubscription"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("post"), SmolStr::new_static("reply")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("post"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reply"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("chatPreference"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("include"), SmolStr::new_static("push")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("include"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("push"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("filterablePreference"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("include"), SmolStr::new_static("list"),
                            SmolStr::new_static("push")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("include"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("list"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("push"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("preference"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("list"), SmolStr::new_static("push")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("list"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("push"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("preferences"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("chat"), SmolStr::new_static("follow"),
                            SmolStr::new_static("like"),
                            SmolStr::new_static("likeViaRepost"),
                            SmolStr::new_static("mention"), SmolStr::new_static("quote"),
                            SmolStr::new_static("reply"), SmolStr::new_static("repost"),
                            SmolStr::new_static("repostViaRepost"),
                            SmolStr::new_static("starterpackJoined"),
                            SmolStr::new_static("subscribedPost"),
                            SmolStr::new_static("unverified"),
                            SmolStr::new_static("verified")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("chat"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#chatPreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("follow"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("like"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("likeViaRepost"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mention"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("quote"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reply"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("repost"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("repostViaRepost"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#filterablePreference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("starterpackJoined"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#preference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subscribedPost"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#preference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("unverified"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#preference"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("verified"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#preference"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordDeleted"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("subjectActivitySubscription"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Object used to store activity subscription data in stash.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("subject"),
                            SmolStr::new_static("activitySubscription")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("activitySubscription"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#activitySubscription"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subject"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod chat_preference_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 Push;
        type Include;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Push = Unset;
        type Include = Unset;
    }
    ///State transition - sets the `push` field to Set
    pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPush<S> {}
    impl<S: State> State for SetPush<S> {
        type Push = Set<members::push>;
        type Include = S::Include;
    }
    ///State transition - sets the `include` field to Set
    pub struct SetInclude<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetInclude<S> {}
    impl<S: State> State for SetInclude<S> {
        type Push = S::Push;
        type Include = Set<members::include>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `push` field
        pub struct push(());
        ///Marker type for the `include` field
        pub struct include(());
    }
}

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

impl<'a> ChatPreference<'a> {
    /// Create a new builder for this type
    pub fn new() -> ChatPreferenceBuilder<'a, chat_preference_state::Empty> {
        ChatPreferenceBuilder::new()
    }
}

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

impl<'a, S> ChatPreferenceBuilder<'a, S>
where
    S: chat_preference_state::State,
    S::Include: chat_preference_state::IsUnset,
{
    /// Set the `include` field (required)
    pub fn include(
        mut self,
        value: impl Into<ChatPreferenceInclude<'a>>,
    ) -> ChatPreferenceBuilder<'a, chat_preference_state::SetInclude<S>> {
        self._fields.0 = Option::Some(value.into());
        ChatPreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ChatPreferenceBuilder<'a, S>
where
    S: chat_preference_state::State,
    S::Push: chat_preference_state::IsUnset,
{
    /// Set the `push` field (required)
    pub fn push(
        mut self,
        value: impl Into<bool>,
    ) -> ChatPreferenceBuilder<'a, chat_preference_state::SetPush<S>> {
        self._fields.1 = Option::Some(value.into());
        ChatPreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ChatPreferenceBuilder<'a, S>
where
    S: chat_preference_state::State,
    S::Push: chat_preference_state::IsSet,
    S::Include: chat_preference_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ChatPreference<'a> {
        ChatPreference {
            include: self._fields.0.unwrap(),
            push: self._fields.1.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>,
        >,
    ) -> ChatPreference<'a> {
        ChatPreference {
            include: self._fields.0.unwrap(),
            push: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod filterable_preference_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 List;
        type Include;
        type Push;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type List = Unset;
        type Include = Unset;
        type Push = Unset;
    }
    ///State transition - sets the `list` field to Set
    pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetList<S> {}
    impl<S: State> State for SetList<S> {
        type List = Set<members::list>;
        type Include = S::Include;
        type Push = S::Push;
    }
    ///State transition - sets the `include` field to Set
    pub struct SetInclude<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetInclude<S> {}
    impl<S: State> State for SetInclude<S> {
        type List = S::List;
        type Include = Set<members::include>;
        type Push = S::Push;
    }
    ///State transition - sets the `push` field to Set
    pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPush<S> {}
    impl<S: State> State for SetPush<S> {
        type List = S::List;
        type Include = S::Include;
        type Push = Set<members::push>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `list` field
        pub struct list(());
        ///Marker type for the `include` field
        pub struct include(());
        ///Marker type for the `push` field
        pub struct push(());
    }
}

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

impl<'a> FilterablePreference<'a> {
    /// Create a new builder for this type
    pub fn new() -> FilterablePreferenceBuilder<'a, filterable_preference_state::Empty> {
        FilterablePreferenceBuilder::new()
    }
}

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

impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
    S: filterable_preference_state::State,
    S::Include: filterable_preference_state::IsUnset,
{
    /// Set the `include` field (required)
    pub fn include(
        mut self,
        value: impl Into<FilterablePreferenceInclude<'a>>,
    ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetInclude<S>> {
        self._fields.0 = Option::Some(value.into());
        FilterablePreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
    S: filterable_preference_state::State,
    S::List: filterable_preference_state::IsUnset,
{
    /// Set the `list` field (required)
    pub fn list(
        mut self,
        value: impl Into<bool>,
    ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetList<S>> {
        self._fields.1 = Option::Some(value.into());
        FilterablePreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
    S: filterable_preference_state::State,
    S::Push: filterable_preference_state::IsUnset,
{
    /// Set the `push` field (required)
    pub fn push(
        mut self,
        value: impl Into<bool>,
    ) -> FilterablePreferenceBuilder<'a, filterable_preference_state::SetPush<S>> {
        self._fields.2 = Option::Some(value.into());
        FilterablePreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> FilterablePreferenceBuilder<'a, S>
where
    S: filterable_preference_state::State,
    S::List: filterable_preference_state::IsSet,
    S::Include: filterable_preference_state::IsSet,
    S::Push: filterable_preference_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> FilterablePreference<'a> {
        FilterablePreference {
            include: self._fields.0.unwrap(),
            list: self._fields.1.unwrap(),
            push: self._fields.2.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>,
        >,
    ) -> FilterablePreference<'a> {
        FilterablePreference {
            include: self._fields.0.unwrap(),
            list: self._fields.1.unwrap(),
            push: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod preference_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 Push;
        type List;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Push = Unset;
        type List = Unset;
    }
    ///State transition - sets the `push` field to Set
    pub struct SetPush<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetPush<S> {}
    impl<S: State> State for SetPush<S> {
        type Push = Set<members::push>;
        type List = S::List;
    }
    ///State transition - sets the `list` field to Set
    pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetList<S> {}
    impl<S: State> State for SetList<S> {
        type Push = S::Push;
        type List = Set<members::list>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `push` field
        pub struct push(());
        ///Marker type for the `list` field
        pub struct list(());
    }
}

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

impl<'a> Preference<'a> {
    /// Create a new builder for this type
    pub fn new() -> PreferenceBuilder<'a, preference_state::Empty> {
        PreferenceBuilder::new()
    }
}

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

impl<'a, S> PreferenceBuilder<'a, S>
where
    S: preference_state::State,
    S::List: preference_state::IsUnset,
{
    /// Set the `list` field (required)
    pub fn list(
        mut self,
        value: impl Into<bool>,
    ) -> PreferenceBuilder<'a, preference_state::SetList<S>> {
        self._fields.0 = Option::Some(value.into());
        PreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferenceBuilder<'a, S>
where
    S: preference_state::State,
    S::Push: preference_state::IsUnset,
{
    /// Set the `push` field (required)
    pub fn push(
        mut self,
        value: impl Into<bool>,
    ) -> PreferenceBuilder<'a, preference_state::SetPush<S>> {
        self._fields.1 = Option::Some(value.into());
        PreferenceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferenceBuilder<'a, S>
where
    S: preference_state::State,
    S::Push: preference_state::IsSet,
    S::List: preference_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Preference<'a> {
        Preference {
            list: self._fields.0.unwrap(),
            push: self._fields.1.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>,
        >,
    ) -> Preference<'a> {
        Preference {
            list: self._fields.0.unwrap(),
            push: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod preferences_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 Unverified;
        type Quote;
        type Verified;
        type Repost;
        type Follow;
        type StarterpackJoined;
        type Mention;
        type SubscribedPost;
        type Reply;
        type RepostViaRepost;
        type Chat;
        type LikeViaRepost;
        type Like;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Unverified = Unset;
        type Quote = Unset;
        type Verified = Unset;
        type Repost = Unset;
        type Follow = Unset;
        type StarterpackJoined = Unset;
        type Mention = Unset;
        type SubscribedPost = Unset;
        type Reply = Unset;
        type RepostViaRepost = Unset;
        type Chat = Unset;
        type LikeViaRepost = Unset;
        type Like = Unset;
    }
    ///State transition - sets the `unverified` field to Set
    pub struct SetUnverified<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUnverified<S> {}
    impl<S: State> State for SetUnverified<S> {
        type Unverified = Set<members::unverified>;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `quote` field to Set
    pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetQuote<S> {}
    impl<S: State> State for SetQuote<S> {
        type Unverified = S::Unverified;
        type Quote = Set<members::quote>;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `verified` field to Set
    pub struct SetVerified<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetVerified<S> {}
    impl<S: State> State for SetVerified<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = Set<members::verified>;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `repost` field to Set
    pub struct SetRepost<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRepost<S> {}
    impl<S: State> State for SetRepost<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = Set<members::repost>;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `follow` field to Set
    pub struct SetFollow<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetFollow<S> {}
    impl<S: State> State for SetFollow<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = Set<members::follow>;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `starterpack_joined` field to Set
    pub struct SetStarterpackJoined<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetStarterpackJoined<S> {}
    impl<S: State> State for SetStarterpackJoined<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = Set<members::starterpack_joined>;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `mention` field to Set
    pub struct SetMention<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMention<S> {}
    impl<S: State> State for SetMention<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = Set<members::mention>;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `subscribed_post` field to Set
    pub struct SetSubscribedPost<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubscribedPost<S> {}
    impl<S: State> State for SetSubscribedPost<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = Set<members::subscribed_post>;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `reply` field to Set
    pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReply<S> {}
    impl<S: State> State for SetReply<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = Set<members::reply>;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `repost_via_repost` field to Set
    pub struct SetRepostViaRepost<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRepostViaRepost<S> {}
    impl<S: State> State for SetRepostViaRepost<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = Set<members::repost_via_repost>;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `chat` field to Set
    pub struct SetChat<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetChat<S> {}
    impl<S: State> State for SetChat<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = Set<members::chat>;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = S::Like;
    }
    ///State transition - sets the `like_via_repost` field to Set
    pub struct SetLikeViaRepost<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLikeViaRepost<S> {}
    impl<S: State> State for SetLikeViaRepost<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = Set<members::like_via_repost>;
        type Like = S::Like;
    }
    ///State transition - sets the `like` field to Set
    pub struct SetLike<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLike<S> {}
    impl<S: State> State for SetLike<S> {
        type Unverified = S::Unverified;
        type Quote = S::Quote;
        type Verified = S::Verified;
        type Repost = S::Repost;
        type Follow = S::Follow;
        type StarterpackJoined = S::StarterpackJoined;
        type Mention = S::Mention;
        type SubscribedPost = S::SubscribedPost;
        type Reply = S::Reply;
        type RepostViaRepost = S::RepostViaRepost;
        type Chat = S::Chat;
        type LikeViaRepost = S::LikeViaRepost;
        type Like = Set<members::like>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `unverified` field
        pub struct unverified(());
        ///Marker type for the `quote` field
        pub struct quote(());
        ///Marker type for the `verified` field
        pub struct verified(());
        ///Marker type for the `repost` field
        pub struct repost(());
        ///Marker type for the `follow` field
        pub struct follow(());
        ///Marker type for the `starterpack_joined` field
        pub struct starterpack_joined(());
        ///Marker type for the `mention` field
        pub struct mention(());
        ///Marker type for the `subscribed_post` field
        pub struct subscribed_post(());
        ///Marker type for the `reply` field
        pub struct reply(());
        ///Marker type for the `repost_via_repost` field
        pub struct repost_via_repost(());
        ///Marker type for the `chat` field
        pub struct chat(());
        ///Marker type for the `like_via_repost` field
        pub struct like_via_repost(());
        ///Marker type for the `like` field
        pub struct like(());
    }
}

/// Builder for constructing an instance of this type
pub struct PreferencesBuilder<'a, S: preferences_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<notification::ChatPreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::FilterablePreference<'a>>,
        Option<notification::Preference<'a>>,
        Option<notification::Preference<'a>>,
        Option<notification::Preference<'a>>,
        Option<notification::Preference<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Preferences<'a> {
    /// Create a new builder for this type
    pub fn new() -> PreferencesBuilder<'a, preferences_state::Empty> {
        PreferencesBuilder::new()
    }
}

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

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Chat: preferences_state::IsUnset,
{
    /// Set the `chat` field (required)
    pub fn chat(
        mut self,
        value: impl Into<notification::ChatPreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetChat<S>> {
        self._fields.0 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Follow: preferences_state::IsUnset,
{
    /// Set the `follow` field (required)
    pub fn follow(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetFollow<S>> {
        self._fields.1 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Like: preferences_state::IsUnset,
{
    /// Set the `like` field (required)
    pub fn like(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetLike<S>> {
        self._fields.2 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::LikeViaRepost: preferences_state::IsUnset,
{
    /// Set the `likeViaRepost` field (required)
    pub fn like_via_repost(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetLikeViaRepost<S>> {
        self._fields.3 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Mention: preferences_state::IsUnset,
{
    /// Set the `mention` field (required)
    pub fn mention(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetMention<S>> {
        self._fields.4 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Quote: preferences_state::IsUnset,
{
    /// Set the `quote` field (required)
    pub fn quote(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetQuote<S>> {
        self._fields.5 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Reply: preferences_state::IsUnset,
{
    /// Set the `reply` field (required)
    pub fn reply(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetReply<S>> {
        self._fields.6 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Repost: preferences_state::IsUnset,
{
    /// Set the `repost` field (required)
    pub fn repost(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetRepost<S>> {
        self._fields.7 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::RepostViaRepost: preferences_state::IsUnset,
{
    /// Set the `repostViaRepost` field (required)
    pub fn repost_via_repost(
        mut self,
        value: impl Into<notification::FilterablePreference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetRepostViaRepost<S>> {
        self._fields.8 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::StarterpackJoined: preferences_state::IsUnset,
{
    /// Set the `starterpackJoined` field (required)
    pub fn starterpack_joined(
        mut self,
        value: impl Into<notification::Preference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetStarterpackJoined<S>> {
        self._fields.9 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::SubscribedPost: preferences_state::IsUnset,
{
    /// Set the `subscribedPost` field (required)
    pub fn subscribed_post(
        mut self,
        value: impl Into<notification::Preference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetSubscribedPost<S>> {
        self._fields.10 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Unverified: preferences_state::IsUnset,
{
    /// Set the `unverified` field (required)
    pub fn unverified(
        mut self,
        value: impl Into<notification::Preference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetUnverified<S>> {
        self._fields.11 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Verified: preferences_state::IsUnset,
{
    /// Set the `verified` field (required)
    pub fn verified(
        mut self,
        value: impl Into<notification::Preference<'a>>,
    ) -> PreferencesBuilder<'a, preferences_state::SetVerified<S>> {
        self._fields.12 = Option::Some(value.into());
        PreferencesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PreferencesBuilder<'a, S>
where
    S: preferences_state::State,
    S::Unverified: preferences_state::IsSet,
    S::Quote: preferences_state::IsSet,
    S::Verified: preferences_state::IsSet,
    S::Repost: preferences_state::IsSet,
    S::Follow: preferences_state::IsSet,
    S::StarterpackJoined: preferences_state::IsSet,
    S::Mention: preferences_state::IsSet,
    S::SubscribedPost: preferences_state::IsSet,
    S::Reply: preferences_state::IsSet,
    S::RepostViaRepost: preferences_state::IsSet,
    S::Chat: preferences_state::IsSet,
    S::LikeViaRepost: preferences_state::IsSet,
    S::Like: preferences_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Preferences<'a> {
        Preferences {
            chat: self._fields.0.unwrap(),
            follow: self._fields.1.unwrap(),
            like: self._fields.2.unwrap(),
            like_via_repost: self._fields.3.unwrap(),
            mention: self._fields.4.unwrap(),
            quote: self._fields.5.unwrap(),
            reply: self._fields.6.unwrap(),
            repost: self._fields.7.unwrap(),
            repost_via_repost: self._fields.8.unwrap(),
            starterpack_joined: self._fields.9.unwrap(),
            subscribed_post: self._fields.10.unwrap(),
            unverified: self._fields.11.unwrap(),
            verified: self._fields.12.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>,
        >,
    ) -> Preferences<'a> {
        Preferences {
            chat: self._fields.0.unwrap(),
            follow: self._fields.1.unwrap(),
            like: self._fields.2.unwrap(),
            like_via_repost: self._fields.3.unwrap(),
            mention: self._fields.4.unwrap(),
            quote: self._fields.5.unwrap(),
            reply: self._fields.6.unwrap(),
            repost: self._fields.7.unwrap(),
            repost_via_repost: self._fields.8.unwrap(),
            starterpack_joined: self._fields.9.unwrap(),
            subscribed_post: self._fields.10.unwrap(),
            unverified: self._fields.11.unwrap(),
            verified: self._fields.12.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod subject_activity_subscription_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 Subject;
        type ActivitySubscription;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Subject = Unset;
        type ActivitySubscription = Unset;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubject<S> {}
    impl<S: State> State for SetSubject<S> {
        type Subject = Set<members::subject>;
        type ActivitySubscription = S::ActivitySubscription;
    }
    ///State transition - sets the `activity_subscription` field to Set
    pub struct SetActivitySubscription<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetActivitySubscription<S> {}
    impl<S: State> State for SetActivitySubscription<S> {
        type Subject = S::Subject;
        type ActivitySubscription = Set<members::activity_subscription>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `activity_subscription` field
        pub struct activity_subscription(());
    }
}

/// Builder for constructing an instance of this type
pub struct SubjectActivitySubscriptionBuilder<
    'a,
    S: subject_activity_subscription_state::State,
> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<notification::ActivitySubscription<'a>>, Option<Did<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> SubjectActivitySubscription<'a> {
    /// Create a new builder for this type
    pub fn new() -> SubjectActivitySubscriptionBuilder<
        'a,
        subject_activity_subscription_state::Empty,
    > {
        SubjectActivitySubscriptionBuilder::new()
    }
}

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

impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
where
    S: subject_activity_subscription_state::State,
    S::ActivitySubscription: subject_activity_subscription_state::IsUnset,
{
    /// Set the `activitySubscription` field (required)
    pub fn activity_subscription(
        mut self,
        value: impl Into<notification::ActivitySubscription<'a>>,
    ) -> SubjectActivitySubscriptionBuilder<
        'a,
        subject_activity_subscription_state::SetActivitySubscription<S>,
    > {
        self._fields.0 = Option::Some(value.into());
        SubjectActivitySubscriptionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
where
    S: subject_activity_subscription_state::State,
    S::Subject: subject_activity_subscription_state::IsUnset,
{
    /// Set the `subject` field (required)
    pub fn subject(
        mut self,
        value: impl Into<Did<'a>>,
    ) -> SubjectActivitySubscriptionBuilder<
        'a,
        subject_activity_subscription_state::SetSubject<S>,
    > {
        self._fields.1 = Option::Some(value.into());
        SubjectActivitySubscriptionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> SubjectActivitySubscriptionBuilder<'a, S>
where
    S: subject_activity_subscription_state::State,
    S::Subject: subject_activity_subscription_state::IsSet,
    S::ActivitySubscription: subject_activity_subscription_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> SubjectActivitySubscription<'a> {
        SubjectActivitySubscription {
            activity_subscription: self._fields.0.unwrap(),
            subject: self._fields.1.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>,
        >,
    ) -> SubjectActivitySubscription<'a> {
        SubjectActivitySubscription {
            activity_subscription: self._fields.0.unwrap(),
            subject: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}