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

//! Generated bindings for the `sh.weaver.notebook` Lexicon namespace/module.
pub mod authors;
pub mod book;
pub mod chapter;
pub mod colour_scheme;
pub mod entry;
pub mod get_book_entry;
pub mod get_chapter;
pub mod get_continue_reading;
pub mod get_entry;
pub mod get_entry_by_title;
pub mod get_entry_detail;
pub mod get_entry_feed;
pub mod get_entry_notebooks;
pub mod get_notebook;
pub mod get_notebook_by_title;
pub mod get_notebook_chapters;
pub mod get_notebook_detail;
pub mod get_notebook_feed;
pub mod get_page;
pub mod get_published_versions;
pub mod get_reading_history;
pub mod get_similar_notebooks;
pub mod get_suggested_notebooks;
pub mod page;
pub mod resolve_entry;
pub mod resolve_notebook;
pub mod resolve_version_conflict;
pub mod search_entries;
pub mod search_notebooks;
pub mod theme;
pub mod update_reading_progress;


#[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::blob::BlobRef;
use jacquard_common::types::string::{Did, AtUri, Cid, Datetime};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::sh_weaver::actor::ProfileDataView;
use crate::sh_weaver::actor::ProfileViewBasic;
use crate::sh_weaver::notebook;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AuthorListView<S: BosStr = DefaultStr> {
    pub index: i64,
    pub record: ProfileDataView<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uri: Option<AtUri<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)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct BookEntryRef<S: BosStr = DefaultStr> {
    pub entry: notebook::EntryView<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// An ordered entry in a Weaver notebook.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct BookEntryView<S: BosStr = DefaultStr> {
    pub entry: notebook::EntryView<S>,
    pub index: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next: Option<notebook::BookEntryRef<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub prev: Option<notebook::BookEntryRef<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// An entry within a chapter context.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ChapterEntryView<S: BosStr = DefaultStr> {
    pub entry: notebook::EntryView<S>,
    pub index: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next: Option<notebook::BookEntryRef<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub prev: Option<notebook::BookEntryRef<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Hydrated view of a chapter.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ChapterView<S: BosStr = DefaultStr> {
    pub authors: Vec<notebook::AuthorListView<S>>,
    pub cid: Cid<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub entry_count: Option<i64>,
    pub indexed_at: Datetime,
    pub notebook: notebook::NotebookView<S>,
    pub record: Data<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<notebook::Tags<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<notebook::Title<S>>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The format of the content. This is used to determine how to render the content.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ContentFormat<S: BosStr = DefaultStr> {
    ///The format of the content. This is used to determine how to render the content.  Defaults to `"weaver"`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_content_format_markdown")]
    pub markdown: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Author-applied content rating.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContentRating<S: BosStr = DefaultStr> {
    General,
    Teen,
    Mature,
    Explicit,
    Other(S),
}

impl<S: BosStr> ContentRating<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::General => "general",
            Self::Teen => "teen",
            Self::Mature => "mature",
            Self::Explicit => "explicit",
            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() {
            "general" => Self::General,
            "teen" => Self::Teen,
            "mature" => Self::Mature,
            "explicit" => Self::Explicit,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for ContentRating<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 ContentRating<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> jacquard_common::IntoStatic for ContentRating<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ContentRating<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ContentRating::General => ContentRating::General,
            ContentRating::Teen => ContentRating::Teen,
            ContentRating::Mature => ContentRating::Mature,
            ContentRating::Explicit => ContentRating::Explicit,
            ContentRating::Other(v) => ContentRating::Other(v.into_static()),
        }
    }
}

/// Author-applied content warning.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContentWarning<S: BosStr = DefaultStr> {
    Violence,
    GraphicViolence,
    Death,
    MajorCharacterDeath,
    SexualContent,
    ExplicitSexualContent,
    Language,
    SubstanceUse,
    SelfHarm,
    Abuse,
    DisturbingImagery,
    Other(S),
}

impl<S: BosStr> ContentWarning<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Violence => "violence",
            Self::GraphicViolence => "graphic-violence",
            Self::Death => "death",
            Self::MajorCharacterDeath => "major-character-death",
            Self::SexualContent => "sexual-content",
            Self::ExplicitSexualContent => "explicit-sexual-content",
            Self::Language => "language",
            Self::SubstanceUse => "substance-use",
            Self::SelfHarm => "self-harm",
            Self::Abuse => "abuse",
            Self::DisturbingImagery => "disturbing-imagery",
            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() {
            "violence" => Self::Violence,
            "graphic-violence" => Self::GraphicViolence,
            "death" => Self::Death,
            "major-character-death" => Self::MajorCharacterDeath,
            "sexual-content" => Self::SexualContent,
            "explicit-sexual-content" => Self::ExplicitSexualContent,
            "language" => Self::Language,
            "substance-use" => Self::SubstanceUse,
            "self-harm" => Self::SelfHarm,
            "abuse" => Self::Abuse,
            "disturbing-imagery" => Self::DisturbingImagery,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for ContentWarning<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 ContentWarning<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> jacquard_common::IntoStatic for ContentWarning<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ContentWarning<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ContentWarning::Violence => ContentWarning::Violence,
            ContentWarning::GraphicViolence => ContentWarning::GraphicViolence,
            ContentWarning::Death => ContentWarning::Death,
            ContentWarning::MajorCharacterDeath => ContentWarning::MajorCharacterDeath,
            ContentWarning::SexualContent => ContentWarning::SexualContent,
            ContentWarning::ExplicitSexualContent => {
                ContentWarning::ExplicitSexualContent
            }
            ContentWarning::Language => ContentWarning::Language,
            ContentWarning::SubstanceUse => ContentWarning::SubstanceUse,
            ContentWarning::SelfHarm => ContentWarning::SelfHarm,
            ContentWarning::Abuse => ContentWarning::Abuse,
            ContentWarning::DisturbingImagery => ContentWarning::DisturbingImagery,
            ContentWarning::Other(v) => ContentWarning::Other(v.into_static()),
        }
    }
}

/// Author-applied content warnings.
pub type ContentWarnings<S = DefaultStr> = Vec<notebook::ContentWarning<S>>;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct EntryView<S: BosStr = DefaultStr> {
    pub authors: Vec<notebook::AuthorListView<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bookmark_count: Option<i64>,
    pub cid: Cid<S>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub like_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub path: Option<notebook::Path<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub permissions: Option<notebook::PermissionsState<S>>,
    pub record: Data<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rendered_view: Option<notebook::RenderedView<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<notebook::Tags<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<notebook::Title<S>>,
    pub uri: AtUri<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_bookmark: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_like: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_reading_progress: Option<notebook::ReadingProgress<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Entry with feed-specific context (discovery reason, notebook context).

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

/// Minimal notebook context for feed display.

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

///Why this entry appeared in the feed.

#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum FeedReason<S: BosStr = DefaultStr> {
    #[serde(rename = "sh.weaver.notebook.defs#reasonLike")]
    ReasonLike(Box<notebook::ReasonLike<S>>),
    #[serde(rename = "sh.weaver.notebook.defs#reasonBookmark")]
    ReasonBookmark(Box<notebook::ReasonBookmark<S>>),
    #[serde(rename = "sh.weaver.notebook.defs#reasonSubscription")]
    ReasonSubscription(Box<notebook::ReasonSubscription<S>>),
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct NotebookView<S: BosStr = DefaultStr> {
    pub authors: Vec<notebook::AuthorListView<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bookmark_count: Option<i64>,
    pub cid: Cid<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub entry_count: Option<i64>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub like_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub path: Option<notebook::Path<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub permissions: Option<notebook::PermissionsState<S>>,
    pub record: Data<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscriber_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<notebook::Tags<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<notebook::Title<S>>,
    pub uri: AtUri<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_bookmark: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_like: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_reading_progress: Option<notebook::ReadingProgress<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer_subscription: Option<AtUri<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Hydrated view of a page (entries displayed together).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PageView<S: BosStr = DefaultStr> {
    pub cid: Cid<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub entry_count: Option<i64>,
    pub indexed_at: Datetime,
    pub notebook: notebook::NotebookView<S>,
    pub record: Data<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<notebook::Tags<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<notebook::Title<S>>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The path of the notebook.
pub type Path<S = DefaultStr> = S;
/// A single permission grant. For resource authority: source=resource URI, grantedAt=createdAt. For invitees: source=invite URI, grantedAt=accept createdAt.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PermissionGrant<S: BosStr = DefaultStr> {
    pub did: Did<S>,
    ///For authority: record createdAt. For invitees: accept createdAt
    pub granted_at: Datetime,
    ///direct = this resource (includes authority), inherited = via notebook invite
    pub scope: PermissionGrantScope<S>,
    ///For authority: resource URI. For invitees: invite URI
    pub source: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// direct = this resource (includes authority), inherited = via notebook invite

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

impl<S: BosStr> PermissionGrantScope<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Direct => "direct",
            Self::Inherited => "inherited",
            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() {
            "direct" => Self::Direct,
            "inherited" => Self::Inherited,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for PermissionGrantScope<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 PermissionGrantScope<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 PermissionGrantScope<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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

/// ACL-style permissions for a resource. Separate from authors (who contributed).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PermissionsState<S: BosStr = DefaultStr> {
    ///DIDs that can edit this resource
    pub editors: Vec<notebook::PermissionGrant<S>>,
    ///DIDs that can view (future use)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewers: Option<Vec<notebook::PermissionGrant<S>>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A published version of an entry in a collaborator's repo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PublishedVersionView<S: BosStr = DefaultStr> {
    pub cid: Cid<S>,
    ///If content differs, the version it diverged from
    #[serde(skip_serializing_if = "Option::is_none")]
    pub diverged_from: Option<StrongRef<S>>,
    ///True if this is the 'primary' version (owner's repo)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub is_canonical: Option<bool>,
    pub published_at: Datetime,
    pub publisher: ProfileViewBasic<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Viewer's reading progress (appview-side state, not a record).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReadingProgress<S: BosStr = DefaultStr> {
    ///Last entry the viewer was reading.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub current_entry: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub finished_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_read_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub percent_complete: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub started_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<ReadingProgressStatus<S>>,
    #[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 ReadingProgressStatus<S: BosStr = DefaultStr> {
    Reading,
    Finished,
    Abandoned,
    WantToRead,
    Other(S),
}

impl<S: BosStr> ReadingProgressStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Reading => "reading",
            Self::Finished => "finished",
            Self::Abandoned => "abandoned",
            Self::WantToRead => "want-to-read",
            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() {
            "reading" => Self::Reading,
            "finished" => Self::Finished,
            "abandoned" => Self::Abandoned,
            "want-to-read" => Self::WantToRead,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for ReadingProgressStatus<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 ReadingProgressStatus<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 ReadingProgressStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ReadingProgressStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ReadingProgressStatus<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ReadingProgressStatus::Reading => ReadingProgressStatus::Reading,
            ReadingProgressStatus::Finished => ReadingProgressStatus::Finished,
            ReadingProgressStatus::Abandoned => ReadingProgressStatus::Abandoned,
            ReadingProgressStatus::WantToRead => ReadingProgressStatus::WantToRead,
            ReadingProgressStatus::Other(v) => {
                ReadingProgressStatus::Other(v.into_static())
            }
        }
    }
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReasonBookmark<S: BosStr = DefaultStr> {
    pub by: ProfileViewBasic<S>,
    pub indexed_at: Datetime,
    #[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 ReasonLike<S: BosStr = DefaultStr> {
    pub by: ProfileViewBasic<S>,
    pub indexed_at: Datetime,
    #[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 ReasonSubscription<S: BosStr = DefaultStr> {
    pub indexed_at: Datetime,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// View of a rendered and cached notebook entry

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

/// An array of tags associated with the notebook entry. Tags can help categorize and organize entries.
pub type Tags<S = DefaultStr> = Vec<S>;
/// The title of the notebook entry.
pub type Title<S = DefaultStr> = S;
impl<S: BosStr> LexiconSchema for AuthorListView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "authorListView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for BookEntryRef<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "bookEntryRef"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for BookEntryView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "bookEntryView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ChapterEntryView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "chapterEntryView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ChapterView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "chapterView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ContentFormat<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "contentFormat"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for EntryView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "entryView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for FeedEntryView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "feedEntryView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for FeedNotebookContext<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "feedNotebookContext"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for NotebookView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "notebookView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for PageView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "pageView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for PermissionGrant<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "permissionGrant"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for PermissionsState<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "permissionsState"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for PublishedVersionView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "publishedVersionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReadingProgress<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "readingProgress"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.percent_complete {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("percent_complete"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.percent_complete {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("percent_complete"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReasonBookmark<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "reasonBookmark"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReasonLike<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "reasonLike"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReasonSubscription<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "reasonSubscription"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RenderedView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.notebook.defs"
    }
    fn def_name() -> &'static str {
        "renderedView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_notebook_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.css {
            {
                let size = value.blob().size;
                if size > 1000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("css"),
                        max: 1000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.css {
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["text/css"];
                let matched = accepted
                    .iter()
                    .any(|pattern| {
                        if *pattern == "*/*" {
                            true
                        } else if pattern.ends_with("/*") {
                            let prefix = &pattern[..pattern.len() - 2];
                            mime.starts_with(prefix)
                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
                        } else {
                            mime == *pattern
                        }
                    });
                if !matched {
                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
                        path: ValidationPath::from_field("css"),
                        accepted: vec!["text/css".to_string()],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        {
            let value = &self.html;
            {
                let size = value.blob().size;
                if size > 1000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("html"),
                        max: 1000000usize,
                        actual: size,
                    });
                }
            }
        }
        {
            let value = &self.html;
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["text/html"];
                let matched = accepted
                    .iter()
                    .any(|pattern| {
                        if *pattern == "*/*" {
                            true
                        } else if pattern.ends_with("/*") {
                            let prefix = &pattern[..pattern.len() - 2];
                            mime.starts_with(prefix)
                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
                        } else {
                            mime == *pattern
                        }
                    });
                if !matched {
                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
                        path: ValidationPath::from_field("html"),
                        accepted: vec!["text/html".to_string()],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        Ok(())
    }
}

pub mod author_list_view_state {

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

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

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

impl<S: BosStr> AuthorListView<S> {
    /// Create a new builder for this type
    pub fn builder() -> AuthorListViewBuilder<author_list_view_state::Empty, S> {
        AuthorListViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> AuthorListViewBuilder<St, S>
where
    St: author_list_view_state::State,
    St::Index: author_list_view_state::IsUnset,
{
    /// Set the `index` field (required)
    pub fn index(
        mut self,
        value: impl Into<i64>,
    ) -> AuthorListViewBuilder<author_list_view_state::SetIndex<St>, S> {
        self._fields.0 = Option::Some(value.into());
        AuthorListViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> AuthorListViewBuilder<St, S>
where
    St: author_list_view_state::State,
    St::Record: author_list_view_state::IsUnset,
{
    /// Set the `record` field (required)
    pub fn record(
        mut self,
        value: impl Into<ProfileDataView<S>>,
    ) -> AuthorListViewBuilder<author_list_view_state::SetRecord<St>, S> {
        self._fields.1 = Option::Some(value.into());
        AuthorListViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: author_list_view_state::State, S: BosStr> AuthorListViewBuilder<St, S> {
    /// Set the `uri` field (optional)
    pub fn uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `uri` field to an Option value (optional)
    pub fn maybe_uri(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> AuthorListViewBuilder<St, S>
where
    St: author_list_view_state::State,
    St::Index: author_list_view_state::IsSet,
    St::Record: author_list_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> AuthorListView<S> {
        AuthorListView {
            index: self._fields.0.unwrap(),
            record: self._fields.1.unwrap(),
            uri: self._fields.2,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> AuthorListView<S> {
        AuthorListView {
            index: self._fields.0.unwrap(),
            record: self._fields.1.unwrap(),
            uri: self._fields.2,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_sh_weaver_notebook_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("sh.weaver.notebook.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("authorListView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("record"), SmolStr::new_static("index")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("index"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "sh.weaver.actor.defs#profileDataView",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("bookEntryRef"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("entry")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("entry"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#entryView"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("bookEntryView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("An ordered entry in a Weaver notebook."),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("entry"), SmolStr::new_static("index")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("entry"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#entryView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("index"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("next"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#bookEntryRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("prev"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#bookEntryRef"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("chapterEntryView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("An entry within a chapter context."),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("entry"), SmolStr::new_static("index")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("entry"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#entryView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("index"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("next"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#bookEntryRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("prev"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#bookEntryRef"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("chapterView"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Hydrated view of a chapter.")),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("notebook"),
                            SmolStr::new_static("authors"),
                            SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("authors"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#authorListView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("entryCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notebook"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#notebookView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#tags"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#title"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("contentFormat"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "The format of the content. This is used to determine how to render the content.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("markdown"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The format of the content. This is used to determine how to render the content.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("contentRating"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static("Author-applied content rating."),
                    ),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("contentWarning"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static("Author-applied content warning."),
                    ),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("contentWarnings"),
                LexUserType::Array(LexArray {
                    items: LexArrayItem::Ref(LexRef {
                        r#ref: CowStr::new_static("#contentWarning"),
                        ..Default::default()
                    }),
                    max_length: Some(10usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("entryView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("authors"),
                            SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("authors"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#authorListView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("bookmarkCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("likeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("path"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#path"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("permissions"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#permissionsState"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("renderedView"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#renderedView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#tags"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#title"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerBookmark"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerLike"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerReadingProgress"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#readingProgress"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("feedEntryView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Entry with feed-specific context (discovery reason, notebook context).",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("entry")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("entry"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#entryView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notebookContext"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#feedNotebookContext"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reason"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#feedReason"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("feedNotebookContext"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Minimal notebook context for feed display."),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("uri"), SmolStr::new_static("title")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("path"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("feedReason"),
                LexUserType::Union(LexRefUnion {
                    refs: vec![
                        CowStr::new_static("#reasonLike"),
                        CowStr::new_static("#reasonBookmark"),
                        CowStr::new_static("#reasonSubscription")
                    ],
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("notebookView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("authors"),
                            SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("authors"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#authorListView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("bookmarkCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("entryCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("likeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("path"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#path"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("permissions"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#permissionsState"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subscriberCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#tags"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#title"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerBookmark"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerLike"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerReadingProgress"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#readingProgress"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerSubscription"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pageView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Hydrated view of a page (entries displayed together).",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("notebook"),
                            SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("entryCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notebook"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#notebookView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#tags"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#title"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("path"),
                LexUserType::String(LexString {
                    description: Some(CowStr::new_static("The path of the notebook.")),
                    max_length: Some(100usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("permissionGrant"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A single permission grant. For resource authority: source=resource URI, grantedAt=createdAt. For invitees: source=invite URI, grantedAt=accept createdAt.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("did"), SmolStr::new_static("scope"),
                            SmolStr::new_static("source"),
                            SmolStr::new_static("grantedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("grantedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "For authority: record createdAt. For invitees: accept createdAt",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("scope"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "direct = this resource (includes authority), inherited = via notebook invite",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("source"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "For authority: resource URI. For invitees: invite URI",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("permissionsState"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "ACL-style permissions for a resource. Separate from authors (who contributed).",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("editors")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("editors"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("DIDs that can edit this resource"),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#permissionGrant"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewers"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("DIDs that can view (future use)"),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#permissionGrant"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("publishedVersionView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A published version of an entry in a collaborator's repo.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("publisher"),
                            SmolStr::new_static("publishedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("divergedFrom"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("isCanonical"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("publishedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("publisher"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "sh.weaver.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("readingProgress"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Viewer's reading progress (appview-side state, not a record).",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("currentEntry"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Last entry the viewer was reading."),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("finishedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastReadAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("percentComplete"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("startedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reasonBookmark"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("by"), SmolStr::new_static("indexedAt")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("by"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "sh.weaver.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reasonLike"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("by"), SmolStr::new_static("indexedAt")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("by"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "sh.weaver.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reasonSubscription"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("indexedAt")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("renderedView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "View of a rendered and cached notebook entry",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("html")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("css"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("html"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("tags"),
                LexUserType::Array(LexArray {
                    items: LexArrayItem::String(LexString {
                        max_length: Some(64usize),
                        ..Default::default()
                    }),
                    max_length: Some(10usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("title"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static("The title of the notebook entry."),
                    ),
                    max_length: Some(300usize),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod book_entry_ref_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 Entry;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Entry = Unset;
    }
    ///State transition - sets the `entry` field to Set
    pub struct SetEntry<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetEntry<St> {}
    impl<St: State> State for SetEntry<St> {
        type Entry = Set<members::entry>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `entry` field
        pub struct entry(());
    }
}

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

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

impl<S: BosStr> BookEntryRef<S> {
    /// Create a new builder for this type
    pub fn builder() -> BookEntryRefBuilder<book_entry_ref_state::Empty, S> {
        BookEntryRefBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> BookEntryRefBuilder<St, S>
where
    St: book_entry_ref_state::State,
    St::Entry: book_entry_ref_state::IsUnset,
{
    /// Set the `entry` field (required)
    pub fn entry(
        mut self,
        value: impl Into<notebook::EntryView<S>>,
    ) -> BookEntryRefBuilder<book_entry_ref_state::SetEntry<St>, S> {
        self._fields.0 = Option::Some(value.into());
        BookEntryRefBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> BookEntryRefBuilder<St, S>
where
    St: book_entry_ref_state::State,
    St::Entry: book_entry_ref_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> BookEntryRef<S> {
        BookEntryRef {
            entry: self._fields.0.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> BookEntryRef<S> {
        BookEntryRef {
            entry: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod book_entry_view_state {

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

/// Builder for constructing an instance of this type.
pub struct BookEntryViewBuilder<
    St: book_entry_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<notebook::EntryView<S>>,
        Option<i64>,
        Option<notebook::BookEntryRef<S>>,
        Option<notebook::BookEntryRef<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> BookEntryView<S> {
    /// Create a new builder for this type
    pub fn builder() -> BookEntryViewBuilder<book_entry_view_state::Empty, S> {
        BookEntryViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> BookEntryViewBuilder<St, S>
where
    St: book_entry_view_state::State,
    St::Entry: book_entry_view_state::IsUnset,
{
    /// Set the `entry` field (required)
    pub fn entry(
        mut self,
        value: impl Into<notebook::EntryView<S>>,
    ) -> BookEntryViewBuilder<book_entry_view_state::SetEntry<St>, S> {
        self._fields.0 = Option::Some(value.into());
        BookEntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> BookEntryViewBuilder<St, S>
where
    St: book_entry_view_state::State,
    St::Index: book_entry_view_state::IsUnset,
{
    /// Set the `index` field (required)
    pub fn index(
        mut self,
        value: impl Into<i64>,
    ) -> BookEntryViewBuilder<book_entry_view_state::SetIndex<St>, S> {
        self._fields.1 = Option::Some(value.into());
        BookEntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: book_entry_view_state::State, S: BosStr> BookEntryViewBuilder<St, S> {
    /// Set the `next` field (optional)
    pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `next` field to an Option value (optional)
    pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: book_entry_view_state::State, S: BosStr> BookEntryViewBuilder<St, S> {
    /// Set the `prev` field (optional)
    pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `prev` field to an Option value (optional)
    pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> BookEntryViewBuilder<St, S>
where
    St: book_entry_view_state::State,
    St::Entry: book_entry_view_state::IsSet,
    St::Index: book_entry_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> BookEntryView<S> {
        BookEntryView {
            entry: self._fields.0.unwrap(),
            index: self._fields.1.unwrap(),
            next: self._fields.2,
            prev: self._fields.3,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> BookEntryView<S> {
        BookEntryView {
            entry: self._fields.0.unwrap(),
            index: self._fields.1.unwrap(),
            next: self._fields.2,
            prev: self._fields.3,
            extra_data: Some(extra_data),
        }
    }
}

pub mod chapter_entry_view_state {

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

/// Builder for constructing an instance of this type.
pub struct ChapterEntryViewBuilder<
    St: chapter_entry_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<notebook::EntryView<S>>,
        Option<i64>,
        Option<notebook::BookEntryRef<S>>,
        Option<notebook::BookEntryRef<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ChapterEntryView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ChapterEntryViewBuilder<chapter_entry_view_state::Empty, S> {
        ChapterEntryViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ChapterEntryViewBuilder<St, S>
where
    St: chapter_entry_view_state::State,
    St::Entry: chapter_entry_view_state::IsUnset,
{
    /// Set the `entry` field (required)
    pub fn entry(
        mut self,
        value: impl Into<notebook::EntryView<S>>,
    ) -> ChapterEntryViewBuilder<chapter_entry_view_state::SetEntry<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ChapterEntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ChapterEntryViewBuilder<St, S>
where
    St: chapter_entry_view_state::State,
    St::Index: chapter_entry_view_state::IsUnset,
{
    /// Set the `index` field (required)
    pub fn index(
        mut self,
        value: impl Into<i64>,
    ) -> ChapterEntryViewBuilder<chapter_entry_view_state::SetIndex<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ChapterEntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: chapter_entry_view_state::State, S: BosStr> ChapterEntryViewBuilder<St, S> {
    /// Set the `next` field (optional)
    pub fn next(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `next` field to an Option value (optional)
    pub fn maybe_next(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: chapter_entry_view_state::State, S: BosStr> ChapterEntryViewBuilder<St, S> {
    /// Set the `prev` field (optional)
    pub fn prev(mut self, value: impl Into<Option<notebook::BookEntryRef<S>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `prev` field to an Option value (optional)
    pub fn maybe_prev(mut self, value: Option<notebook::BookEntryRef<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> ChapterEntryViewBuilder<St, S>
where
    St: chapter_entry_view_state::State,
    St::Entry: chapter_entry_view_state::IsSet,
    St::Index: chapter_entry_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ChapterEntryView<S> {
        ChapterEntryView {
            entry: self._fields.0.unwrap(),
            index: self._fields.1.unwrap(),
            next: self._fields.2,
            prev: self._fields.3,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ChapterEntryView<S> {
        ChapterEntryView {
            entry: self._fields.0.unwrap(),
            index: self._fields.1.unwrap(),
            next: self._fields.2,
            prev: self._fields.3,
            extra_data: Some(extra_data),
        }
    }
}

pub mod chapter_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Authors;
        type Cid;
        type IndexedAt;
        type Notebook;
        type Record;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Authors = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type Notebook = Unset;
        type Record = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `authors` field to Set
    pub struct SetAuthors<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthors<St> {}
    impl<St: State> State for SetAuthors<St> {
        type Authors = Set<members::authors>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Authors = St::Authors;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `notebook` field to Set
    pub struct SetNotebook<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetNotebook<St> {}
    impl<St: State> State for SetNotebook<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = Set<members::notebook>;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `record` field to Set
    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRecord<St> {}
    impl<St: State> State for SetRecord<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = Set<members::record>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `authors` field
        pub struct authors(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `notebook` field
        pub struct notebook(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ChapterViewBuilder<St: chapter_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<notebook::AuthorListView<S>>>,
        Option<Cid<S>>,
        Option<i64>,
        Option<Datetime>,
        Option<notebook::NotebookView<S>>,
        Option<Data<S>>,
        Option<notebook::Tags<S>>,
        Option<notebook::Title<S>>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ChapterView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ChapterViewBuilder<chapter_view_state::Empty, S> {
        ChapterViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::Authors: chapter_view_state::IsUnset,
{
    /// Set the `authors` field (required)
    pub fn authors(
        mut self,
        value: impl Into<Vec<notebook::AuthorListView<S>>>,
    ) -> ChapterViewBuilder<chapter_view_state::SetAuthors<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ChapterViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::Cid: chapter_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> ChapterViewBuilder<chapter_view_state::SetCid<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ChapterViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: chapter_view_state::State, S: BosStr> ChapterViewBuilder<St, S> {
    /// Set the `entryCount` field (optional)
    pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `entryCount` field to an Option value (optional)
    pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::IndexedAt: chapter_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ChapterViewBuilder<chapter_view_state::SetIndexedAt<St>, S> {
        self._fields.3 = Option::Some(value.into());
        ChapterViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::Notebook: chapter_view_state::IsUnset,
{
    /// Set the `notebook` field (required)
    pub fn notebook(
        mut self,
        value: impl Into<notebook::NotebookView<S>>,
    ) -> ChapterViewBuilder<chapter_view_state::SetNotebook<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ChapterViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::Record: chapter_view_state::IsUnset,
{
    /// Set the `record` field (required)
    pub fn record(
        mut self,
        value: impl Into<Data<S>>,
    ) -> ChapterViewBuilder<chapter_view_state::SetRecord<St>, S> {
        self._fields.5 = Option::Some(value.into());
        ChapterViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: chapter_view_state::State, S: BosStr> ChapterViewBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: chapter_view_state::State, S: BosStr> ChapterViewBuilder<St, S> {
    /// Set the `title` field (optional)
    pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `title` field to an Option value (optional)
    pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::Uri: chapter_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> ChapterViewBuilder<chapter_view_state::SetUri<St>, S> {
        self._fields.8 = Option::Some(value.into());
        ChapterViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ChapterViewBuilder<St, S>
where
    St: chapter_view_state::State,
    St::Authors: chapter_view_state::IsSet,
    St::Cid: chapter_view_state::IsSet,
    St::IndexedAt: chapter_view_state::IsSet,
    St::Notebook: chapter_view_state::IsSet,
    St::Record: chapter_view_state::IsSet,
    St::Uri: chapter_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ChapterView<S> {
        ChapterView {
            authors: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            entry_count: self._fields.2,
            indexed_at: self._fields.3.unwrap(),
            notebook: self._fields.4.unwrap(),
            record: self._fields.5.unwrap(),
            tags: self._fields.6,
            title: self._fields.7,
            uri: self._fields.8.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>>,
    ) -> ChapterView<S> {
        ChapterView {
            authors: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            entry_count: self._fields.2,
            indexed_at: self._fields.3.unwrap(),
            notebook: self._fields.4.unwrap(),
            record: self._fields.5.unwrap(),
            tags: self._fields.6,
            title: self._fields.7,
            uri: self._fields.8.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn _default_content_format_markdown<S: FromStaticStr>() -> ::core::option::Option<S> {
    Some(S::from_static("weaver"))
}

impl Default for ContentFormat {
    fn default() -> Self {
        Self {
            markdown: Some(SmolStr::from("weaver")),
            extra_data: Default::default(),
        }
    }
}

pub mod entry_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Authors;
        type Cid;
        type IndexedAt;
        type Record;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Authors = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type Record = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `authors` field to Set
    pub struct SetAuthors<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthors<St> {}
    impl<St: State> State for SetAuthors<St> {
        type Authors = Set<members::authors>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Authors = St::Authors;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `record` field to Set
    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRecord<St> {}
    impl<St: State> State for SetRecord<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Record = Set<members::record>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `authors` field
        pub struct authors(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct EntryViewBuilder<St: entry_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<notebook::AuthorListView<S>>>,
        Option<i64>,
        Option<Cid<S>>,
        Option<Datetime>,
        Option<i64>,
        Option<notebook::Path<S>>,
        Option<notebook::PermissionsState<S>>,
        Option<Data<S>>,
        Option<notebook::RenderedView<S>>,
        Option<notebook::Tags<S>>,
        Option<notebook::Title<S>>,
        Option<AtUri<S>>,
        Option<AtUri<S>>,
        Option<AtUri<S>>,
        Option<notebook::ReadingProgress<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> EntryView<S> {
    /// Create a new builder for this type
    pub fn builder() -> EntryViewBuilder<entry_view_state::Empty, S> {
        EntryViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> EntryViewBuilder<St, S>
where
    St: entry_view_state::State,
    St::Authors: entry_view_state::IsUnset,
{
    /// Set the `authors` field (required)
    pub fn authors(
        mut self,
        value: impl Into<Vec<notebook::AuthorListView<S>>>,
    ) -> EntryViewBuilder<entry_view_state::SetAuthors<St>, S> {
        self._fields.0 = Option::Some(value.into());
        EntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `bookmarkCount` field (optional)
    pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `bookmarkCount` field to an Option value (optional)
    pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> EntryViewBuilder<St, S>
where
    St: entry_view_state::State,
    St::Cid: entry_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> EntryViewBuilder<entry_view_state::SetCid<St>, S> {
        self._fields.2 = Option::Some(value.into());
        EntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EntryViewBuilder<St, S>
where
    St: entry_view_state::State,
    St::IndexedAt: entry_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> EntryViewBuilder<entry_view_state::SetIndexedAt<St>, S> {
        self._fields.3 = Option::Some(value.into());
        EntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `likeCount` field (optional)
    pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `likeCount` field to an Option value (optional)
    pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `path` field (optional)
    pub fn path(mut self, value: impl Into<Option<notebook::Path<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `path` field to an Option value (optional)
    pub fn maybe_path(mut self, value: Option<notebook::Path<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `permissions` field (optional)
    pub fn permissions(
        mut self,
        value: impl Into<Option<notebook::PermissionsState<S>>>,
    ) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `permissions` field to an Option value (optional)
    pub fn maybe_permissions(
        mut self,
        value: Option<notebook::PermissionsState<S>>,
    ) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> EntryViewBuilder<St, S>
where
    St: entry_view_state::State,
    St::Record: entry_view_state::IsUnset,
{
    /// Set the `record` field (required)
    pub fn record(
        mut self,
        value: impl Into<Data<S>>,
    ) -> EntryViewBuilder<entry_view_state::SetRecord<St>, S> {
        self._fields.7 = Option::Some(value.into());
        EntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `renderedView` field (optional)
    pub fn rendered_view(
        mut self,
        value: impl Into<Option<notebook::RenderedView<S>>>,
    ) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `renderedView` field to an Option value (optional)
    pub fn maybe_rendered_view(
        mut self,
        value: Option<notebook::RenderedView<S>>,
    ) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `title` field (optional)
    pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `title` field to an Option value (optional)
    pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St, S: BosStr> EntryViewBuilder<St, S>
where
    St: entry_view_state::State,
    St::Uri: entry_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> EntryViewBuilder<entry_view_state::SetUri<St>, S> {
        self._fields.11 = Option::Some(value.into());
        EntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `viewerBookmark` field (optional)
    pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `viewerBookmark` field to an Option value (optional)
    pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `viewerLike` field (optional)
    pub fn viewer_like(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `viewerLike` field to an Option value (optional)
    pub fn maybe_viewer_like(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St: entry_view_state::State, S: BosStr> EntryViewBuilder<St, S> {
    /// Set the `viewerReadingProgress` field (optional)
    pub fn viewer_reading_progress(
        mut self,
        value: impl Into<Option<notebook::ReadingProgress<S>>>,
    ) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `viewerReadingProgress` field to an Option value (optional)
    pub fn maybe_viewer_reading_progress(
        mut self,
        value: Option<notebook::ReadingProgress<S>>,
    ) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<St, S: BosStr> EntryViewBuilder<St, S>
where
    St: entry_view_state::State,
    St::Authors: entry_view_state::IsSet,
    St::Cid: entry_view_state::IsSet,
    St::IndexedAt: entry_view_state::IsSet,
    St::Record: entry_view_state::IsSet,
    St::Uri: entry_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> EntryView<S> {
        EntryView {
            authors: self._fields.0.unwrap(),
            bookmark_count: self._fields.1,
            cid: self._fields.2.unwrap(),
            indexed_at: self._fields.3.unwrap(),
            like_count: self._fields.4,
            path: self._fields.5,
            permissions: self._fields.6,
            record: self._fields.7.unwrap(),
            rendered_view: self._fields.8,
            tags: self._fields.9,
            title: self._fields.10,
            uri: self._fields.11.unwrap(),
            viewer_bookmark: self._fields.12,
            viewer_like: self._fields.13,
            viewer_reading_progress: self._fields.14,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> EntryView<S> {
        EntryView {
            authors: self._fields.0.unwrap(),
            bookmark_count: self._fields.1,
            cid: self._fields.2.unwrap(),
            indexed_at: self._fields.3.unwrap(),
            like_count: self._fields.4,
            path: self._fields.5,
            permissions: self._fields.6,
            record: self._fields.7.unwrap(),
            rendered_view: self._fields.8,
            tags: self._fields.9,
            title: self._fields.10,
            uri: self._fields.11.unwrap(),
            viewer_bookmark: self._fields.12,
            viewer_like: self._fields.13,
            viewer_reading_progress: self._fields.14,
            extra_data: Some(extra_data),
        }
    }
}

pub mod feed_entry_view_state {

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

/// Builder for constructing an instance of this type.
pub struct FeedEntryViewBuilder<
    St: feed_entry_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<notebook::EntryView<S>>,
        Option<notebook::FeedNotebookContext<S>>,
        Option<notebook::FeedReason<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> FeedEntryView<S> {
    /// Create a new builder for this type
    pub fn builder() -> FeedEntryViewBuilder<feed_entry_view_state::Empty, S> {
        FeedEntryViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> FeedEntryViewBuilder<St, S>
where
    St: feed_entry_view_state::State,
    St::Entry: feed_entry_view_state::IsUnset,
{
    /// Set the `entry` field (required)
    pub fn entry(
        mut self,
        value: impl Into<notebook::EntryView<S>>,
    ) -> FeedEntryViewBuilder<feed_entry_view_state::SetEntry<St>, S> {
        self._fields.0 = Option::Some(value.into());
        FeedEntryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: feed_entry_view_state::State, S: BosStr> FeedEntryViewBuilder<St, S> {
    /// Set the `notebookContext` field (optional)
    pub fn notebook_context(
        mut self,
        value: impl Into<Option<notebook::FeedNotebookContext<S>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `notebookContext` field to an Option value (optional)
    pub fn maybe_notebook_context(
        mut self,
        value: Option<notebook::FeedNotebookContext<S>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: feed_entry_view_state::State, S: BosStr> FeedEntryViewBuilder<St, S> {
    /// Set the `reason` field (optional)
    pub fn reason(mut self, value: impl Into<Option<notebook::FeedReason<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `reason` field to an Option value (optional)
    pub fn maybe_reason(mut self, value: Option<notebook::FeedReason<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> FeedEntryViewBuilder<St, S>
where
    St: feed_entry_view_state::State,
    St::Entry: feed_entry_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> FeedEntryView<S> {
        FeedEntryView {
            entry: self._fields.0.unwrap(),
            notebook_context: self._fields.1,
            reason: self._fields.2,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> FeedEntryView<S> {
        FeedEntryView {
            entry: self._fields.0.unwrap(),
            notebook_context: self._fields.1,
            reason: self._fields.2,
            extra_data: Some(extra_data),
        }
    }
}

pub mod feed_notebook_context_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 Title;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Title = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `title` field to Set
    pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTitle<St> {}
    impl<St: State> State for SetTitle<St> {
        type Title = Set<members::title>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Title = St::Title;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `title` field
        pub struct title(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

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

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

impl<S: BosStr> FeedNotebookContext<S> {
    /// Create a new builder for this type
    pub fn builder() -> FeedNotebookContextBuilder<
        feed_notebook_context_state::Empty,
        S,
    > {
        FeedNotebookContextBuilder::builder()
    }
}

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

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

impl<
    St: feed_notebook_context_state::State,
    S: BosStr,
> FeedNotebookContextBuilder<St, S> {
    /// Set the `path` field (optional)
    pub fn path(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `path` field to an Option value (optional)
    pub fn maybe_path(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St, S: BosStr> FeedNotebookContextBuilder<St, S>
where
    St: feed_notebook_context_state::State,
    St::Title: feed_notebook_context_state::IsUnset,
{
    /// Set the `title` field (required)
    pub fn title(
        mut self,
        value: impl Into<S>,
    ) -> FeedNotebookContextBuilder<feed_notebook_context_state::SetTitle<St>, S> {
        self._fields.1 = Option::Some(value.into());
        FeedNotebookContextBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FeedNotebookContextBuilder<St, S>
where
    St: feed_notebook_context_state::State,
    St::Uri: feed_notebook_context_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> FeedNotebookContextBuilder<feed_notebook_context_state::SetUri<St>, S> {
        self._fields.2 = Option::Some(value.into());
        FeedNotebookContextBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FeedNotebookContextBuilder<St, S>
where
    St: feed_notebook_context_state::State,
    St::Title: feed_notebook_context_state::IsSet,
    St::Uri: feed_notebook_context_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> FeedNotebookContext<S> {
        FeedNotebookContext {
            path: self._fields.0,
            title: self._fields.1.unwrap(),
            uri: 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>>,
    ) -> FeedNotebookContext<S> {
        FeedNotebookContext {
            path: self._fields.0,
            title: self._fields.1.unwrap(),
            uri: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod notebook_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Authors;
        type Cid;
        type IndexedAt;
        type Record;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Authors = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type Record = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `authors` field to Set
    pub struct SetAuthors<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthors<St> {}
    impl<St: State> State for SetAuthors<St> {
        type Authors = Set<members::authors>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Authors = St::Authors;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `record` field to Set
    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRecord<St> {}
    impl<St: State> State for SetRecord<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Record = Set<members::record>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Authors = St::Authors;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `authors` field
        pub struct authors(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct NotebookViewBuilder<St: notebook_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<notebook::AuthorListView<S>>>,
        Option<i64>,
        Option<Cid<S>>,
        Option<i64>,
        Option<Datetime>,
        Option<i64>,
        Option<notebook::Path<S>>,
        Option<notebook::PermissionsState<S>>,
        Option<Data<S>>,
        Option<i64>,
        Option<notebook::Tags<S>>,
        Option<notebook::Title<S>>,
        Option<AtUri<S>>,
        Option<AtUri<S>>,
        Option<AtUri<S>>,
        Option<notebook::ReadingProgress<S>>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> NotebookView<S> {
    /// Create a new builder for this type
    pub fn builder() -> NotebookViewBuilder<notebook_view_state::Empty, S> {
        NotebookViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> NotebookViewBuilder<St, S>
where
    St: notebook_view_state::State,
    St::Authors: notebook_view_state::IsUnset,
{
    /// Set the `authors` field (required)
    pub fn authors(
        mut self,
        value: impl Into<Vec<notebook::AuthorListView<S>>>,
    ) -> NotebookViewBuilder<notebook_view_state::SetAuthors<St>, S> {
        self._fields.0 = Option::Some(value.into());
        NotebookViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `bookmarkCount` field (optional)
    pub fn bookmark_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `bookmarkCount` field to an Option value (optional)
    pub fn maybe_bookmark_count(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> NotebookViewBuilder<St, S>
where
    St: notebook_view_state::State,
    St::Cid: notebook_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> NotebookViewBuilder<notebook_view_state::SetCid<St>, S> {
        self._fields.2 = Option::Some(value.into());
        NotebookViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `entryCount` field (optional)
    pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `entryCount` field to an Option value (optional)
    pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> NotebookViewBuilder<St, S>
where
    St: notebook_view_state::State,
    St::IndexedAt: notebook_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> NotebookViewBuilder<notebook_view_state::SetIndexedAt<St>, S> {
        self._fields.4 = Option::Some(value.into());
        NotebookViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `likeCount` field (optional)
    pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `likeCount` field to an Option value (optional)
    pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `path` field (optional)
    pub fn path(mut self, value: impl Into<Option<notebook::Path<S>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `path` field to an Option value (optional)
    pub fn maybe_path(mut self, value: Option<notebook::Path<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `permissions` field (optional)
    pub fn permissions(
        mut self,
        value: impl Into<Option<notebook::PermissionsState<S>>>,
    ) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `permissions` field to an Option value (optional)
    pub fn maybe_permissions(
        mut self,
        value: Option<notebook::PermissionsState<S>>,
    ) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> NotebookViewBuilder<St, S>
where
    St: notebook_view_state::State,
    St::Record: notebook_view_state::IsUnset,
{
    /// Set the `record` field (required)
    pub fn record(
        mut self,
        value: impl Into<Data<S>>,
    ) -> NotebookViewBuilder<notebook_view_state::SetRecord<St>, S> {
        self._fields.8 = Option::Some(value.into());
        NotebookViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `subscriberCount` field (optional)
    pub fn subscriber_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `subscriberCount` field to an Option value (optional)
    pub fn maybe_subscriber_count(mut self, value: Option<i64>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `title` field (optional)
    pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `title` field to an Option value (optional)
    pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<St, S: BosStr> NotebookViewBuilder<St, S>
where
    St: notebook_view_state::State,
    St::Uri: notebook_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> NotebookViewBuilder<notebook_view_state::SetUri<St>, S> {
        self._fields.12 = Option::Some(value.into());
        NotebookViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `viewerBookmark` field (optional)
    pub fn viewer_bookmark(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `viewerBookmark` field to an Option value (optional)
    pub fn maybe_viewer_bookmark(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `viewerLike` field (optional)
    pub fn viewer_like(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `viewerLike` field to an Option value (optional)
    pub fn maybe_viewer_like(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `viewerReadingProgress` field (optional)
    pub fn viewer_reading_progress(
        mut self,
        value: impl Into<Option<notebook::ReadingProgress<S>>>,
    ) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `viewerReadingProgress` field to an Option value (optional)
    pub fn maybe_viewer_reading_progress(
        mut self,
        value: Option<notebook::ReadingProgress<S>>,
    ) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<St: notebook_view_state::State, S: BosStr> NotebookViewBuilder<St, S> {
    /// Set the `viewerSubscription` field (optional)
    pub fn viewer_subscription(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `viewerSubscription` field to an Option value (optional)
    pub fn maybe_viewer_subscription(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<St, S: BosStr> NotebookViewBuilder<St, S>
where
    St: notebook_view_state::State,
    St::Authors: notebook_view_state::IsSet,
    St::Cid: notebook_view_state::IsSet,
    St::IndexedAt: notebook_view_state::IsSet,
    St::Record: notebook_view_state::IsSet,
    St::Uri: notebook_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> NotebookView<S> {
        NotebookView {
            authors: self._fields.0.unwrap(),
            bookmark_count: self._fields.1,
            cid: self._fields.2.unwrap(),
            entry_count: self._fields.3,
            indexed_at: self._fields.4.unwrap(),
            like_count: self._fields.5,
            path: self._fields.6,
            permissions: self._fields.7,
            record: self._fields.8.unwrap(),
            subscriber_count: self._fields.9,
            tags: self._fields.10,
            title: self._fields.11,
            uri: self._fields.12.unwrap(),
            viewer_bookmark: self._fields.13,
            viewer_like: self._fields.14,
            viewer_reading_progress: self._fields.15,
            viewer_subscription: self._fields.16,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> NotebookView<S> {
        NotebookView {
            authors: self._fields.0.unwrap(),
            bookmark_count: self._fields.1,
            cid: self._fields.2.unwrap(),
            entry_count: self._fields.3,
            indexed_at: self._fields.4.unwrap(),
            like_count: self._fields.5,
            path: self._fields.6,
            permissions: self._fields.7,
            record: self._fields.8.unwrap(),
            subscriber_count: self._fields.9,
            tags: self._fields.10,
            title: self._fields.11,
            uri: self._fields.12.unwrap(),
            viewer_bookmark: self._fields.13,
            viewer_like: self._fields.14,
            viewer_reading_progress: self._fields.15,
            viewer_subscription: self._fields.16,
            extra_data: Some(extra_data),
        }
    }
}

pub mod page_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Cid;
        type IndexedAt;
        type Notebook;
        type Record;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Cid = Unset;
        type IndexedAt = Unset;
        type Notebook = Unset;
        type Record = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `notebook` field to Set
    pub struct SetNotebook<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetNotebook<St> {}
    impl<St: State> State for SetNotebook<St> {
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = Set<members::notebook>;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `record` field to Set
    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRecord<St> {}
    impl<St: State> State for SetRecord<St> {
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = Set<members::record>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Notebook = St::Notebook;
        type Record = St::Record;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `notebook` field
        pub struct notebook(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct PageViewBuilder<St: page_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Cid<S>>,
        Option<i64>,
        Option<Datetime>,
        Option<notebook::NotebookView<S>>,
        Option<Data<S>>,
        Option<notebook::Tags<S>>,
        Option<notebook::Title<S>>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> PageView<S> {
    /// Create a new builder for this type
    pub fn builder() -> PageViewBuilder<page_view_state::Empty, S> {
        PageViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> PageViewBuilder<St, S>
where
    St: page_view_state::State,
    St::Cid: page_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> PageViewBuilder<page_view_state::SetCid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        PageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: page_view_state::State, S: BosStr> PageViewBuilder<St, S> {
    /// Set the `entryCount` field (optional)
    pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `entryCount` field to an Option value (optional)
    pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> PageViewBuilder<St, S>
where
    St: page_view_state::State,
    St::IndexedAt: page_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> PageViewBuilder<page_view_state::SetIndexedAt<St>, S> {
        self._fields.2 = Option::Some(value.into());
        PageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PageViewBuilder<St, S>
where
    St: page_view_state::State,
    St::Notebook: page_view_state::IsUnset,
{
    /// Set the `notebook` field (required)
    pub fn notebook(
        mut self,
        value: impl Into<notebook::NotebookView<S>>,
    ) -> PageViewBuilder<page_view_state::SetNotebook<St>, S> {
        self._fields.3 = Option::Some(value.into());
        PageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PageViewBuilder<St, S>
where
    St: page_view_state::State,
    St::Record: page_view_state::IsUnset,
{
    /// Set the `record` field (required)
    pub fn record(
        mut self,
        value: impl Into<Data<S>>,
    ) -> PageViewBuilder<page_view_state::SetRecord<St>, S> {
        self._fields.4 = Option::Some(value.into());
        PageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: page_view_state::State, S: BosStr> PageViewBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<notebook::Tags<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<notebook::Tags<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: page_view_state::State, S: BosStr> PageViewBuilder<St, S> {
    /// Set the `title` field (optional)
    pub fn title(mut self, value: impl Into<Option<notebook::Title<S>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `title` field to an Option value (optional)
    pub fn maybe_title(mut self, value: Option<notebook::Title<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> PageViewBuilder<St, S>
where
    St: page_view_state::State,
    St::Uri: page_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> PageViewBuilder<page_view_state::SetUri<St>, S> {
        self._fields.7 = Option::Some(value.into());
        PageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PageViewBuilder<St, S>
where
    St: page_view_state::State,
    St::Cid: page_view_state::IsSet,
    St::IndexedAt: page_view_state::IsSet,
    St::Notebook: page_view_state::IsSet,
    St::Record: page_view_state::IsSet,
    St::Uri: page_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PageView<S> {
        PageView {
            cid: self._fields.0.unwrap(),
            entry_count: self._fields.1,
            indexed_at: self._fields.2.unwrap(),
            notebook: self._fields.3.unwrap(),
            record: self._fields.4.unwrap(),
            tags: self._fields.5,
            title: self._fields.6,
            uri: self._fields.7.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>>) -> PageView<S> {
        PageView {
            cid: self._fields.0.unwrap(),
            entry_count: self._fields.1,
            indexed_at: self._fields.2.unwrap(),
            notebook: self._fields.3.unwrap(),
            record: self._fields.4.unwrap(),
            tags: self._fields.5,
            title: self._fields.6,
            uri: self._fields.7.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod permission_grant_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 Did;
        type GrantedAt;
        type Scope;
        type Source;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Did = Unset;
        type GrantedAt = Unset;
        type Scope = Unset;
        type Source = Unset;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type Did = Set<members::did>;
        type GrantedAt = St::GrantedAt;
        type Scope = St::Scope;
        type Source = St::Source;
    }
    ///State transition - sets the `granted_at` field to Set
    pub struct SetGrantedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetGrantedAt<St> {}
    impl<St: State> State for SetGrantedAt<St> {
        type Did = St::Did;
        type GrantedAt = Set<members::granted_at>;
        type Scope = St::Scope;
        type Source = St::Source;
    }
    ///State transition - sets the `scope` field to Set
    pub struct SetScope<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetScope<St> {}
    impl<St: State> State for SetScope<St> {
        type Did = St::Did;
        type GrantedAt = St::GrantedAt;
        type Scope = Set<members::scope>;
        type Source = St::Source;
    }
    ///State transition - sets the `source` field to Set
    pub struct SetSource<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSource<St> {}
    impl<St: State> State for SetSource<St> {
        type Did = St::Did;
        type GrantedAt = St::GrantedAt;
        type Scope = St::Scope;
        type Source = Set<members::source>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `granted_at` field
        pub struct granted_at(());
        ///Marker type for the `scope` field
        pub struct scope(());
        ///Marker type for the `source` field
        pub struct source(());
    }
}

/// Builder for constructing an instance of this type.
pub struct PermissionGrantBuilder<
    St: permission_grant_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Did<S>>,
        Option<Datetime>,
        Option<PermissionGrantScope<S>>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> PermissionGrant<S> {
    /// Create a new builder for this type
    pub fn builder() -> PermissionGrantBuilder<permission_grant_state::Empty, S> {
        PermissionGrantBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> PermissionGrantBuilder<St, S>
where
    St: permission_grant_state::State,
    St::Did: permission_grant_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> PermissionGrantBuilder<permission_grant_state::SetDid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        PermissionGrantBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PermissionGrantBuilder<St, S>
where
    St: permission_grant_state::State,
    St::GrantedAt: permission_grant_state::IsUnset,
{
    /// Set the `grantedAt` field (required)
    pub fn granted_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> PermissionGrantBuilder<permission_grant_state::SetGrantedAt<St>, S> {
        self._fields.1 = Option::Some(value.into());
        PermissionGrantBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PermissionGrantBuilder<St, S>
where
    St: permission_grant_state::State,
    St::Scope: permission_grant_state::IsUnset,
{
    /// Set the `scope` field (required)
    pub fn scope(
        mut self,
        value: impl Into<PermissionGrantScope<S>>,
    ) -> PermissionGrantBuilder<permission_grant_state::SetScope<St>, S> {
        self._fields.2 = Option::Some(value.into());
        PermissionGrantBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PermissionGrantBuilder<St, S>
where
    St: permission_grant_state::State,
    St::Source: permission_grant_state::IsUnset,
{
    /// Set the `source` field (required)
    pub fn source(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> PermissionGrantBuilder<permission_grant_state::SetSource<St>, S> {
        self._fields.3 = Option::Some(value.into());
        PermissionGrantBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PermissionGrantBuilder<St, S>
where
    St: permission_grant_state::State,
    St::Did: permission_grant_state::IsSet,
    St::GrantedAt: permission_grant_state::IsSet,
    St::Scope: permission_grant_state::IsSet,
    St::Source: permission_grant_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PermissionGrant<S> {
        PermissionGrant {
            did: self._fields.0.unwrap(),
            granted_at: self._fields.1.unwrap(),
            scope: self._fields.2.unwrap(),
            source: self._fields.3.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> PermissionGrant<S> {
        PermissionGrant {
            did: self._fields.0.unwrap(),
            granted_at: self._fields.1.unwrap(),
            scope: self._fields.2.unwrap(),
            source: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod permissions_state_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 Editors;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Editors = Unset;
    }
    ///State transition - sets the `editors` field to Set
    pub struct SetEditors<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetEditors<St> {}
    impl<St: State> State for SetEditors<St> {
        type Editors = Set<members::editors>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `editors` field
        pub struct editors(());
    }
}

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

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

impl<S: BosStr> PermissionsState<S> {
    /// Create a new builder for this type
    pub fn builder() -> PermissionsStateBuilder<permissions_state_state::Empty, S> {
        PermissionsStateBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> PermissionsStateBuilder<St, S>
where
    St: permissions_state_state::State,
    St::Editors: permissions_state_state::IsUnset,
{
    /// Set the `editors` field (required)
    pub fn editors(
        mut self,
        value: impl Into<Vec<notebook::PermissionGrant<S>>>,
    ) -> PermissionsStateBuilder<permissions_state_state::SetEditors<St>, S> {
        self._fields.0 = Option::Some(value.into());
        PermissionsStateBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: permissions_state_state::State, S: BosStr> PermissionsStateBuilder<St, S> {
    /// Set the `viewers` field (optional)
    pub fn viewers(
        mut self,
        value: impl Into<Option<Vec<notebook::PermissionGrant<S>>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `viewers` field to an Option value (optional)
    pub fn maybe_viewers(
        mut self,
        value: Option<Vec<notebook::PermissionGrant<S>>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> PermissionsStateBuilder<St, S>
where
    St: permissions_state_state::State,
    St::Editors: permissions_state_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PermissionsState<S> {
        PermissionsState {
            editors: self._fields.0.unwrap(),
            viewers: self._fields.1,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> PermissionsState<S> {
        PermissionsState {
            editors: self._fields.0.unwrap(),
            viewers: self._fields.1,
            extra_data: Some(extra_data),
        }
    }
}

pub mod published_version_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Cid;
        type PublishedAt;
        type Publisher;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Cid = Unset;
        type PublishedAt = Unset;
        type Publisher = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Cid = Set<members::cid>;
        type PublishedAt = St::PublishedAt;
        type Publisher = St::Publisher;
        type Uri = St::Uri;
    }
    ///State transition - sets the `published_at` field to Set
    pub struct SetPublishedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPublishedAt<St> {}
    impl<St: State> State for SetPublishedAt<St> {
        type Cid = St::Cid;
        type PublishedAt = Set<members::published_at>;
        type Publisher = St::Publisher;
        type Uri = St::Uri;
    }
    ///State transition - sets the `publisher` field to Set
    pub struct SetPublisher<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPublisher<St> {}
    impl<St: State> State for SetPublisher<St> {
        type Cid = St::Cid;
        type PublishedAt = St::PublishedAt;
        type Publisher = Set<members::publisher>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Cid = St::Cid;
        type PublishedAt = St::PublishedAt;
        type Publisher = St::Publisher;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `published_at` field
        pub struct published_at(());
        ///Marker type for the `publisher` field
        pub struct publisher(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct PublishedVersionViewBuilder<
    St: published_version_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Cid<S>>,
        Option<StrongRef<S>>,
        Option<bool>,
        Option<Datetime>,
        Option<ProfileViewBasic<S>>,
        Option<Datetime>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> PublishedVersionView<S> {
    /// Create a new builder for this type
    pub fn builder() -> PublishedVersionViewBuilder<
        published_version_view_state::Empty,
        S,
    > {
        PublishedVersionViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> PublishedVersionViewBuilder<St, S>
where
    St: published_version_view_state::State,
    St::Cid: published_version_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> PublishedVersionViewBuilder<published_version_view_state::SetCid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        PublishedVersionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<
    St: published_version_view_state::State,
    S: BosStr,
> PublishedVersionViewBuilder<St, S> {
    /// Set the `divergedFrom` field (optional)
    pub fn diverged_from(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `divergedFrom` field to an Option value (optional)
    pub fn maybe_diverged_from(mut self, value: Option<StrongRef<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<
    St: published_version_view_state::State,
    S: BosStr,
> PublishedVersionViewBuilder<St, S> {
    /// Set the `isCanonical` field (optional)
    pub fn is_canonical(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `isCanonical` field to an Option value (optional)
    pub fn maybe_is_canonical(mut self, value: Option<bool>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> PublishedVersionViewBuilder<St, S>
where
    St: published_version_view_state::State,
    St::PublishedAt: published_version_view_state::IsUnset,
{
    /// Set the `publishedAt` field (required)
    pub fn published_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> PublishedVersionViewBuilder<
        published_version_view_state::SetPublishedAt<St>,
        S,
    > {
        self._fields.3 = Option::Some(value.into());
        PublishedVersionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PublishedVersionViewBuilder<St, S>
where
    St: published_version_view_state::State,
    St::Publisher: published_version_view_state::IsUnset,
{
    /// Set the `publisher` field (required)
    pub fn publisher(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> PublishedVersionViewBuilder<published_version_view_state::SetPublisher<St>, S> {
        self._fields.4 = Option::Some(value.into());
        PublishedVersionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<
    St: published_version_view_state::State,
    S: BosStr,
> PublishedVersionViewBuilder<St, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `updatedAt` field to an Option value (optional)
    pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> PublishedVersionViewBuilder<St, S>
where
    St: published_version_view_state::State,
    St::Uri: published_version_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> PublishedVersionViewBuilder<published_version_view_state::SetUri<St>, S> {
        self._fields.6 = Option::Some(value.into());
        PublishedVersionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PublishedVersionViewBuilder<St, S>
where
    St: published_version_view_state::State,
    St::Cid: published_version_view_state::IsSet,
    St::PublishedAt: published_version_view_state::IsSet,
    St::Publisher: published_version_view_state::IsSet,
    St::Uri: published_version_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PublishedVersionView<S> {
        PublishedVersionView {
            cid: self._fields.0.unwrap(),
            diverged_from: self._fields.1,
            is_canonical: self._fields.2,
            published_at: self._fields.3.unwrap(),
            publisher: self._fields.4.unwrap(),
            updated_at: self._fields.5,
            uri: self._fields.6.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>>,
    ) -> PublishedVersionView<S> {
        PublishedVersionView {
            cid: self._fields.0.unwrap(),
            diverged_from: self._fields.1,
            is_canonical: self._fields.2,
            published_at: self._fields.3.unwrap(),
            publisher: self._fields.4.unwrap(),
            updated_at: self._fields.5,
            uri: self._fields.6.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod reason_bookmark_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 By;
        type IndexedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type By = Unset;
        type IndexedAt = Unset;
    }
    ///State transition - sets the `by` field to Set
    pub struct SetBy<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBy<St> {}
    impl<St: State> State for SetBy<St> {
        type By = Set<members::by>;
        type IndexedAt = St::IndexedAt;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type By = St::By;
        type IndexedAt = Set<members::indexed_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `by` field
        pub struct by(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
    }
}

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

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

impl<S: BosStr> ReasonBookmark<S> {
    /// Create a new builder for this type
    pub fn builder() -> ReasonBookmarkBuilder<reason_bookmark_state::Empty, S> {
        ReasonBookmarkBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ReasonBookmarkBuilder<St, S>
where
    St: reason_bookmark_state::State,
    St::By: reason_bookmark_state::IsUnset,
{
    /// Set the `by` field (required)
    pub fn by(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> ReasonBookmarkBuilder<reason_bookmark_state::SetBy<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ReasonBookmarkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReasonBookmarkBuilder<St, S>
where
    St: reason_bookmark_state::State,
    St::IndexedAt: reason_bookmark_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ReasonBookmarkBuilder<reason_bookmark_state::SetIndexedAt<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ReasonBookmarkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReasonBookmarkBuilder<St, S>
where
    St: reason_bookmark_state::State,
    St::By: reason_bookmark_state::IsSet,
    St::IndexedAt: reason_bookmark_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReasonBookmark<S> {
        ReasonBookmark {
            by: self._fields.0.unwrap(),
            indexed_at: 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>>,
    ) -> ReasonBookmark<S> {
        ReasonBookmark {
            by: self._fields.0.unwrap(),
            indexed_at: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod reason_like_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 By;
        type IndexedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type By = Unset;
        type IndexedAt = Unset;
    }
    ///State transition - sets the `by` field to Set
    pub struct SetBy<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBy<St> {}
    impl<St: State> State for SetBy<St> {
        type By = Set<members::by>;
        type IndexedAt = St::IndexedAt;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type By = St::By;
        type IndexedAt = Set<members::indexed_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `by` field
        pub struct by(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
    }
}

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

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

impl<S: BosStr> ReasonLike<S> {
    /// Create a new builder for this type
    pub fn builder() -> ReasonLikeBuilder<reason_like_state::Empty, S> {
        ReasonLikeBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ReasonLikeBuilder<St, S>
where
    St: reason_like_state::State,
    St::By: reason_like_state::IsUnset,
{
    /// Set the `by` field (required)
    pub fn by(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> ReasonLikeBuilder<reason_like_state::SetBy<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ReasonLikeBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReasonLikeBuilder<St, S>
where
    St: reason_like_state::State,
    St::IndexedAt: reason_like_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ReasonLikeBuilder<reason_like_state::SetIndexedAt<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ReasonLikeBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReasonLikeBuilder<St, S>
where
    St: reason_like_state::State,
    St::By: reason_like_state::IsSet,
    St::IndexedAt: reason_like_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReasonLike<S> {
        ReasonLike {
            by: self._fields.0.unwrap(),
            indexed_at: 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>>,
    ) -> ReasonLike<S> {
        ReasonLike {
            by: self._fields.0.unwrap(),
            indexed_at: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod reason_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 IndexedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type IndexedAt = Unset;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type IndexedAt = Set<members::indexed_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
    }
}

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

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

impl<S: BosStr> ReasonSubscription<S> {
    /// Create a new builder for this type
    pub fn builder() -> ReasonSubscriptionBuilder<reason_subscription_state::Empty, S> {
        ReasonSubscriptionBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ReasonSubscriptionBuilder<St, S>
where
    St: reason_subscription_state::State,
    St::IndexedAt: reason_subscription_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ReasonSubscriptionBuilder<reason_subscription_state::SetIndexedAt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ReasonSubscriptionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReasonSubscriptionBuilder<St, S>
where
    St: reason_subscription_state::State,
    St::IndexedAt: reason_subscription_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReasonSubscription<S> {
        ReasonSubscription {
            indexed_at: self._fields.0.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ReasonSubscription<S> {
        ReasonSubscription {
            indexed_at: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod rendered_view_state {

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

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

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

impl<S: BosStr> RenderedView<S> {
    /// Create a new builder for this type
    pub fn builder() -> RenderedViewBuilder<rendered_view_state::Empty, S> {
        RenderedViewBuilder::builder()
    }
}

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

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

impl<St: rendered_view_state::State, S: BosStr> RenderedViewBuilder<St, S> {
    /// Set the `css` field (optional)
    pub fn css(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `css` field to an Option value (optional)
    pub fn maybe_css(mut self, value: Option<BlobRef<S>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St, S: BosStr> RenderedViewBuilder<St, S>
where
    St: rendered_view_state::State,
    St::Html: rendered_view_state::IsUnset,
{
    /// Set the `html` field (required)
    pub fn html(
        mut self,
        value: impl Into<BlobRef<S>>,
    ) -> RenderedViewBuilder<rendered_view_state::SetHtml<St>, S> {
        self._fields.1 = Option::Some(value.into());
        RenderedViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RenderedViewBuilder<St, S>
where
    St: rendered_view_state::State,
    St::Html: rendered_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RenderedView<S> {
        RenderedView {
            css: self._fields.0,
            html: 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>>,
    ) -> RenderedView<S> {
        RenderedView {
            css: self._fields.0,
            html: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}