// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: blue.atroom.room.layout
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

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

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, 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::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::blue_atroom::room::layout;
/// RGB color with 8-bit channels.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Color<S: BosStr = DefaultStr> {
    pub blue: i64,
    pub green: i64,
    pub red: 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 Floor<S: BosStr = DefaultStr> {
    pub surface: layout::Surface<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A placed object in the room.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Furnishing<S: BosStr = DefaultStr> {
    ///Strong reference to a blue.atroom.room.object record.
    pub object: StrongRef<S>,
    ///Position [x, y, z] in millimeters.
    pub position: Vec<i64>,
    ///Euler rotation [x, y, z] in degrees.
    pub rotation: Vec<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A room layout with placed objects.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "blue.atroom.room.layout",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Layout<S: BosStr = DefaultStr> {
    pub created_at: Datetime,
    pub floor: layout::Floor<S>,
    pub furnishings: Vec<layout::Furnishing<S>>,
    ///Room size in millimeters (square room).
    pub size: i64,
    pub wall: layout::Wall<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Typed wrapper for GetRecord response with this collection's record type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LayoutGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Layout<S>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Surface<S: BosStr = DefaultStr> {
    pub color: layout::Color<S>,
    ///Texture identifier.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub texture: Option<S>,
    ///Texture tiling [u, v].
    #[serde(skip_serializing_if = "Option::is_none")]
    pub texture_tiling: Option<Vec<i64>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Wall configuration.

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

impl<S: BosStr> Layout<S> {
    pub fn uri(uri: S) -> Result<RecordUri<S, LayoutRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new(uri)?)
    }
}

impl<S: BosStr> LexiconSchema for Color<S> {
    fn nsid() -> &'static str {
        "blue.atroom.room.layout"
    }
    fn def_name() -> &'static str {
        "color"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_blue_atroom_room_layout()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.blue;
            if *value > 255i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("blue"),
                    max: 255i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.blue;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("blue"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.green;
            if *value > 255i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("green"),
                    max: 255i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.green;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("green"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.red;
            if *value > 255i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("red"),
                    max: 255i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.red;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("red"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Floor<S> {
    fn nsid() -> &'static str {
        "blue.atroom.room.layout"
    }
    fn def_name() -> &'static str {
        "floor"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_blue_atroom_room_layout()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Furnishing<S> {
    fn nsid() -> &'static str {
        "blue.atroom.room.layout"
    }
    fn def_name() -> &'static str {
        "furnishing"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_blue_atroom_room_layout()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.position;
            #[allow(unused_comparisons)]
            if value.len() > 3usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("position"),
                    max: 3usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.position;
            #[allow(unused_comparisons)]
            if value.len() < 3usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("position"),
                    min: 3usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.rotation;
            #[allow(unused_comparisons)]
            if value.len() > 3usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("rotation"),
                    max: 3usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.rotation;
            #[allow(unused_comparisons)]
            if value.len() < 3usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("rotation"),
                    min: 3usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

/// Marker type for deserializing records from this collection.

#[derive(Debug, Serialize, Deserialize)]
pub struct LayoutRecord;
impl XrpcResp for LayoutRecord {
    const NSID: &'static str = "blue.atroom.room.layout";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = LayoutGetRecordOutput<S>;
    type Err = RecordError;
}

impl<S: BosStr> From<LayoutGetRecordOutput<S>> for Layout<S> {
    fn from(output: LayoutGetRecordOutput<S>) -> Self {
        output.value
    }
}

impl<S: BosStr> Collection for Layout<S> {
    const NSID: &'static str = "blue.atroom.room.layout";
    type Record = LayoutRecord;
}

impl Collection for LayoutRecord {
    const NSID: &'static str = "blue.atroom.room.layout";
    type Record = LayoutRecord;
}

impl<S: BosStr> LexiconSchema for Layout<S> {
    fn nsid() -> &'static str {
        "blue.atroom.room.layout"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_blue_atroom_room_layout()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.furnishings;
            #[allow(unused_comparisons)]
            if value.len() > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("furnishings"),
                    max: 100usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.size;
            if *value > 20000i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("size"),
                    max: 20000i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.size;
            if *value < 1000i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("size"),
                    min: 1000i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Surface<S> {
    fn nsid() -> &'static str {
        "blue.atroom.room.layout"
    }
    fn def_name() -> &'static str {
        "surface"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_blue_atroom_room_layout()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.texture_tiling {
            #[allow(unused_comparisons)]
            if value.len() > 2usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("texture_tiling"),
                    max: 2usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.texture_tiling {
            #[allow(unused_comparisons)]
            if value.len() < 2usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("texture_tiling"),
                    min: 2usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Wall<S> {
    fn nsid() -> &'static str {
        "blue.atroom.room.layout"
    }
    fn def_name() -> &'static str {
        "wall"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_blue_atroom_room_layout()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod color_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 Blue;
        type Green;
        type Red;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Blue = Unset;
        type Green = Unset;
        type Red = Unset;
    }
    ///State transition - sets the `blue` field to Set
    pub struct SetBlue<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBlue<St> {}
    impl<St: State> State for SetBlue<St> {
        type Blue = Set<members::blue>;
        type Green = St::Green;
        type Red = St::Red;
    }
    ///State transition - sets the `green` field to Set
    pub struct SetGreen<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetGreen<St> {}
    impl<St: State> State for SetGreen<St> {
        type Blue = St::Blue;
        type Green = Set<members::green>;
        type Red = St::Red;
    }
    ///State transition - sets the `red` field to Set
    pub struct SetRed<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRed<St> {}
    impl<St: State> State for SetRed<St> {
        type Blue = St::Blue;
        type Green = St::Green;
        type Red = Set<members::red>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `blue` field
        pub struct blue(());
        ///Marker type for the `green` field
        pub struct green(());
        ///Marker type for the `red` field
        pub struct red(());
    }
}

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

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

impl<S: BosStr> Color<S> {
    /// Create a new builder for this type
    pub fn builder() -> ColorBuilder<color_state::Empty, S> {
        ColorBuilder::builder()
    }
}

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

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

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

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

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

impl<St, S: BosStr> ColorBuilder<St, S>
where
    St: color_state::State,
    St::Blue: color_state::IsSet,
    St::Green: color_state::IsSet,
    St::Red: color_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Color<S> {
        Color {
            blue: self._fields.0.unwrap(),
            green: self._fields.1.unwrap(),
            red: 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>>) -> Color<S> {
        Color {
            blue: self._fields.0.unwrap(),
            green: self._fields.1.unwrap(),
            red: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_blue_atroom_room_layout() -> 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("blue.atroom.room.layout"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("color"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("RGB color with 8-bit channels."),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("red"), SmolStr::new_static("green"),
                            SmolStr::new_static("blue")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blue"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(255i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("green"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(255i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("red"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(255i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("floor"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("surface")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("surface"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#surface"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("furnishing"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A placed object in the room."),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("object"),
                            SmolStr::new_static("position"),
                            SmolStr::new_static("rotation")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("object"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("position"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Position [x, y, z] in millimeters."),
                                ),
                                items: LexArrayItem::Integer(LexInteger {
                                    ..Default::default()
                                }),
                                min_length: Some(3usize),
                                max_length: Some(3usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rotation"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Euler rotation [x, y, z] in degrees."),
                                ),
                                items: LexArrayItem::Integer(LexInteger {
                                    ..Default::default()
                                }),
                                min_length: Some(3usize),
                                max_length: Some(3usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static("A room layout with placed objects."),
                    ),
                    key: Some(CowStr::new_static("any")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("size"), SmolStr::new_static("floor"),
                                SmolStr::new_static("wall"),
                                SmolStr::new_static("furnishings"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("floor"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#floor"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("furnishings"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static("#furnishing"),
                                        ..Default::default()
                                    }),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("size"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1000i64),
                                    maximum: Some(20000i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("wall"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#wall"),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("surface"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("color")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("color"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#color"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("texture"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Texture identifier."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("textureTiling"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Texture tiling [u, v]."),
                                ),
                                items: LexArrayItem::Integer(LexInteger {
                                    ..Default::default()
                                }),
                                min_length: Some(2usize),
                                max_length: Some(2usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("wall"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Wall configuration.")),
                    required: Some(
                        vec![
                            SmolStr::new_static("height"),
                            SmolStr::new_static("thickness"),
                            SmolStr::new_static("surface")
                        ],
                    ),
                    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("surface"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#surface"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("thickness"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

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

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

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

impl<S: BosStr> Floor<S> {
    /// Create a new builder for this type
    pub fn builder() -> FloorBuilder<floor_state::Empty, S> {
        FloorBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> FloorBuilder<St, S>
where
    St: floor_state::State,
    St::Surface: floor_state::IsUnset,
{
    /// Set the `surface` field (required)
    pub fn surface(
        mut self,
        value: impl Into<layout::Surface<S>>,
    ) -> FloorBuilder<floor_state::SetSurface<St>, S> {
        self._fields.0 = Option::Some(value.into());
        FloorBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FloorBuilder<St, S>
where
    St: floor_state::State,
    St::Surface: floor_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Floor<S> {
        Floor {
            surface: 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>>) -> Floor<S> {
        Floor {
            surface: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod furnishing_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 Object;
        type Position;
        type Rotation;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Object = Unset;
        type Position = Unset;
        type Rotation = Unset;
    }
    ///State transition - sets the `object` field to Set
    pub struct SetObject<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetObject<St> {}
    impl<St: State> State for SetObject<St> {
        type Object = Set<members::object>;
        type Position = St::Position;
        type Rotation = St::Rotation;
    }
    ///State transition - sets the `position` field to Set
    pub struct SetPosition<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPosition<St> {}
    impl<St: State> State for SetPosition<St> {
        type Object = St::Object;
        type Position = Set<members::position>;
        type Rotation = St::Rotation;
    }
    ///State transition - sets the `rotation` field to Set
    pub struct SetRotation<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRotation<St> {}
    impl<St: State> State for SetRotation<St> {
        type Object = St::Object;
        type Position = St::Position;
        type Rotation = Set<members::rotation>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `object` field
        pub struct object(());
        ///Marker type for the `position` field
        pub struct position(());
        ///Marker type for the `rotation` field
        pub struct rotation(());
    }
}

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

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

impl<S: BosStr> Furnishing<S> {
    /// Create a new builder for this type
    pub fn builder() -> FurnishingBuilder<furnishing_state::Empty, S> {
        FurnishingBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> FurnishingBuilder<St, S>
where
    St: furnishing_state::State,
    St::Object: furnishing_state::IsUnset,
{
    /// Set the `object` field (required)
    pub fn object(
        mut self,
        value: impl Into<StrongRef<S>>,
    ) -> FurnishingBuilder<furnishing_state::SetObject<St>, S> {
        self._fields.0 = Option::Some(value.into());
        FurnishingBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FurnishingBuilder<St, S>
where
    St: furnishing_state::State,
    St::Position: furnishing_state::IsUnset,
{
    /// Set the `position` field (required)
    pub fn position(
        mut self,
        value: impl Into<Vec<i64>>,
    ) -> FurnishingBuilder<furnishing_state::SetPosition<St>, S> {
        self._fields.1 = Option::Some(value.into());
        FurnishingBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FurnishingBuilder<St, S>
where
    St: furnishing_state::State,
    St::Rotation: furnishing_state::IsUnset,
{
    /// Set the `rotation` field (required)
    pub fn rotation(
        mut self,
        value: impl Into<Vec<i64>>,
    ) -> FurnishingBuilder<furnishing_state::SetRotation<St>, S> {
        self._fields.2 = Option::Some(value.into());
        FurnishingBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> FurnishingBuilder<St, S>
where
    St: furnishing_state::State,
    St::Object: furnishing_state::IsSet,
    St::Position: furnishing_state::IsSet,
    St::Rotation: furnishing_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Furnishing<S> {
        Furnishing {
            object: self._fields.0.unwrap(),
            position: self._fields.1.unwrap(),
            rotation: 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>>,
    ) -> Furnishing<S> {
        Furnishing {
            object: self._fields.0.unwrap(),
            position: self._fields.1.unwrap(),
            rotation: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod layout_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 CreatedAt;
        type Floor;
        type Furnishings;
        type Size;
        type Wall;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type Floor = Unset;
        type Furnishings = Unset;
        type Size = Unset;
        type Wall = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
        type Floor = St::Floor;
        type Furnishings = St::Furnishings;
        type Size = St::Size;
        type Wall = St::Wall;
    }
    ///State transition - sets the `floor` field to Set
    pub struct SetFloor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetFloor<St> {}
    impl<St: State> State for SetFloor<St> {
        type CreatedAt = St::CreatedAt;
        type Floor = Set<members::floor>;
        type Furnishings = St::Furnishings;
        type Size = St::Size;
        type Wall = St::Wall;
    }
    ///State transition - sets the `furnishings` field to Set
    pub struct SetFurnishings<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetFurnishings<St> {}
    impl<St: State> State for SetFurnishings<St> {
        type CreatedAt = St::CreatedAt;
        type Floor = St::Floor;
        type Furnishings = Set<members::furnishings>;
        type Size = St::Size;
        type Wall = St::Wall;
    }
    ///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 CreatedAt = St::CreatedAt;
        type Floor = St::Floor;
        type Furnishings = St::Furnishings;
        type Size = Set<members::size>;
        type Wall = St::Wall;
    }
    ///State transition - sets the `wall` field to Set
    pub struct SetWall<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetWall<St> {}
    impl<St: State> State for SetWall<St> {
        type CreatedAt = St::CreatedAt;
        type Floor = St::Floor;
        type Furnishings = St::Furnishings;
        type Size = St::Size;
        type Wall = Set<members::wall>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `floor` field
        pub struct floor(());
        ///Marker type for the `furnishings` field
        pub struct furnishings(());
        ///Marker type for the `size` field
        pub struct size(());
        ///Marker type for the `wall` field
        pub struct wall(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LayoutBuilder<St: layout_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<layout::Floor<S>>,
        Option<Vec<layout::Furnishing<S>>>,
        Option<i64>,
        Option<layout::Wall<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Layout<S> {
    /// Create a new builder for this type
    pub fn builder() -> LayoutBuilder<layout_state::Empty, S> {
        LayoutBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LayoutBuilder<St, S>
where
    St: layout_state::State,
    St::CreatedAt: layout_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> LayoutBuilder<layout_state::SetCreatedAt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LayoutBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LayoutBuilder<St, S>
where
    St: layout_state::State,
    St::Floor: layout_state::IsUnset,
{
    /// Set the `floor` field (required)
    pub fn floor(
        mut self,
        value: impl Into<layout::Floor<S>>,
    ) -> LayoutBuilder<layout_state::SetFloor<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LayoutBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LayoutBuilder<St, S>
where
    St: layout_state::State,
    St::Furnishings: layout_state::IsUnset,
{
    /// Set the `furnishings` field (required)
    pub fn furnishings(
        mut self,
        value: impl Into<Vec<layout::Furnishing<S>>>,
    ) -> LayoutBuilder<layout_state::SetFurnishings<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LayoutBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> LayoutBuilder<St, S>
where
    St: layout_state::State,
    St::Wall: layout_state::IsUnset,
{
    /// Set the `wall` field (required)
    pub fn wall(
        mut self,
        value: impl Into<layout::Wall<S>>,
    ) -> LayoutBuilder<layout_state::SetWall<St>, S> {
        self._fields.4 = Option::Some(value.into());
        LayoutBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LayoutBuilder<St, S>
where
    St: layout_state::State,
    St::CreatedAt: layout_state::IsSet,
    St::Floor: layout_state::IsSet,
    St::Furnishings: layout_state::IsSet,
    St::Size: layout_state::IsSet,
    St::Wall: layout_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Layout<S> {
        Layout {
            created_at: self._fields.0.unwrap(),
            floor: self._fields.1.unwrap(),
            furnishings: self._fields.2.unwrap(),
            size: self._fields.3.unwrap(),
            wall: self._fields.4.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>>) -> Layout<S> {
        Layout {
            created_at: self._fields.0.unwrap(),
            floor: self._fields.1.unwrap(),
            furnishings: self._fields.2.unwrap(),
            size: self._fields.3.unwrap(),
            wall: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> Surface<S> {
    /// Create a new builder for this type
    pub fn builder() -> SurfaceBuilder<surface_state::Empty, S> {
        SurfaceBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SurfaceBuilder<St, S>
where
    St: surface_state::State,
    St::Color: surface_state::IsUnset,
{
    /// Set the `color` field (required)
    pub fn color(
        mut self,
        value: impl Into<layout::Color<S>>,
    ) -> SurfaceBuilder<surface_state::SetColor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        SurfaceBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: surface_state::State, S: BosStr> SurfaceBuilder<St, S> {
    /// Set the `textureTiling` field (optional)
    pub fn texture_tiling(mut self, value: impl Into<Option<Vec<i64>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `textureTiling` field to an Option value (optional)
    pub fn maybe_texture_tiling(mut self, value: Option<Vec<i64>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> SurfaceBuilder<St, S>
where
    St: surface_state::State,
    St::Color: surface_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Surface<S> {
        Surface {
            color: self._fields.0.unwrap(),
            texture: self._fields.1,
            texture_tiling: self._fields.2,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Surface<S> {
        Surface {
            color: self._fields.0.unwrap(),
            texture: self._fields.1,
            texture_tiling: self._fields.2,
            extra_data: Some(extra_data),
        }
    }
}

pub mod wall_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 Surface;
        type Thickness;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Height = Unset;
        type Surface = Unset;
        type Thickness = 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 Surface = St::Surface;
        type Thickness = St::Thickness;
    }
    ///State transition - sets the `surface` field to Set
    pub struct SetSurface<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSurface<St> {}
    impl<St: State> State for SetSurface<St> {
        type Height = St::Height;
        type Surface = Set<members::surface>;
        type Thickness = St::Thickness;
    }
    ///State transition - sets the `thickness` field to Set
    pub struct SetThickness<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetThickness<St> {}
    impl<St: State> State for SetThickness<St> {
        type Height = St::Height;
        type Surface = St::Surface;
        type Thickness = Set<members::thickness>;
    }
    /// 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 `surface` field
        pub struct surface(());
        ///Marker type for the `thickness` field
        pub struct thickness(());
    }
}

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

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

impl<S: BosStr> Wall<S> {
    /// Create a new builder for this type
    pub fn builder() -> WallBuilder<wall_state::Empty, S> {
        WallBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> WallBuilder<St, S>
where
    St: wall_state::State,
    St::Surface: wall_state::IsUnset,
{
    /// Set the `surface` field (required)
    pub fn surface(
        mut self,
        value: impl Into<layout::Surface<S>>,
    ) -> WallBuilder<wall_state::SetSurface<St>, S> {
        self._fields.1 = Option::Some(value.into());
        WallBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> WallBuilder<St, S>
where
    St: wall_state::State,
    St::Height: wall_state::IsSet,
    St::Surface: wall_state::IsSet,
    St::Thickness: wall_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Wall<S> {
        Wall {
            height: self._fields.0.unwrap(),
            surface: self._fields.1.unwrap(),
            thickness: 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>>) -> Wall<S> {
        Wall {
            height: self._fields.0.unwrap(),
            surface: self._fields.1.unwrap(),
            thickness: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}