// @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.

//! Generated bindings for the `app.bsky.notification` Lexicon namespace/module.
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, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Did;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ActivitySubscription<S: BosStr = DefaultStr> {
    pub post: bool,
    pub reply: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ChatPreference<S: BosStr = DefaultStr> {
    pub include: ChatPreferenceInclude<S>,
    pub push: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ChatPreferenceInclude<S: BosStr = DefaultStr> {
    All,
    Accepted,
    Other(S),
}

impl<S: BosStr> ChatPreferenceInclude<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::All => "all",
            Self::Accepted => "accepted",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "all" => Self::All,
            "accepted" => Self::Accepted,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for ChatPreferenceInclude<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ChatPreferenceInclude<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for ChatPreferenceInclude<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct FilterablePreference<S: BosStr = DefaultStr> {
    pub include: FilterablePreferenceInclude<S>,
    pub list: bool,
    pub push: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FilterablePreferenceInclude<S: BosStr = DefaultStr> {
    All,
    Follows,
    Other(S),
}

impl<S: BosStr> FilterablePreferenceInclude<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::All => "all",
            Self::Follows => "follows",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "all" => Self::All,
            "follows" => Self::Follows,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for FilterablePreferenceInclude<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for FilterablePreferenceInclude<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for FilterablePreferenceInclude<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Preference<S: BosStr = DefaultStr> {
    pub list: bool,
    pub push: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Preferences<S: BosStr = DefaultStr> {
    pub chat: notification::ChatPreference<S>,
    pub follow: notification::FilterablePreference<S>,
    pub like: notification::FilterablePreference<S>,
    pub like_via_repost: notification::FilterablePreference<S>,
    pub mention: notification::FilterablePreference<S>,
    pub quote: notification::FilterablePreference<S>,
    pub reply: notification::FilterablePreference<S>,
    pub repost: notification::FilterablePreference<S>,
    pub repost_via_repost: notification::FilterablePreference<S>,
    pub starterpack_joined: notification::Preference<S>,
    pub subscribed_post: notification::Preference<S>,
    pub unverified: notification::Preference<S>,
    pub verified: notification::Preference<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RecordDeleted<S: BosStr = DefaultStr> {
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Object used to store activity subscription data in stash.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SubjectActivitySubscription<S: BosStr = DefaultStr> {
    pub activity_subscription: notification::ActivitySubscription<S>,
    pub subject: Did<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

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

/// Builder for constructing an instance of this type.
pub struct ActivitySubscriptionBuilder<
    St: activity_subscription_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<bool>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

impl ActivitySubscription<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> ActivitySubscriptionBuilder<
        activity_subscription_state::Empty,
        DefaultStr,
    > {
        ActivitySubscriptionBuilder::new()
    }
}

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

impl ActivitySubscriptionBuilder<activity_subscription_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        ActivitySubscriptionBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _type: PhantomData,
        }
    }
}

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

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

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

impl<St, S: BosStr> ActivitySubscriptionBuilder<St, S>
where
    St: activity_subscription_state::State,
    St::Post: activity_subscription_state::IsSet,
    St::Reply: activity_subscription_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ActivitySubscription<S> {
        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<SmolStr, Data<S>>,
    ) -> ActivitySubscription<S> {
        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 Include;
        type Push;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Include = Unset;
        type Push = Unset;
    }
    ///State transition - sets the `include` field to Set
    pub struct SetInclude<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetInclude<St> {}
    impl<St: State> State for SetInclude<St> {
        type Include = Set<members::include>;
        type Push = St::Push;
    }
    ///State transition - sets the `push` field to Set
    pub struct SetPush<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPush<St> {}
    impl<St: State> State for SetPush<St> {
        type Include = St::Include;
        type Push = Set<members::push>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///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 ChatPreferenceBuilder<
    St: chat_preference_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<ChatPreferenceInclude<S>>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

impl ChatPreference<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> ChatPreferenceBuilder<chat_preference_state::Empty, DefaultStr> {
        ChatPreferenceBuilder::new()
    }
}

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

impl ChatPreferenceBuilder<chat_preference_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        ChatPreferenceBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _type: PhantomData,
        }
    }
}

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

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

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

impl<St, S: BosStr> ChatPreferenceBuilder<St, S>
where
    St: chat_preference_state::State,
    St::Include: chat_preference_state::IsSet,
    St::Push: chat_preference_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ChatPreference<S> {
        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<SmolStr, Data<S>>,
    ) -> ChatPreference<S> {
        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 Include;
        type List;
        type Push;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Include = Unset;
        type List = Unset;
        type Push = Unset;
    }
    ///State transition - sets the `include` field to Set
    pub struct SetInclude<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetInclude<St> {}
    impl<St: State> State for SetInclude<St> {
        type Include = Set<members::include>;
        type List = St::List;
        type Push = St::Push;
    }
    ///State transition - sets the `list` field to Set
    pub struct SetList<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetList<St> {}
    impl<St: State> State for SetList<St> {
        type Include = St::Include;
        type List = Set<members::list>;
        type Push = St::Push;
    }
    ///State transition - sets the `push` field to Set
    pub struct SetPush<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPush<St> {}
    impl<St: State> State for SetPush<St> {
        type Include = St::Include;
        type List = St::List;
        type Push = Set<members::push>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `include` field
        pub struct include(());
        ///Marker type for the `list` field
        pub struct list(());
        ///Marker type for the `push` field
        pub struct push(());
    }
}

/// Builder for constructing an instance of this type.
pub struct FilterablePreferenceBuilder<
    St: filterable_preference_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<FilterablePreferenceInclude<S>>, Option<bool>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

impl FilterablePreference<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> FilterablePreferenceBuilder<
        filterable_preference_state::Empty,
        DefaultStr,
    > {
        FilterablePreferenceBuilder::new()
    }
}

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

impl FilterablePreferenceBuilder<filterable_preference_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        FilterablePreferenceBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

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

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

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

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

impl<St, S: BosStr> FilterablePreferenceBuilder<St, S>
where
    St: filterable_preference_state::State,
    St::Include: filterable_preference_state::IsSet,
    St::List: filterable_preference_state::IsSet,
    St::Push: filterable_preference_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> FilterablePreference<S> {
        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<SmolStr, Data<S>>,
    ) -> FilterablePreference<S> {
        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 List;
        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 Push = Unset;
    }
    ///State transition - sets the `list` field to Set
    pub struct SetList<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetList<St> {}
    impl<St: State> State for SetList<St> {
        type List = Set<members::list>;
        type Push = St::Push;
    }
    ///State transition - sets the `push` field to Set
    pub struct SetPush<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPush<St> {}
    impl<St: State> State for SetPush<St> {
        type List = St::List;
        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 `push` field
        pub struct push(());
    }
}

/// Builder for constructing an instance of this type.
pub struct PreferenceBuilder<St: preference_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<bool>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

impl Preference<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> PreferenceBuilder<preference_state::Empty, DefaultStr> {
        PreferenceBuilder::new()
    }
}

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

impl PreferenceBuilder<preference_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        PreferenceBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _type: PhantomData,
        }
    }
}

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

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

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

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

/// Builder for constructing an instance of this type.
pub struct PreferencesBuilder<St: preferences_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<notification::ChatPreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::FilterablePreference<S>>,
        Option<notification::Preference<S>>,
        Option<notification::Preference<S>>,
        Option<notification::Preference<S>>,
        Option<notification::Preference<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl Preferences<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> PreferencesBuilder<preferences_state::Empty, DefaultStr> {
        PreferencesBuilder::new()
    }
}

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

impl PreferencesBuilder<preferences_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        PreferencesBuilder {
            _state: PhantomData,
            _fields: (
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
            ),
            _type: PhantomData,
        }
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<St, S: BosStr> PreferencesBuilder<St, S>
where
    St: preferences_state::State,
    St::Chat: preferences_state::IsSet,
    St::Follow: preferences_state::IsSet,
    St::Like: preferences_state::IsSet,
    St::LikeViaRepost: preferences_state::IsSet,
    St::Mention: preferences_state::IsSet,
    St::Quote: preferences_state::IsSet,
    St::Reply: preferences_state::IsSet,
    St::Repost: preferences_state::IsSet,
    St::RepostViaRepost: preferences_state::IsSet,
    St::StarterpackJoined: preferences_state::IsSet,
    St::SubscribedPost: preferences_state::IsSet,
    St::Unverified: preferences_state::IsSet,
    St::Verified: preferences_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Preferences<S> {
        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<SmolStr, Data<S>>,
    ) -> Preferences<S> {
        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 ActivitySubscription;
        type Subject;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type ActivitySubscription = Unset;
        type Subject = Unset;
    }
    ///State transition - sets the `activity_subscription` field to Set
    pub struct SetActivitySubscription<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetActivitySubscription<St> {}
    impl<St: State> State for SetActivitySubscription<St> {
        type ActivitySubscription = Set<members::activity_subscription>;
        type Subject = St::Subject;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubject<St> {}
    impl<St: State> State for SetSubject<St> {
        type ActivitySubscription = St::ActivitySubscription;
        type Subject = Set<members::subject>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `activity_subscription` field
        pub struct activity_subscription(());
        ///Marker type for the `subject` field
        pub struct subject(());
    }
}

/// Builder for constructing an instance of this type.
pub struct SubjectActivitySubscriptionBuilder<
    St: subject_activity_subscription_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<notification::ActivitySubscription<S>>, Option<Did<S>>),
    _type: PhantomData<fn() -> S>,
}

impl SubjectActivitySubscription<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> SubjectActivitySubscriptionBuilder<
        subject_activity_subscription_state::Empty,
        DefaultStr,
    > {
        SubjectActivitySubscriptionBuilder::new()
    }
}

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

impl SubjectActivitySubscriptionBuilder<
    subject_activity_subscription_state::Empty,
    DefaultStr,
> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        SubjectActivitySubscriptionBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _type: PhantomData,
        }
    }
}

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

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

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

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