// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: games.gamesgamesgamesgames.game
//
// 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::games_gamesgamesgamesgames::AgeRating;
use crate::games_gamesgamesgamesgames::AlternativeName;
use crate::games_gamesgamesgamesgames::ApplicationType;
use crate::games_gamesgamesgamesgames::ExternalIds;
use crate::games_gamesgamesgamesgames::ExternalVideo;
use crate::games_gamesgamesgamesgames::Genre;
use crate::games_gamesgamesgamesgames::LanguageSupport;
use crate::games_gamesgamesgamesgames::MediaItem;
use crate::games_gamesgamesgamesgames::Mode;
use crate::games_gamesgamesgamesgames::MultiplayerMode;
use crate::games_gamesgamesgamesgames::PlatformFeatures;
use crate::games_gamesgamesgamesgames::PlayerPerspective;
use crate::games_gamesgamesgamesgames::Release;
use crate::games_gamesgamesgamesgames::SystemRequirements;
use crate::games_gamesgamesgamesgames::Theme;
use crate::games_gamesgamesgamesgames::TimeToBeat;
use crate::games_gamesgamesgamesgames::Website;
use crate::games_gamesgamesgamesgames::richtext::facet::Facet;
/// A video game.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "games.gamesgamesgamesgames.game",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Game<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub age_ratings: Option<Vec<AgeRating<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alternative_names: Option<Vec<AlternativeName<S>>>,
    pub application_type: ApplicationType<S>,
    pub created_at: Datetime,
    ///Detailed game description in plain text, with formatting expressed via descriptionFacets.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    ///Rich text facets for the description field.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description_facets: Option<Vec<Facet<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub engines: Option<Vec<AtUri<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub external_ids: Option<ExternalIds<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub genres: Option<Vec<Genre<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub keywords: Option<Vec<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub language_supports: Option<Vec<LanguageSupport<S>>>,
    ///Images associated with the game.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub media: Option<Vec<MediaItem<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub modes: Option<Vec<Mode<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub multiplayer_modes: Option<Vec<MultiplayerMode<S>>>,
    pub name: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub parent: Option<AtUri<S>>,
    ///Platform-specific feature support.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub platform_features: Option<Vec<PlatformFeatures<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub player_perspectives: Option<Vec<PlayerPerspective<S>>>,
    ///When this record was marked ready for public viewing.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub published_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub releases: Option<Vec<Release<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub storyline: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub summary: Option<S>,
    ///System requirements per platform.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub system_requirements: Option<Vec<SystemRequirements<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub themes: Option<Vec<Theme<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub time_to_beat: Option<TimeToBeat<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub videos: Option<Vec<ExternalVideo<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub websites: Option<Vec<Website<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 GameGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Game<S>,
}

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

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

#[derive(Debug, Serialize, Deserialize)]
pub struct GameRecord;
impl XrpcResp for GameRecord {
    const NSID: &'static str = "games.gamesgamesgamesgames.game";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = GameGetRecordOutput<S>;
    type Err = RecordError;
}

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

impl<S: BosStr> Collection for Game<S> {
    const NSID: &'static str = "games.gamesgamesgamesgames.game";
    type Record = GameRecord;
}

impl Collection for GameRecord {
    const NSID: &'static str = "games.gamesgamesgamesgames.game";
    type Record = GameRecord;
}

impl<S: BosStr> LexiconSchema for Game<S> {
    fn nsid() -> &'static str {
        "games.gamesgamesgamesgames.game"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_games_gamesgamesgamesgames_game()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

/// Builder for constructing an instance of this type.
pub struct GameBuilder<St: game_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<AgeRating<S>>>,
        Option<Vec<AlternativeName<S>>>,
        Option<ApplicationType<S>>,
        Option<Datetime>,
        Option<S>,
        Option<Vec<Facet<S>>>,
        Option<Vec<AtUri<S>>>,
        Option<ExternalIds<S>>,
        Option<Vec<Genre<S>>>,
        Option<Vec<S>>,
        Option<Vec<LanguageSupport<S>>>,
        Option<Vec<MediaItem<S>>>,
        Option<Vec<Mode<S>>>,
        Option<Vec<MultiplayerMode<S>>>,
        Option<S>,
        Option<AtUri<S>>,
        Option<Vec<PlatformFeatures<S>>>,
        Option<Vec<PlayerPerspective<S>>>,
        Option<Datetime>,
        Option<Vec<Release<S>>>,
        Option<S>,
        Option<S>,
        Option<Vec<SystemRequirements<S>>>,
        Option<Vec<Theme<S>>>,
        Option<TimeToBeat<S>>,
        Option<Vec<ExternalVideo<S>>>,
        Option<Vec<Website<S>>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Game<S> {
    /// Create a new builder for this type
    pub fn builder() -> GameBuilder<game_state::Empty, S> {
        GameBuilder::builder()
    }
}

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

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

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `ageRatings` field (optional)
    pub fn age_ratings(mut self, value: impl Into<Option<Vec<AgeRating<S>>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `ageRatings` field to an Option value (optional)
    pub fn maybe_age_ratings(mut self, value: Option<Vec<AgeRating<S>>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `alternativeNames` field (optional)
    pub fn alternative_names(
        mut self,
        value: impl Into<Option<Vec<AlternativeName<S>>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `alternativeNames` field to an Option value (optional)
    pub fn maybe_alternative_names(
        mut self,
        value: Option<Vec<AlternativeName<S>>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> GameBuilder<St, S>
where
    St: game_state::State,
    St::ApplicationType: game_state::IsUnset,
{
    /// Set the `applicationType` field (required)
    pub fn application_type(
        mut self,
        value: impl Into<ApplicationType<S>>,
    ) -> GameBuilder<game_state::SetApplicationType<St>, S> {
        self._fields.2 = Option::Some(value.into());
        GameBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

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

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `descriptionFacets` field (optional)
    pub fn description_facets(
        mut self,
        value: impl Into<Option<Vec<Facet<S>>>>,
    ) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `descriptionFacets` field to an Option value (optional)
    pub fn maybe_description_facets(mut self, value: Option<Vec<Facet<S>>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `engines` field (optional)
    pub fn engines(mut self, value: impl Into<Option<Vec<AtUri<S>>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `engines` field to an Option value (optional)
    pub fn maybe_engines(mut self, value: Option<Vec<AtUri<S>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `externalIds` field (optional)
    pub fn external_ids(mut self, value: impl Into<Option<ExternalIds<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `externalIds` field to an Option value (optional)
    pub fn maybe_external_ids(mut self, value: Option<ExternalIds<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `genres` field (optional)
    pub fn genres(mut self, value: impl Into<Option<Vec<Genre<S>>>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `genres` field to an Option value (optional)
    pub fn maybe_genres(mut self, value: Option<Vec<Genre<S>>>) -> Self {
        self._fields.8 = value;
        self
    }
}

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

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `languageSupports` field (optional)
    pub fn language_supports(
        mut self,
        value: impl Into<Option<Vec<LanguageSupport<S>>>>,
    ) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `languageSupports` field to an Option value (optional)
    pub fn maybe_language_supports(
        mut self,
        value: Option<Vec<LanguageSupport<S>>>,
    ) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `media` field (optional)
    pub fn media(mut self, value: impl Into<Option<Vec<MediaItem<S>>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `media` field to an Option value (optional)
    pub fn maybe_media(mut self, value: Option<Vec<MediaItem<S>>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `modes` field (optional)
    pub fn modes(mut self, value: impl Into<Option<Vec<Mode<S>>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `modes` field to an Option value (optional)
    pub fn maybe_modes(mut self, value: Option<Vec<Mode<S>>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `multiplayerModes` field (optional)
    pub fn multiplayer_modes(
        mut self,
        value: impl Into<Option<Vec<MultiplayerMode<S>>>>,
    ) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `multiplayerModes` field to an Option value (optional)
    pub fn maybe_multiplayer_modes(
        mut self,
        value: Option<Vec<MultiplayerMode<S>>>,
    ) -> Self {
        self._fields.13 = value;
        self
    }
}

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

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `parent` field (optional)
    pub fn parent(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `parent` field to an Option value (optional)
    pub fn maybe_parent(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `platformFeatures` field (optional)
    pub fn platform_features(
        mut self,
        value: impl Into<Option<Vec<PlatformFeatures<S>>>>,
    ) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `platformFeatures` field to an Option value (optional)
    pub fn maybe_platform_features(
        mut self,
        value: Option<Vec<PlatformFeatures<S>>>,
    ) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `playerPerspectives` field (optional)
    pub fn player_perspectives(
        mut self,
        value: impl Into<Option<Vec<PlayerPerspective<S>>>>,
    ) -> Self {
        self._fields.17 = value.into();
        self
    }
    /// Set the `playerPerspectives` field to an Option value (optional)
    pub fn maybe_player_perspectives(
        mut self,
        value: Option<Vec<PlayerPerspective<S>>>,
    ) -> Self {
        self._fields.17 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `publishedAt` field (optional)
    pub fn published_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.18 = value.into();
        self
    }
    /// Set the `publishedAt` field to an Option value (optional)
    pub fn maybe_published_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.18 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `releases` field (optional)
    pub fn releases(mut self, value: impl Into<Option<Vec<Release<S>>>>) -> Self {
        self._fields.19 = value.into();
        self
    }
    /// Set the `releases` field to an Option value (optional)
    pub fn maybe_releases(mut self, value: Option<Vec<Release<S>>>) -> Self {
        self._fields.19 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `storyline` field (optional)
    pub fn storyline(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.20 = value.into();
        self
    }
    /// Set the `storyline` field to an Option value (optional)
    pub fn maybe_storyline(mut self, value: Option<S>) -> Self {
        self._fields.20 = value;
        self
    }
}

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

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `systemRequirements` field (optional)
    pub fn system_requirements(
        mut self,
        value: impl Into<Option<Vec<SystemRequirements<S>>>>,
    ) -> Self {
        self._fields.22 = value.into();
        self
    }
    /// Set the `systemRequirements` field to an Option value (optional)
    pub fn maybe_system_requirements(
        mut self,
        value: Option<Vec<SystemRequirements<S>>>,
    ) -> Self {
        self._fields.22 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `themes` field (optional)
    pub fn themes(mut self, value: impl Into<Option<Vec<Theme<S>>>>) -> Self {
        self._fields.23 = value.into();
        self
    }
    /// Set the `themes` field to an Option value (optional)
    pub fn maybe_themes(mut self, value: Option<Vec<Theme<S>>>) -> Self {
        self._fields.23 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `timeToBeat` field (optional)
    pub fn time_to_beat(mut self, value: impl Into<Option<TimeToBeat<S>>>) -> Self {
        self._fields.24 = value.into();
        self
    }
    /// Set the `timeToBeat` field to an Option value (optional)
    pub fn maybe_time_to_beat(mut self, value: Option<TimeToBeat<S>>) -> Self {
        self._fields.24 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `videos` field (optional)
    pub fn videos(mut self, value: impl Into<Option<Vec<ExternalVideo<S>>>>) -> Self {
        self._fields.25 = value.into();
        self
    }
    /// Set the `videos` field to an Option value (optional)
    pub fn maybe_videos(mut self, value: Option<Vec<ExternalVideo<S>>>) -> Self {
        self._fields.25 = value;
        self
    }
}

impl<St: game_state::State, S: BosStr> GameBuilder<St, S> {
    /// Set the `websites` field (optional)
    pub fn websites(mut self, value: impl Into<Option<Vec<Website<S>>>>) -> Self {
        self._fields.26 = value.into();
        self
    }
    /// Set the `websites` field to an Option value (optional)
    pub fn maybe_websites(mut self, value: Option<Vec<Website<S>>>) -> Self {
        self._fields.26 = value;
        self
    }
}

impl<St, S: BosStr> GameBuilder<St, S>
where
    St: game_state::State,
    St::ApplicationType: game_state::IsSet,
    St::CreatedAt: game_state::IsSet,
    St::Name: game_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Game<S> {
        Game {
            age_ratings: self._fields.0,
            alternative_names: self._fields.1,
            application_type: self._fields.2.unwrap(),
            created_at: self._fields.3.unwrap(),
            description: self._fields.4,
            description_facets: self._fields.5,
            engines: self._fields.6,
            external_ids: self._fields.7,
            genres: self._fields.8,
            keywords: self._fields.9,
            language_supports: self._fields.10,
            media: self._fields.11,
            modes: self._fields.12,
            multiplayer_modes: self._fields.13,
            name: self._fields.14.unwrap(),
            parent: self._fields.15,
            platform_features: self._fields.16,
            player_perspectives: self._fields.17,
            published_at: self._fields.18,
            releases: self._fields.19,
            storyline: self._fields.20,
            summary: self._fields.21,
            system_requirements: self._fields.22,
            themes: self._fields.23,
            time_to_beat: self._fields.24,
            videos: self._fields.25,
            websites: self._fields.26,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Game<S> {
        Game {
            age_ratings: self._fields.0,
            alternative_names: self._fields.1,
            application_type: self._fields.2.unwrap(),
            created_at: self._fields.3.unwrap(),
            description: self._fields.4,
            description_facets: self._fields.5,
            engines: self._fields.6,
            external_ids: self._fields.7,
            genres: self._fields.8,
            keywords: self._fields.9,
            language_supports: self._fields.10,
            media: self._fields.11,
            modes: self._fields.12,
            multiplayer_modes: self._fields.13,
            name: self._fields.14.unwrap(),
            parent: self._fields.15,
            platform_features: self._fields.16,
            player_perspectives: self._fields.17,
            published_at: self._fields.18,
            releases: self._fields.19,
            storyline: self._fields.20,
            summary: self._fields.21,
            system_requirements: self._fields.22,
            themes: self._fields.23,
            time_to_beat: self._fields.24,
            videos: self._fields.25,
            websites: self._fields.26,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_games_gamesgamesgamesgames_game() -> 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("games.gamesgamesgamesgames.game"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(CowStr::new_static("A video game.")),
                    key: Some(CowStr::new_static("any")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("name"),
                                SmolStr::new_static("createdAt"),
                                SmolStr::new_static("applicationType")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("ageRatings"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#ageRating",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("alternativeNames"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#alternativeName",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("applicationType"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "games.gamesgamesgamesgames.defs#applicationType",
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("description"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Detailed game description in plain text, with formatting expressed via descriptionFacets.",
                                        ),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("descriptionFacets"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static(
                                            "Rich text facets for the description field.",
                                        ),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.richtext.facet",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("engines"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::String(LexString {
                                        format: Some(LexStringFormat::AtUri),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("externalIds"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "games.gamesgamesgamesgames.defs#externalIds",
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("genres"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#genre",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("keywords"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::String(LexString {
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("languageSupports"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#languageSupport",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("media"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("Images associated with the game."),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#mediaItem",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("modes"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#mode",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("multiplayerModes"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#multiplayerMode",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("name"),
                                LexObjectProperty::String(LexString {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("parent"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::AtUri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("platformFeatures"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("Platform-specific feature support."),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#platformFeatures",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("playerPerspectives"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#playerPerspective",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("publishedAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "When this record was marked ready for public viewing.",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("releases"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#release",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("storyline"),
                                LexObjectProperty::String(LexString {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("summary"),
                                LexObjectProperty::String(LexString {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("systemRequirements"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("System requirements per platform."),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#systemRequirements",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("themes"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#theme",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("timeToBeat"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "games.gamesgamesgamesgames.defs#timeToBeat",
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("videos"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#externalVideo",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("websites"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "games.gamesgamesgamesgames.defs#website",
                                        ),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}