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

//! Generated bindings for the `space.polymodel.library` Lexicon namespace/module.
pub mod delete_thing;
pub mod get_author_things;
pub mod get_feed;
pub mod get_model;
pub mod get_thing;
pub mod model;
pub mod part;
pub mod publish_thing;
pub mod search_things;
pub mod stage_file;
pub mod thing;
pub mod update_thing;


#[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, Handle, AtUri, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::space_polymodel::library;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Actor<S: BosStr = DefaultStr> {
    ///Avatar image URL resolved by the app view (CDN).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<UriValue<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    pub did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follower_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following_count: Option<i64>,
    pub handle: Handle<S>,
    ///Hydrated profile pronouns for bylines and cards.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pronouns: Option<S>,
    ///Count of published Polymodel things by this actor.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thing_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer: Option<library::ActorViewerState<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Detailed hydrated actor/profile view for profile surfaces, modeled after app.bsky.actor profile view splits.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ActorViewDetailed<S: BosStr = DefaultStr> {
    ///Avatar image URL resolved by the app view (CDN).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<UriValue<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub default_license: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    pub did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follower_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following_count: Option<i64>,
    pub handle: Handle<S>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub links: Option<Vec<UriValue<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub printers: Option<Vec<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pronouns: Option<S>,
    pub record: Data<S>,
    ///Count of published Polymodel things by this actor.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thing_count: Option<i64>,
    pub viewer: library::ActorViewerState<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Viewer-specific relationship state for an actor/profile.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ActorViewerState<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked_by: Option<bool>,
    ///Block record URI if the requester blocks this actor.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocking: Option<AtUri<S>>,
    ///Follow record URI if this actor follows the requester.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub followed_by: Option<AtUri<S>>,
    ///Follow record URI if the requester follows this actor.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub muted: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Width:height aspect ratio of an image, for layout before the blob loads.

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

/// Axis-aligned bounding-box dimensions. ATProto has no float type, so x/y/z are decimal strings (e.g. 12.5) parsed to floats internally.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Bbox<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unit: Option<S>,
    pub x: S,
    pub y: S,
    pub z: 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 Chunk<S: BosStr = DefaultStr> {
    pub blob: BlobRef<S>,
    pub offset: i64,
    pub size: i64,
    #[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 FeedItem<S: BosStr = DefaultStr> {
    pub thing: library::ThingViewBasic<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 FeedView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor: Option<S>,
    pub items: Vec<library::FeedItem<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Chunk-capable geometry manifest. Reassemble by concatenating chunks in offset order. Per-chunk integrity is the blob CID; offset+size make ordering explicit; digest verifies the fully reassembled file.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct File<S: BosStr = DefaultStr> {
    pub chunks: Vec<library::Chunk<S>>,
    ///hex digest of the fully reassembled file (sha256 by convention)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub digest: Option<S>,
    pub mime_type: S,
    pub size: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// An authored image: a blob plus alt text and aspect ratio. Stored on records; the app view resolves it to #imageView.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Image<S: BosStr = DefaultStr> {
    ///Alt text describing the image, for accessibility.
    pub alt: S,
    pub aspect_ratio: library::AspectRatio<S>,
    pub image: BlobRef<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A resolved image view: CDN URLs for thumbnail and full size plus aspect ratio. Currently resolved via Bluesky's CDN by the app view.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ImageView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alt: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub aspect_ratio: Option<library::AspectRatio<S>>,
    ///Fully-qualified full-size URL (CDN, resolved by the app view).
    pub fullsize: UriValue<S>,
    ///Fully-qualified thumbnail URL (CDN, resolved by the app view).
    pub thumb: UriValue<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 ModelView<S: BosStr = DefaultStr> {
    pub author: library::Actor<S>,
    pub cid: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover: Option<Vec<library::ImageView<S>>>,
    pub indexed_at: Datetime,
    pub name: S,
    pub part_count: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub previews: Option<Vec<library::ImageView<S>>>,
    pub record: Data<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub summary: Option<S>,
    pub uri: AtUri<S>,
    pub viewer: library::ViewerState<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 PartView<S: BosStr = DefaultStr> {
    pub author: library::Actor<S>,
    pub cid: S,
    pub file: library::File<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub format: Option<S>,
    pub indexed_at: Datetime,
    pub name: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub previews: Option<Vec<library::ImageView<S>>>,
    pub record: Data<S>,
    pub uri: AtUri<S>,
    pub viewer: library::ViewerState<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 ThingView<S: BosStr = DefaultStr> {
    pub author: library::Actor<S>,
    pub cid: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover: Option<Vec<library::ImageView<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub derived_from: Option<StrongRef<S>>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub intended_to_work_with: Option<Vec<StrongRef<S>>>,
    pub license: S,
    pub like_count: i64,
    pub model_count: i64,
    pub name: S,
    ///Thing-level aggregate count of parts across included models, computed by the app view.
    pub part_count: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub previews: Option<Vec<library::ImageView<S>>>,
    pub record: Data<S>,
    pub save_count: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub summary: Option<S>,
    ///Hydrated display tags, including appview-aggregated external tag assertions.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<S>>,
    pub uri: AtUri<S>,
    pub viewer: library::ViewerState<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 ThingViewBasic<S: BosStr = DefaultStr> {
    pub author: library::Actor<S>,
    pub cid: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover: Option<Vec<library::ImageView<S>>>,
    pub indexed_at: Datetime,
    pub like_count: i64,
    pub model_count: i64,
    pub name: S,
    ///Thing-level aggregate count of parts across included models, computed by the app view.
    pub part_count: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub previews: Option<Vec<library::ImageView<S>>>,
    pub save_count: i64,
    ///Hydrated display tags for browse/search/profile cards, including appview-aggregated external tag assertions.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<S>>,
    pub uri: AtUri<S>,
    pub viewer: library::ViewerState<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

/// Reference-only shared field set; fields are inlined on thing/model.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct WorkMeta<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover: Option<Vec<library::Image<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub derived_from: Option<StrongRef<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructions: Option<Vec<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub intended_to_work_with: Option<Vec<StrongRef<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub license: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub previews: Option<Vec<library::Image<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub summary: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for Actor<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "actor"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ActorViewDetailed<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "actorViewDetailed"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ActorViewerState<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "actorViewerState"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AspectRatio<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "aspectRatio"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Bbox<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "bbox"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Chunk<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "chunk"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.blob;
            {
                let size = value.blob().size;
                if size > 104857600usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("blob"),
                        max: 104857600usize,
                        actual: size,
                    });
                }
            }
        }
        {
            let value = &self.blob;
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &[
                    "model/stl",
                    "model/3mf",
                    "model/obj",
                    "application/octet-stream",
                ];
                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("blob"),
                        accepted: vec![
                            "model/stl".to_string(), "model/3mf".to_string(), "model/obj"
                            .to_string(), "application/octet-stream".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        {
            let value = &self.offset;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("offset"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.size;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("size"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for FeedItem<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "feedItem"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for FeedView<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "feedView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for File<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "file"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.chunks;
            #[allow(unused_comparisons)]
            if value.len() > 4096usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("chunks"),
                    max: 4096usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Image<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "image"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.alt;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("alt"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.alt;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 300usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("alt"),
                        max: 300usize,
                        actual: count,
                    });
                }
            }
        }
        {
            let value = &self.image;
            {
                let size = value.blob().size;
                if size > 5242880usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("image"),
                        max: 5242880usize,
                        actual: size,
                    });
                }
            }
        }
        {
            let value = &self.image;
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["image/png", "image/jpeg", "image/webp"];
                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("image"),
                        accepted: vec![
                            "image/png".to_string(), "image/jpeg".to_string(),
                            "image/webp".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ImageView<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "imageView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModelView<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "modelView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for PartView<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "partView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ThingView<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "thingView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ThingViewBasic<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "thingViewBasic"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ViewerState<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "viewerState"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for WorkMeta<S> {
    fn nsid() -> &'static str {
        "space.polymodel.library.defs"
    }
    fn def_name() -> &'static str {
        "workMeta"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_space_polymodel_library_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod actor_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 Handle;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Did = Unset;
        type Handle = 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 Handle = St::Handle;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetHandle<St> {}
    impl<St: State> State for SetHandle<St> {
        type Did = St::Did;
        type Handle = Set<members::handle>;
    }
    /// 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 `handle` field
        pub struct handle(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ActorBuilder<St: actor_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<UriValue<S>>,
        Option<S>,
        Option<Did<S>>,
        Option<S>,
        Option<i64>,
        Option<i64>,
        Option<Handle<S>>,
        Option<S>,
        Option<i64>,
        Option<library::ActorViewerState<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Actor<S> {
    /// Create a new builder for this type
    pub fn builder() -> ActorBuilder<actor_state::Empty, S> {
        ActorBuilder::builder()
    }
}

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

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

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

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `description` field (optional)
    pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `description` field to an Option value (optional)
    pub fn maybe_description(mut self, value: Option<S>) -> Self {
        self._fields.1 = value;
        self
    }
}

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

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `displayName` field (optional)
    pub fn display_name(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `displayName` field to an Option value (optional)
    pub fn maybe_display_name(mut self, value: Option<S>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `followerCount` field (optional)
    pub fn follower_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `followerCount` field to an Option value (optional)
    pub fn maybe_follower_count(mut self, value: Option<i64>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `followingCount` field (optional)
    pub fn following_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `followingCount` field to an Option value (optional)
    pub fn maybe_following_count(mut self, value: Option<i64>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> ActorBuilder<St, S>
where
    St: actor_state::State,
    St::Handle: actor_state::IsUnset,
{
    /// Set the `handle` field (required)
    pub fn handle(
        mut self,
        value: impl Into<Handle<S>>,
    ) -> ActorBuilder<actor_state::SetHandle<St>, S> {
        self._fields.6 = Option::Some(value.into());
        ActorBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `pronouns` field (optional)
    pub fn pronouns(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `pronouns` field to an Option value (optional)
    pub fn maybe_pronouns(mut self, value: Option<S>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `thingCount` field (optional)
    pub fn thing_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `thingCount` field to an Option value (optional)
    pub fn maybe_thing_count(mut self, value: Option<i64>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St: actor_state::State, S: BosStr> ActorBuilder<St, S> {
    /// Set the `viewer` field (optional)
    pub fn viewer(
        mut self,
        value: impl Into<Option<library::ActorViewerState<S>>>,
    ) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `viewer` field to an Option value (optional)
    pub fn maybe_viewer(mut self, value: Option<library::ActorViewerState<S>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St, S: BosStr> ActorBuilder<St, S>
where
    St: actor_state::State,
    St::Did: actor_state::IsSet,
    St::Handle: actor_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Actor<S> {
        Actor {
            avatar: self._fields.0,
            description: self._fields.1,
            did: self._fields.2.unwrap(),
            display_name: self._fields.3,
            follower_count: self._fields.4,
            following_count: self._fields.5,
            handle: self._fields.6.unwrap(),
            pronouns: self._fields.7,
            thing_count: self._fields.8,
            viewer: self._fields.9,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Actor<S> {
        Actor {
            avatar: self._fields.0,
            description: self._fields.1,
            did: self._fields.2.unwrap(),
            display_name: self._fields.3,
            follower_count: self._fields.4,
            following_count: self._fields.5,
            handle: self._fields.6.unwrap(),
            pronouns: self._fields.7,
            thing_count: self._fields.8,
            viewer: self._fields.9,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_space_polymodel_library_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("space.polymodel.library.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("actor"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("did"), SmolStr::new_static("handle")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Avatar image URL resolved by the app view (CDN).",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("followerCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pronouns"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Hydrated profile pronouns for bylines and cards.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("thingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#actorViewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("actorViewDetailed"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Detailed hydrated actor/profile view for profile surfaces, modeled after app.bsky.actor profile view splits.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("did"), SmolStr::new_static("handle"),
                            SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("viewer")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Avatar image URL resolved by the app view (CDN).",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("defaultLicense"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("followerCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("links"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("printers"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pronouns"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("thingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#actorViewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("actorViewerState"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Viewer-specific relationship state for an actor/profile.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blockedBy"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("blocking"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Block record URI if the requester blocks this actor.",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followedBy"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Follow record URI if this actor follows the requester.",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("following"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Follow record URI if the requester follows this actor.",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muted"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("aspectRatio"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Width:height aspect ratio of an image, for layout before the blob loads.",
                        ),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("width"), SmolStr::new_static("height")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("height"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("width"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("bbox"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Axis-aligned bounding-box dimensions. ATProto has no float type, so x/y/z are decimal strings (e.g. 12.5) parsed to floats internally.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("x"), SmolStr::new_static("y"),
                            SmolStr::new_static("z")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("unit"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("x"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("y"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("z"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("chunk"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("blob"), SmolStr::new_static("offset"),
                            SmolStr::new_static("size")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blob"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("offset"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("size"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("feedItem"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("thing")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("thing"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#thingViewBasic"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("feedView"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("items")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cursor"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("items"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#feedItem"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("file"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Chunk-capable geometry manifest. Reassemble by concatenating chunks in offset order. Per-chunk integrity is the blob CID; offset+size make ordering explicit; digest verifies the fully reassembled file.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("mimeType"), SmolStr::new_static("size"),
                            SmolStr::new_static("chunks")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("chunks"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#chunk"),
                                    ..Default::default()
                                }),
                                max_length: Some(4096usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("digest"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "hex digest of the fully reassembled file (sha256 by convention)",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mimeType"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("size"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("image"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "An authored image: a blob plus alt text and aspect ratio. Stored on records; the app view resolves it to #imageView.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("image"), SmolStr::new_static("alt"),
                            SmolStr::new_static("aspectRatio")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Alt text describing the image, for accessibility.",
                                    ),
                                ),
                                max_length: Some(2000usize),
                                max_graphemes: Some(300usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("aspectRatio"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#aspectRatio"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("image"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("imageView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A resolved image view: CDN URLs for thumbnail and full size plus aspect ratio. Currently resolved via Bluesky's CDN by the app view.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("thumb"), SmolStr::new_static("fullsize")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alt"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("aspectRatio"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#aspectRatio"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("fullsize"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Fully-qualified full-size URL (CDN, resolved by the app view).",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("thumb"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Fully-qualified thumbnail URL (CDN, resolved by the app view).",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modelView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("name"),
                            SmolStr::new_static("partCount"),
                            SmolStr::new_static("viewer")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#actor"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("cover"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("partCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("previews"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("summary"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#viewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("partView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("name"), SmolStr::new_static("file"),
                            SmolStr::new_static("viewer")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#actor"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("file"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#file"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("format"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("previews"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#viewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("thingView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("name"), SmolStr::new_static("license"),
                            SmolStr::new_static("likeCount"),
                            SmolStr::new_static("saveCount"),
                            SmolStr::new_static("modelCount"),
                            SmolStr::new_static("partCount"),
                            SmolStr::new_static("viewer")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#actor"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("cover"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("derivedFrom"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("intendedToWorkWith"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("license"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("likeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("modelCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("partCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("previews"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("saveCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("summary"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Hydrated display tags, including appview-aggregated external tag assertions.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#viewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("thingViewBasic"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("name"),
                            SmolStr::new_static("likeCount"),
                            SmolStr::new_static("saveCount"),
                            SmolStr::new_static("modelCount"),
                            SmolStr::new_static("partCount"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("viewer")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#actor"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("cover"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..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("modelCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("partCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("previews"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#imageView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("saveCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Hydrated display tags for browse/search/profile cards, including appview-aggregated external tag assertions.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#viewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("viewerState"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("like"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("save"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("workMeta"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Reference-only shared field set; fields are inlined on thing/model.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cover"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#image"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("derivedFrom"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("instructions"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("intendedToWorkWith"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("license"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("previews"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#image"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("summary"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod actor_view_detailed_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 Handle;
        type IndexedAt;
        type Record;
        type Viewer;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Did = Unset;
        type Handle = Unset;
        type IndexedAt = Unset;
        type Record = Unset;
        type Viewer = 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 Handle = St::Handle;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetHandle<St> {}
    impl<St: State> State for SetHandle<St> {
        type Did = St::Did;
        type Handle = Set<members::handle>;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Viewer = St::Viewer;
    }
    ///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 Did = St::Did;
        type Handle = St::Handle;
        type IndexedAt = Set<members::indexed_at>;
        type Record = St::Record;
        type Viewer = St::Viewer;
    }
    ///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 Did = St::Did;
        type Handle = St::Handle;
        type IndexedAt = St::IndexedAt;
        type Record = Set<members::record>;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `viewer` field to Set
    pub struct SetViewer<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetViewer<St> {}
    impl<St: State> State for SetViewer<St> {
        type Did = St::Did;
        type Handle = St::Handle;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Viewer = Set<members::viewer>;
    }
    /// 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 `handle` field
        pub struct handle(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `viewer` field
        pub struct viewer(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ActorViewDetailedBuilder<
    St: actor_view_detailed_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<UriValue<S>>,
        Option<S>,
        Option<S>,
        Option<Did<S>>,
        Option<S>,
        Option<i64>,
        Option<i64>,
        Option<Handle<S>>,
        Option<Datetime>,
        Option<Vec<UriValue<S>>>,
        Option<Vec<S>>,
        Option<S>,
        Option<Data<S>>,
        Option<i64>,
        Option<library::ActorViewerState<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ActorViewDetailed<S> {
    /// Create a new builder for this type
    pub fn builder() -> ActorViewDetailedBuilder<actor_view_detailed_state::Empty, S> {
        ActorViewDetailedBuilder::builder()
    }
}

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

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

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

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `defaultLicense` field (optional)
    pub fn default_license(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `defaultLicense` field to an Option value (optional)
    pub fn maybe_default_license(mut self, value: Option<S>) -> Self {
        self._fields.1 = value;
        self
    }
}

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

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

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `displayName` field (optional)
    pub fn display_name(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `displayName` field to an Option value (optional)
    pub fn maybe_display_name(mut self, value: Option<S>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `followerCount` field (optional)
    pub fn follower_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `followerCount` field to an Option value (optional)
    pub fn maybe_follower_count(mut self, value: Option<i64>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `followingCount` field (optional)
    pub fn following_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `followingCount` field to an Option value (optional)
    pub fn maybe_following_count(mut self, value: Option<i64>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> ActorViewDetailedBuilder<St, S>
where
    St: actor_view_detailed_state::State,
    St::Handle: actor_view_detailed_state::IsUnset,
{
    /// Set the `handle` field (required)
    pub fn handle(
        mut self,
        value: impl Into<Handle<S>>,
    ) -> ActorViewDetailedBuilder<actor_view_detailed_state::SetHandle<St>, S> {
        self._fields.7 = Option::Some(value.into());
        ActorViewDetailedBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `links` field (optional)
    pub fn links(mut self, value: impl Into<Option<Vec<UriValue<S>>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `links` field to an Option value (optional)
    pub fn maybe_links(mut self, value: Option<Vec<UriValue<S>>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `printers` field (optional)
    pub fn printers(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `printers` field to an Option value (optional)
    pub fn maybe_printers(mut self, value: Option<Vec<S>>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `pronouns` field (optional)
    pub fn pronouns(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `pronouns` field to an Option value (optional)
    pub fn maybe_pronouns(mut self, value: Option<S>) -> Self {
        self._fields.11 = value;
        self
    }
}

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

impl<St: actor_view_detailed_state::State, S: BosStr> ActorViewDetailedBuilder<St, S> {
    /// Set the `thingCount` field (optional)
    pub fn thing_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `thingCount` field to an Option value (optional)
    pub fn maybe_thing_count(mut self, value: Option<i64>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St, S: BosStr> ActorViewDetailedBuilder<St, S>
where
    St: actor_view_detailed_state::State,
    St::Viewer: actor_view_detailed_state::IsUnset,
{
    /// Set the `viewer` field (required)
    pub fn viewer(
        mut self,
        value: impl Into<library::ActorViewerState<S>>,
    ) -> ActorViewDetailedBuilder<actor_view_detailed_state::SetViewer<St>, S> {
        self._fields.14 = Option::Some(value.into());
        ActorViewDetailedBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ActorViewDetailedBuilder<St, S>
where
    St: actor_view_detailed_state::State,
    St::Did: actor_view_detailed_state::IsSet,
    St::Handle: actor_view_detailed_state::IsSet,
    St::IndexedAt: actor_view_detailed_state::IsSet,
    St::Record: actor_view_detailed_state::IsSet,
    St::Viewer: actor_view_detailed_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ActorViewDetailed<S> {
        ActorViewDetailed {
            avatar: self._fields.0,
            default_license: self._fields.1,
            description: self._fields.2,
            did: self._fields.3.unwrap(),
            display_name: self._fields.4,
            follower_count: self._fields.5,
            following_count: self._fields.6,
            handle: self._fields.7.unwrap(),
            indexed_at: self._fields.8.unwrap(),
            links: self._fields.9,
            printers: self._fields.10,
            pronouns: self._fields.11,
            record: self._fields.12.unwrap(),
            thing_count: self._fields.13,
            viewer: self._fields.14.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>>,
    ) -> ActorViewDetailed<S> {
        ActorViewDetailed {
            avatar: self._fields.0,
            default_license: self._fields.1,
            description: self._fields.2,
            did: self._fields.3.unwrap(),
            display_name: self._fields.4,
            follower_count: self._fields.5,
            following_count: self._fields.6,
            handle: self._fields.7.unwrap(),
            indexed_at: self._fields.8.unwrap(),
            links: self._fields.9,
            printers: self._fields.10,
            pronouns: self._fields.11,
            record: self._fields.12.unwrap(),
            thing_count: self._fields.13,
            viewer: self._fields.14.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> AspectRatio<S> {
    /// Create a new builder for this type
    pub fn builder() -> AspectRatioBuilder<aspect_ratio_state::Empty, S> {
        AspectRatioBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> AspectRatioBuilder<St, S>
where
    St: aspect_ratio_state::State,
    St::Height: aspect_ratio_state::IsSet,
    St::Width: aspect_ratio_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> AspectRatio<S> {
        AspectRatio {
            height: self._fields.0.unwrap(),
            width: 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>>,
    ) -> AspectRatio<S> {
        AspectRatio {
            height: self._fields.0.unwrap(),
            width: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod chunk_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 Blob;
        type Offset;
        type Size;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Blob = Unset;
        type Offset = Unset;
        type Size = Unset;
    }
    ///State transition - sets the `blob` field to Set
    pub struct SetBlob<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBlob<St> {}
    impl<St: State> State for SetBlob<St> {
        type Blob = Set<members::blob>;
        type Offset = St::Offset;
        type Size = St::Size;
    }
    ///State transition - sets the `offset` field to Set
    pub struct SetOffset<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetOffset<St> {}
    impl<St: State> State for SetOffset<St> {
        type Blob = St::Blob;
        type Offset = Set<members::offset>;
        type Size = St::Size;
    }
    ///State transition - sets the `size` field to Set
    pub struct SetSize<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSize<St> {}
    impl<St: State> State for SetSize<St> {
        type Blob = St::Blob;
        type Offset = St::Offset;
        type Size = Set<members::size>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `blob` field
        pub struct blob(());
        ///Marker type for the `offset` field
        pub struct offset(());
        ///Marker type for the `size` field
        pub struct size(());
    }
}

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

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

impl<S: BosStr> Chunk<S> {
    /// Create a new builder for this type
    pub fn builder() -> ChunkBuilder<chunk_state::Empty, S> {
        ChunkBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ChunkBuilder<St, S>
where
    St: chunk_state::State,
    St::Blob: chunk_state::IsUnset,
{
    /// Set the `blob` field (required)
    pub fn blob(
        mut self,
        value: impl Into<BlobRef<S>>,
    ) -> ChunkBuilder<chunk_state::SetBlob<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ChunkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ChunkBuilder<St, S>
where
    St: chunk_state::State,
    St::Size: chunk_state::IsUnset,
{
    /// Set the `size` field (required)
    pub fn size(
        mut self,
        value: impl Into<i64>,
    ) -> ChunkBuilder<chunk_state::SetSize<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ChunkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ChunkBuilder<St, S>
where
    St: chunk_state::State,
    St::Blob: chunk_state::IsSet,
    St::Offset: chunk_state::IsSet,
    St::Size: chunk_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Chunk<S> {
        Chunk {
            blob: self._fields.0.unwrap(),
            offset: self._fields.1.unwrap(),
            size: 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>>) -> Chunk<S> {
        Chunk {
            blob: self._fields.0.unwrap(),
            offset: self._fields.1.unwrap(),
            size: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> FeedItem<S> {
    /// Create a new builder for this type
    pub fn builder() -> FeedItemBuilder<feed_item_state::Empty, S> {
        FeedItemBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> FeedItemBuilder<St, S>
where
    St: feed_item_state::State,
    St::Thing: feed_item_state::IsUnset,
{
    /// Set the `thing` field (required)
    pub fn thing(
        mut self,
        value: impl Into<library::ThingViewBasic<S>>,
    ) -> FeedItemBuilder<feed_item_state::SetThing<St>, S> {
        self._fields.0 = Option::Some(value.into());
        FeedItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FeedItemBuilder<St, S>
where
    St: feed_item_state::State,
    St::Thing: feed_item_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> FeedItem<S> {
        FeedItem {
            thing: 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>>) -> FeedItem<S> {
        FeedItem {
            thing: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> FeedView<S> {
    /// Create a new builder for this type
    pub fn builder() -> FeedViewBuilder<feed_view_state::Empty, S> {
        FeedViewBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> FeedViewBuilder<St, S>
where
    St: feed_view_state::State,
    St::Items: feed_view_state::IsUnset,
{
    /// Set the `items` field (required)
    pub fn items(
        mut self,
        value: impl Into<Vec<library::FeedItem<S>>>,
    ) -> FeedViewBuilder<feed_view_state::SetItems<St>, S> {
        self._fields.1 = Option::Some(value.into());
        FeedViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FeedViewBuilder<St, S>
where
    St: feed_view_state::State,
    St::Items: feed_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> FeedView<S> {
        FeedView {
            cursor: self._fields.0,
            items: 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>>) -> FeedView<S> {
        FeedView {
            cursor: self._fields.0,
            items: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod file_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 Chunks;
        type MimeType;
        type Size;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Chunks = Unset;
        type MimeType = Unset;
        type Size = Unset;
    }
    ///State transition - sets the `chunks` field to Set
    pub struct SetChunks<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetChunks<St> {}
    impl<St: State> State for SetChunks<St> {
        type Chunks = Set<members::chunks>;
        type MimeType = St::MimeType;
        type Size = St::Size;
    }
    ///State transition - sets the `mime_type` field to Set
    pub struct SetMimeType<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMimeType<St> {}
    impl<St: State> State for SetMimeType<St> {
        type Chunks = St::Chunks;
        type MimeType = Set<members::mime_type>;
        type Size = St::Size;
    }
    ///State transition - sets the `size` field to Set
    pub struct SetSize<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSize<St> {}
    impl<St: State> State for SetSize<St> {
        type Chunks = St::Chunks;
        type MimeType = St::MimeType;
        type Size = Set<members::size>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `chunks` field
        pub struct chunks(());
        ///Marker type for the `mime_type` field
        pub struct mime_type(());
        ///Marker type for the `size` field
        pub struct size(());
    }
}

/// Builder for constructing an instance of this type.
pub struct FileBuilder<St: file_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Vec<library::Chunk<S>>>, Option<S>, Option<S>, Option<i64>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> File<S> {
    /// Create a new builder for this type
    pub fn builder() -> FileBuilder<file_state::Empty, S> {
        FileBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> FileBuilder<St, S>
where
    St: file_state::State,
    St::Chunks: file_state::IsUnset,
{
    /// Set the `chunks` field (required)
    pub fn chunks(
        mut self,
        value: impl Into<Vec<library::Chunk<S>>>,
    ) -> FileBuilder<file_state::SetChunks<St>, S> {
        self._fields.0 = Option::Some(value.into());
        FileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: file_state::State, S: BosStr> FileBuilder<St, S> {
    /// Set the `digest` field (optional)
    pub fn digest(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `digest` field to an Option value (optional)
    pub fn maybe_digest(mut self, value: Option<S>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> FileBuilder<St, S>
where
    St: file_state::State,
    St::MimeType: file_state::IsUnset,
{
    /// Set the `mimeType` field (required)
    pub fn mime_type(
        mut self,
        value: impl Into<S>,
    ) -> FileBuilder<file_state::SetMimeType<St>, S> {
        self._fields.2 = Option::Some(value.into());
        FileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FileBuilder<St, S>
where
    St: file_state::State,
    St::Size: file_state::IsUnset,
{
    /// Set the `size` field (required)
    pub fn size(
        mut self,
        value: impl Into<i64>,
    ) -> FileBuilder<file_state::SetSize<St>, S> {
        self._fields.3 = Option::Some(value.into());
        FileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FileBuilder<St, S>
where
    St: file_state::State,
    St::Chunks: file_state::IsSet,
    St::MimeType: file_state::IsSet,
    St::Size: file_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> File<S> {
        File {
            chunks: self._fields.0.unwrap(),
            digest: self._fields.1,
            mime_type: self._fields.2.unwrap(),
            size: 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>>) -> File<S> {
        File {
            chunks: self._fields.0.unwrap(),
            digest: self._fields.1,
            mime_type: self._fields.2.unwrap(),
            size: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod image_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 Alt;
        type AspectRatio;
        type Image;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Alt = Unset;
        type AspectRatio = Unset;
        type Image = Unset;
    }
    ///State transition - sets the `alt` field to Set
    pub struct SetAlt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAlt<St> {}
    impl<St: State> State for SetAlt<St> {
        type Alt = Set<members::alt>;
        type AspectRatio = St::AspectRatio;
        type Image = St::Image;
    }
    ///State transition - sets the `aspect_ratio` field to Set
    pub struct SetAspectRatio<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAspectRatio<St> {}
    impl<St: State> State for SetAspectRatio<St> {
        type Alt = St::Alt;
        type AspectRatio = Set<members::aspect_ratio>;
        type Image = St::Image;
    }
    ///State transition - sets the `image` field to Set
    pub struct SetImage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetImage<St> {}
    impl<St: State> State for SetImage<St> {
        type Alt = St::Alt;
        type AspectRatio = St::AspectRatio;
        type Image = Set<members::image>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `alt` field
        pub struct alt(());
        ///Marker type for the `aspect_ratio` field
        pub struct aspect_ratio(());
        ///Marker type for the `image` field
        pub struct image(());
    }
}

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

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

impl<S: BosStr> Image<S> {
    /// Create a new builder for this type
    pub fn builder() -> ImageBuilder<image_state::Empty, S> {
        ImageBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ImageBuilder<St, S>
where
    St: image_state::State,
    St::Alt: image_state::IsUnset,
{
    /// Set the `alt` field (required)
    pub fn alt(
        mut self,
        value: impl Into<S>,
    ) -> ImageBuilder<image_state::SetAlt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ImageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ImageBuilder<St, S>
where
    St: image_state::State,
    St::AspectRatio: image_state::IsUnset,
{
    /// Set the `aspectRatio` field (required)
    pub fn aspect_ratio(
        mut self,
        value: impl Into<library::AspectRatio<S>>,
    ) -> ImageBuilder<image_state::SetAspectRatio<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ImageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ImageBuilder<St, S>
where
    St: image_state::State,
    St::Image: image_state::IsUnset,
{
    /// Set the `image` field (required)
    pub fn image(
        mut self,
        value: impl Into<BlobRef<S>>,
    ) -> ImageBuilder<image_state::SetImage<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ImageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ImageBuilder<St, S>
where
    St: image_state::State,
    St::Alt: image_state::IsSet,
    St::AspectRatio: image_state::IsSet,
    St::Image: image_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Image<S> {
        Image {
            alt: self._fields.0.unwrap(),
            aspect_ratio: self._fields.1.unwrap(),
            image: 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>>) -> Image<S> {
        Image {
            alt: self._fields.0.unwrap(),
            aspect_ratio: self._fields.1.unwrap(),
            image: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod image_view_state {

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

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

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

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

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

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

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

impl<St: image_view_state::State, S: BosStr> ImageViewBuilder<St, S> {
    /// Set the `aspectRatio` field (optional)
    pub fn aspect_ratio(
        mut self,
        value: impl Into<Option<library::AspectRatio<S>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `aspectRatio` field to an Option value (optional)
    pub fn maybe_aspect_ratio(mut self, value: Option<library::AspectRatio<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> ImageViewBuilder<St, S>
where
    St: image_view_state::State,
    St::Fullsize: image_view_state::IsUnset,
{
    /// Set the `fullsize` field (required)
    pub fn fullsize(
        mut self,
        value: impl Into<UriValue<S>>,
    ) -> ImageViewBuilder<image_view_state::SetFullsize<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ImageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ImageViewBuilder<St, S>
where
    St: image_view_state::State,
    St::Thumb: image_view_state::IsUnset,
{
    /// Set the `thumb` field (required)
    pub fn thumb(
        mut self,
        value: impl Into<UriValue<S>>,
    ) -> ImageViewBuilder<image_view_state::SetThumb<St>, S> {
        self._fields.3 = Option::Some(value.into());
        ImageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ImageViewBuilder<St, S>
where
    St: image_view_state::State,
    St::Fullsize: image_view_state::IsSet,
    St::Thumb: image_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ImageView<S> {
        ImageView {
            alt: self._fields.0,
            aspect_ratio: self._fields.1,
            fullsize: self._fields.2.unwrap(),
            thumb: 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>>,
    ) -> ImageView<S> {
        ImageView {
            alt: self._fields.0,
            aspect_ratio: self._fields.1,
            fullsize: self._fields.2.unwrap(),
            thumb: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod model_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 Author;
        type Cid;
        type IndexedAt;
        type Name;
        type PartCount;
        type Record;
        type Uri;
        type Viewer;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type Name = Unset;
        type PartCount = Unset;
        type Record = Unset;
        type Uri = Unset;
        type Viewer = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Name = Set<members::name>;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `part_count` field to Set
    pub struct SetPartCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPartCount<St> {}
    impl<St: State> State for SetPartCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type PartCount = Set<members::part_count>;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = Set<members::record>;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type Uri = Set<members::uri>;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `viewer` field to Set
    pub struct SetViewer<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetViewer<St> {}
    impl<St: State> State for SetViewer<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = Set<members::viewer>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `part_count` field
        pub struct part_count(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `viewer` field
        pub struct viewer(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ModelViewBuilder<St: model_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<library::Actor<S>>,
        Option<S>,
        Option<Vec<library::ImageView<S>>>,
        Option<Datetime>,
        Option<S>,
        Option<i64>,
        Option<Vec<library::ImageView<S>>>,
        Option<Data<S>>,
        Option<S>,
        Option<AtUri<S>>,
        Option<library::ViewerState<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ModelView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModelViewBuilder<model_view_state::Empty, S> {
        ModelViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ModelViewBuilder<St, S>
where
    St: model_view_state::State,
    St::Author: model_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<library::Actor<S>>,
    ) -> ModelViewBuilder<model_view_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ModelViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: model_view_state::State, S: BosStr> ModelViewBuilder<St, S> {
    /// Set the `cover` field (optional)
    pub fn cover(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `cover` field to an Option value (optional)
    pub fn maybe_cover(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.2 = value;
        self
    }
}

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

impl<St, S: BosStr> ModelViewBuilder<St, S>
where
    St: model_view_state::State,
    St::Name: model_view_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> ModelViewBuilder<model_view_state::SetName<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ModelViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModelViewBuilder<St, S>
where
    St: model_view_state::State,
    St::PartCount: model_view_state::IsUnset,
{
    /// Set the `partCount` field (required)
    pub fn part_count(
        mut self,
        value: impl Into<i64>,
    ) -> ModelViewBuilder<model_view_state::SetPartCount<St>, S> {
        self._fields.5 = Option::Some(value.into());
        ModelViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: model_view_state::State, S: BosStr> ModelViewBuilder<St, S> {
    /// Set the `previews` field (optional)
    pub fn previews(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `previews` field to an Option value (optional)
    pub fn maybe_previews(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

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

impl<St: model_view_state::State, S: BosStr> ModelViewBuilder<St, S> {
    /// Set the `summary` field (optional)
    pub fn summary(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `summary` field to an Option value (optional)
    pub fn maybe_summary(mut self, value: Option<S>) -> Self {
        self._fields.8 = value;
        self
    }
}

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

impl<St, S: BosStr> ModelViewBuilder<St, S>
where
    St: model_view_state::State,
    St::Viewer: model_view_state::IsUnset,
{
    /// Set the `viewer` field (required)
    pub fn viewer(
        mut self,
        value: impl Into<library::ViewerState<S>>,
    ) -> ModelViewBuilder<model_view_state::SetViewer<St>, S> {
        self._fields.10 = Option::Some(value.into());
        ModelViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModelViewBuilder<St, S>
where
    St: model_view_state::State,
    St::Author: model_view_state::IsSet,
    St::Cid: model_view_state::IsSet,
    St::IndexedAt: model_view_state::IsSet,
    St::Name: model_view_state::IsSet,
    St::PartCount: model_view_state::IsSet,
    St::Record: model_view_state::IsSet,
    St::Uri: model_view_state::IsSet,
    St::Viewer: model_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModelView<S> {
        ModelView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover: self._fields.2,
            indexed_at: self._fields.3.unwrap(),
            name: self._fields.4.unwrap(),
            part_count: self._fields.5.unwrap(),
            previews: self._fields.6,
            record: self._fields.7.unwrap(),
            summary: self._fields.8,
            uri: self._fields.9.unwrap(),
            viewer: self._fields.10.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>>,
    ) -> ModelView<S> {
        ModelView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover: self._fields.2,
            indexed_at: self._fields.3.unwrap(),
            name: self._fields.4.unwrap(),
            part_count: self._fields.5.unwrap(),
            previews: self._fields.6,
            record: self._fields.7.unwrap(),
            summary: self._fields.8,
            uri: self._fields.9.unwrap(),
            viewer: self._fields.10.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod part_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 Author;
        type Cid;
        type File;
        type IndexedAt;
        type Name;
        type Record;
        type Uri;
        type Viewer;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Cid = Unset;
        type File = Unset;
        type IndexedAt = Unset;
        type Name = Unset;
        type Record = Unset;
        type Uri = Unset;
        type Viewer = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Cid = St::Cid;
        type File = St::File;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = Set<members::cid>;
        type File = St::File;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `file` field to Set
    pub struct SetFile<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetFile<St> {}
    impl<St: State> State for SetFile<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type File = Set<members::file>;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type File = St::File;
        type IndexedAt = Set<members::indexed_at>;
        type Name = St::Name;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type File = St::File;
        type IndexedAt = St::IndexedAt;
        type Name = Set<members::name>;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type File = St::File;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type Record = Set<members::record>;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type File = St::File;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type Record = St::Record;
        type Uri = Set<members::uri>;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `viewer` field to Set
    pub struct SetViewer<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetViewer<St> {}
    impl<St: State> State for SetViewer<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type File = St::File;
        type IndexedAt = St::IndexedAt;
        type Name = St::Name;
        type Record = St::Record;
        type Uri = St::Uri;
        type Viewer = Set<members::viewer>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `file` field
        pub struct file(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `viewer` field
        pub struct viewer(());
    }
}

/// Builder for constructing an instance of this type.
pub struct PartViewBuilder<St: part_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<library::Actor<S>>,
        Option<S>,
        Option<library::File<S>>,
        Option<S>,
        Option<Datetime>,
        Option<S>,
        Option<Vec<library::ImageView<S>>>,
        Option<Data<S>>,
        Option<AtUri<S>>,
        Option<library::ViewerState<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> PartView<S> {
    /// Create a new builder for this type
    pub fn builder() -> PartViewBuilder<part_view_state::Empty, S> {
        PartViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> PartViewBuilder<St, S>
where
    St: part_view_state::State,
    St::Author: part_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<library::Actor<S>>,
    ) -> PartViewBuilder<part_view_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        PartViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> PartViewBuilder<St, S>
where
    St: part_view_state::State,
    St::File: part_view_state::IsUnset,
{
    /// Set the `file` field (required)
    pub fn file(
        mut self,
        value: impl Into<library::File<S>>,
    ) -> PartViewBuilder<part_view_state::SetFile<St>, S> {
        self._fields.2 = Option::Some(value.into());
        PartViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: part_view_state::State, S: BosStr> PartViewBuilder<St, S> {
    /// Set the `format` field (optional)
    pub fn format(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `format` field to an Option value (optional)
    pub fn maybe_format(mut self, value: Option<S>) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<St, S: BosStr> PartViewBuilder<St, S>
where
    St: part_view_state::State,
    St::Name: part_view_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> PartViewBuilder<part_view_state::SetName<St>, S> {
        self._fields.5 = Option::Some(value.into());
        PartViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: part_view_state::State, S: BosStr> PartViewBuilder<St, S> {
    /// Set the `previews` field (optional)
    pub fn previews(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `previews` field to an Option value (optional)
    pub fn maybe_previews(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

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

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

impl<St, S: BosStr> PartViewBuilder<St, S>
where
    St: part_view_state::State,
    St::Viewer: part_view_state::IsUnset,
{
    /// Set the `viewer` field (required)
    pub fn viewer(
        mut self,
        value: impl Into<library::ViewerState<S>>,
    ) -> PartViewBuilder<part_view_state::SetViewer<St>, S> {
        self._fields.9 = Option::Some(value.into());
        PartViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PartViewBuilder<St, S>
where
    St: part_view_state::State,
    St::Author: part_view_state::IsSet,
    St::Cid: part_view_state::IsSet,
    St::File: part_view_state::IsSet,
    St::IndexedAt: part_view_state::IsSet,
    St::Name: part_view_state::IsSet,
    St::Record: part_view_state::IsSet,
    St::Uri: part_view_state::IsSet,
    St::Viewer: part_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PartView<S> {
        PartView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            file: self._fields.2.unwrap(),
            format: self._fields.3,
            indexed_at: self._fields.4.unwrap(),
            name: self._fields.5.unwrap(),
            previews: self._fields.6,
            record: self._fields.7.unwrap(),
            uri: self._fields.8.unwrap(),
            viewer: self._fields.9.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>>) -> PartView<S> {
        PartView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            file: self._fields.2.unwrap(),
            format: self._fields.3,
            indexed_at: self._fields.4.unwrap(),
            name: self._fields.5.unwrap(),
            previews: self._fields.6,
            record: self._fields.7.unwrap(),
            uri: self._fields.8.unwrap(),
            viewer: self._fields.9.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod thing_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 Author;
        type Cid;
        type IndexedAt;
        type License;
        type LikeCount;
        type ModelCount;
        type Name;
        type PartCount;
        type Record;
        type SaveCount;
        type Uri;
        type Viewer;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type License = Unset;
        type LikeCount = Unset;
        type ModelCount = Unset;
        type Name = Unset;
        type PartCount = Unset;
        type Record = Unset;
        type SaveCount = Unset;
        type Uri = Unset;
        type Viewer = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `license` field to Set
    pub struct SetLicense<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLicense<St> {}
    impl<St: State> State for SetLicense<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = Set<members::license>;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `like_count` field to Set
    pub struct SetLikeCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLikeCount<St> {}
    impl<St: State> State for SetLikeCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = Set<members::like_count>;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `model_count` field to Set
    pub struct SetModelCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetModelCount<St> {}
    impl<St: State> State for SetModelCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = Set<members::model_count>;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = Set<members::name>;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `part_count` field to Set
    pub struct SetPartCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPartCount<St> {}
    impl<St: State> State for SetPartCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = Set<members::part_count>;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = Set<members::record>;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `save_count` field to Set
    pub struct SetSaveCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSaveCount<St> {}
    impl<St: State> State for SetSaveCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = Set<members::save_count>;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = Set<members::uri>;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `viewer` field to Set
    pub struct SetViewer<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetViewer<St> {}
    impl<St: State> State for SetViewer<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type License = St::License;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type Record = St::Record;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = Set<members::viewer>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `license` field
        pub struct license(());
        ///Marker type for the `like_count` field
        pub struct like_count(());
        ///Marker type for the `model_count` field
        pub struct model_count(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `part_count` field
        pub struct part_count(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `save_count` field
        pub struct save_count(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `viewer` field
        pub struct viewer(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ThingViewBuilder<St: thing_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<library::Actor<S>>,
        Option<S>,
        Option<Vec<library::ImageView<S>>>,
        Option<StrongRef<S>>,
        Option<Datetime>,
        Option<Vec<StrongRef<S>>>,
        Option<S>,
        Option<i64>,
        Option<i64>,
        Option<S>,
        Option<i64>,
        Option<Vec<library::ImageView<S>>>,
        Option<Data<S>>,
        Option<i64>,
        Option<S>,
        Option<Vec<S>>,
        Option<AtUri<S>>,
        Option<library::ViewerState<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ThingView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ThingViewBuilder<thing_view_state::Empty, S> {
        ThingViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::Author: thing_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<library::Actor<S>>,
    ) -> ThingViewBuilder<thing_view_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: thing_view_state::State, S: BosStr> ThingViewBuilder<St, S> {
    /// Set the `cover` field (optional)
    pub fn cover(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `cover` field to an Option value (optional)
    pub fn maybe_cover(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: thing_view_state::State, S: BosStr> ThingViewBuilder<St, S> {
    /// Set the `derivedFrom` field (optional)
    pub fn derived_from(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `derivedFrom` field to an Option value (optional)
    pub fn maybe_derived_from(mut self, value: Option<StrongRef<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<St: thing_view_state::State, S: BosStr> ThingViewBuilder<St, S> {
    /// Set the `intendedToWorkWith` field (optional)
    pub fn intended_to_work_with(
        mut self,
        value: impl Into<Option<Vec<StrongRef<S>>>>,
    ) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `intendedToWorkWith` field to an Option value (optional)
    pub fn maybe_intended_to_work_with(
        mut self,
        value: Option<Vec<StrongRef<S>>>,
    ) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::License: thing_view_state::IsUnset,
{
    /// Set the `license` field (required)
    pub fn license(
        mut self,
        value: impl Into<S>,
    ) -> ThingViewBuilder<thing_view_state::SetLicense<St>, S> {
        self._fields.6 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::LikeCount: thing_view_state::IsUnset,
{
    /// Set the `likeCount` field (required)
    pub fn like_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBuilder<thing_view_state::SetLikeCount<St>, S> {
        self._fields.7 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::ModelCount: thing_view_state::IsUnset,
{
    /// Set the `modelCount` field (required)
    pub fn model_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBuilder<thing_view_state::SetModelCount<St>, S> {
        self._fields.8 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::Name: thing_view_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> ThingViewBuilder<thing_view_state::SetName<St>, S> {
        self._fields.9 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::PartCount: thing_view_state::IsUnset,
{
    /// Set the `partCount` field (required)
    pub fn part_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBuilder<thing_view_state::SetPartCount<St>, S> {
        self._fields.10 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: thing_view_state::State, S: BosStr> ThingViewBuilder<St, S> {
    /// Set the `previews` field (optional)
    pub fn previews(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `previews` field to an Option value (optional)
    pub fn maybe_previews(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.11 = value;
        self
    }
}

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

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::SaveCount: thing_view_state::IsUnset,
{
    /// Set the `saveCount` field (required)
    pub fn save_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBuilder<thing_view_state::SetSaveCount<St>, S> {
        self._fields.13 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: thing_view_state::State, S: BosStr> ThingViewBuilder<St, S> {
    /// Set the `summary` field (optional)
    pub fn summary(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `summary` field to an Option value (optional)
    pub fn maybe_summary(mut self, value: Option<S>) -> Self {
        self._fields.14 = value;
        self
    }
}

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

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

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::Viewer: thing_view_state::IsUnset,
{
    /// Set the `viewer` field (required)
    pub fn viewer(
        mut self,
        value: impl Into<library::ViewerState<S>>,
    ) -> ThingViewBuilder<thing_view_state::SetViewer<St>, S> {
        self._fields.17 = Option::Some(value.into());
        ThingViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBuilder<St, S>
where
    St: thing_view_state::State,
    St::Author: thing_view_state::IsSet,
    St::Cid: thing_view_state::IsSet,
    St::IndexedAt: thing_view_state::IsSet,
    St::License: thing_view_state::IsSet,
    St::LikeCount: thing_view_state::IsSet,
    St::ModelCount: thing_view_state::IsSet,
    St::Name: thing_view_state::IsSet,
    St::PartCount: thing_view_state::IsSet,
    St::Record: thing_view_state::IsSet,
    St::SaveCount: thing_view_state::IsSet,
    St::Uri: thing_view_state::IsSet,
    St::Viewer: thing_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ThingView<S> {
        ThingView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover: self._fields.2,
            derived_from: self._fields.3,
            indexed_at: self._fields.4.unwrap(),
            intended_to_work_with: self._fields.5,
            license: self._fields.6.unwrap(),
            like_count: self._fields.7.unwrap(),
            model_count: self._fields.8.unwrap(),
            name: self._fields.9.unwrap(),
            part_count: self._fields.10.unwrap(),
            previews: self._fields.11,
            record: self._fields.12.unwrap(),
            save_count: self._fields.13.unwrap(),
            summary: self._fields.14,
            tags: self._fields.15,
            uri: self._fields.16.unwrap(),
            viewer: self._fields.17.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>>,
    ) -> ThingView<S> {
        ThingView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover: self._fields.2,
            derived_from: self._fields.3,
            indexed_at: self._fields.4.unwrap(),
            intended_to_work_with: self._fields.5,
            license: self._fields.6.unwrap(),
            like_count: self._fields.7.unwrap(),
            model_count: self._fields.8.unwrap(),
            name: self._fields.9.unwrap(),
            part_count: self._fields.10.unwrap(),
            previews: self._fields.11,
            record: self._fields.12.unwrap(),
            save_count: self._fields.13.unwrap(),
            summary: self._fields.14,
            tags: self._fields.15,
            uri: self._fields.16.unwrap(),
            viewer: self._fields.17.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod thing_view_basic_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 Author;
        type Cid;
        type IndexedAt;
        type LikeCount;
        type ModelCount;
        type Name;
        type PartCount;
        type SaveCount;
        type Uri;
        type Viewer;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type LikeCount = Unset;
        type ModelCount = Unset;
        type Name = Unset;
        type PartCount = Unset;
        type SaveCount = Unset;
        type Uri = Unset;
        type Viewer = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `like_count` field to Set
    pub struct SetLikeCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLikeCount<St> {}
    impl<St: State> State for SetLikeCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = Set<members::like_count>;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `model_count` field to Set
    pub struct SetModelCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetModelCount<St> {}
    impl<St: State> State for SetModelCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = Set<members::model_count>;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = Set<members::name>;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `part_count` field to Set
    pub struct SetPartCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPartCount<St> {}
    impl<St: State> State for SetPartCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = Set<members::part_count>;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `save_count` field to Set
    pub struct SetSaveCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSaveCount<St> {}
    impl<St: State> State for SetSaveCount<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = Set<members::save_count>;
        type Uri = St::Uri;
        type Viewer = St::Viewer;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = Set<members::uri>;
        type Viewer = St::Viewer;
    }
    ///State transition - sets the `viewer` field to Set
    pub struct SetViewer<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetViewer<St> {}
    impl<St: State> State for SetViewer<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type LikeCount = St::LikeCount;
        type ModelCount = St::ModelCount;
        type Name = St::Name;
        type PartCount = St::PartCount;
        type SaveCount = St::SaveCount;
        type Uri = St::Uri;
        type Viewer = Set<members::viewer>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `like_count` field
        pub struct like_count(());
        ///Marker type for the `model_count` field
        pub struct model_count(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `part_count` field
        pub struct part_count(());
        ///Marker type for the `save_count` field
        pub struct save_count(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `viewer` field
        pub struct viewer(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ThingViewBasicBuilder<
    St: thing_view_basic_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<library::Actor<S>>,
        Option<S>,
        Option<Vec<library::ImageView<S>>>,
        Option<Datetime>,
        Option<i64>,
        Option<i64>,
        Option<S>,
        Option<i64>,
        Option<Vec<library::ImageView<S>>>,
        Option<i64>,
        Option<Vec<S>>,
        Option<AtUri<S>>,
        Option<library::ViewerState<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ThingViewBasic<S> {
    /// Create a new builder for this type
    pub fn builder() -> ThingViewBasicBuilder<thing_view_basic_state::Empty, S> {
        ThingViewBasicBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::Author: thing_view_basic_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<library::Actor<S>>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: thing_view_basic_state::State, S: BosStr> ThingViewBasicBuilder<St, S> {
    /// Set the `cover` field (optional)
    pub fn cover(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `cover` field to an Option value (optional)
    pub fn maybe_cover(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.2 = value;
        self
    }
}

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

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::LikeCount: thing_view_basic_state::IsUnset,
{
    /// Set the `likeCount` field (required)
    pub fn like_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetLikeCount<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::ModelCount: thing_view_basic_state::IsUnset,
{
    /// Set the `modelCount` field (required)
    pub fn model_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetModelCount<St>, S> {
        self._fields.5 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::Name: thing_view_basic_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetName<St>, S> {
        self._fields.6 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::PartCount: thing_view_basic_state::IsUnset,
{
    /// Set the `partCount` field (required)
    pub fn part_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetPartCount<St>, S> {
        self._fields.7 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: thing_view_basic_state::State, S: BosStr> ThingViewBasicBuilder<St, S> {
    /// Set the `previews` field (optional)
    pub fn previews(
        mut self,
        value: impl Into<Option<Vec<library::ImageView<S>>>>,
    ) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `previews` field to an Option value (optional)
    pub fn maybe_previews(mut self, value: Option<Vec<library::ImageView<S>>>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::SaveCount: thing_view_basic_state::IsUnset,
{
    /// Set the `saveCount` field (required)
    pub fn save_count(
        mut self,
        value: impl Into<i64>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetSaveCount<St>, S> {
        self._fields.9 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: thing_view_basic_state::State, S: BosStr> ThingViewBasicBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<Vec<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<Vec<S>>) -> Self {
        self._fields.10 = value;
        self
    }
}

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

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::Viewer: thing_view_basic_state::IsUnset,
{
    /// Set the `viewer` field (required)
    pub fn viewer(
        mut self,
        value: impl Into<library::ViewerState<S>>,
    ) -> ThingViewBasicBuilder<thing_view_basic_state::SetViewer<St>, S> {
        self._fields.12 = Option::Some(value.into());
        ThingViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ThingViewBasicBuilder<St, S>
where
    St: thing_view_basic_state::State,
    St::Author: thing_view_basic_state::IsSet,
    St::Cid: thing_view_basic_state::IsSet,
    St::IndexedAt: thing_view_basic_state::IsSet,
    St::LikeCount: thing_view_basic_state::IsSet,
    St::ModelCount: thing_view_basic_state::IsSet,
    St::Name: thing_view_basic_state::IsSet,
    St::PartCount: thing_view_basic_state::IsSet,
    St::SaveCount: thing_view_basic_state::IsSet,
    St::Uri: thing_view_basic_state::IsSet,
    St::Viewer: thing_view_basic_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ThingViewBasic<S> {
        ThingViewBasic {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover: self._fields.2,
            indexed_at: self._fields.3.unwrap(),
            like_count: self._fields.4.unwrap(),
            model_count: self._fields.5.unwrap(),
            name: self._fields.6.unwrap(),
            part_count: self._fields.7.unwrap(),
            previews: self._fields.8,
            save_count: self._fields.9.unwrap(),
            tags: self._fields.10,
            uri: self._fields.11.unwrap(),
            viewer: self._fields.12.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ThingViewBasic<S> {
        ThingViewBasic {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover: self._fields.2,
            indexed_at: self._fields.3.unwrap(),
            like_count: self._fields.4.unwrap(),
            model_count: self._fields.5.unwrap(),
            name: self._fields.6.unwrap(),
            part_count: self._fields.7.unwrap(),
            previews: self._fields.8,
            save_count: self._fields.9.unwrap(),
            tags: self._fields.10,
            uri: self._fields.11.unwrap(),
            viewer: self._fields.12.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}