// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: site.standard.theme.basic // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Basic<'a> { /// Color used for links and button backgrounds. #[serde(borrow)] pub accent: crate::site_standard::theme::color::Rgb<'a>, /// Color used for button text. #[serde(borrow)] pub accent_foreground: crate::site_standard::theme::color::Rgb<'a>, /// Color used for content background. #[serde(borrow)] pub background: crate::site_standard::theme::color::Rgb<'a>, /// Color used for content text. #[serde(borrow)] pub foreground: crate::site_standard::theme::color::Rgb<'a>, } pub mod basic_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Accent; type Background; type Foreground; type AccentForeground; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Accent = Unset; type Background = Unset; type Foreground = Unset; type AccentForeground = Unset; } ///State transition - sets the `accent` field to Set pub struct SetAccent(PhantomData S>); impl sealed::Sealed for SetAccent {} impl State for SetAccent { type Accent = Set; type Background = S::Background; type Foreground = S::Foreground; type AccentForeground = S::AccentForeground; } ///State transition - sets the `background` field to Set pub struct SetBackground(PhantomData S>); impl sealed::Sealed for SetBackground {} impl State for SetBackground { type Accent = S::Accent; type Background = Set; type Foreground = S::Foreground; type AccentForeground = S::AccentForeground; } ///State transition - sets the `foreground` field to Set pub struct SetForeground(PhantomData S>); impl sealed::Sealed for SetForeground {} impl State for SetForeground { type Accent = S::Accent; type Background = S::Background; type Foreground = Set; type AccentForeground = S::AccentForeground; } ///State transition - sets the `accent_foreground` field to Set pub struct SetAccentForeground(PhantomData S>); impl sealed::Sealed for SetAccentForeground {} impl State for SetAccentForeground { type Accent = S::Accent; type Background = S::Background; type Foreground = S::Foreground; type AccentForeground = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `accent` field pub struct accent(()); ///Marker type for the `background` field pub struct background(()); ///Marker type for the `foreground` field pub struct foreground(()); ///Marker type for the `accent_foreground` field pub struct accent_foreground(()); } } /// Builder for constructing an instance of this type pub struct BasicBuilder<'a, S: basic_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Basic<'a> { /// Create a new builder for this type pub fn new() -> BasicBuilder<'a, basic_state::Empty> { BasicBuilder::new() } } impl<'a> BasicBuilder<'a, basic_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { BasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, S::Accent: basic_state::IsUnset, { /// Set the `accent` field (required) pub fn accent( mut self, value: impl Into>, ) -> BasicBuilder<'a, basic_state::SetAccent> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); BasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, S::AccentForeground: basic_state::IsUnset, { /// Set the `accentForeground` field (required) pub fn accent_foreground( mut self, value: impl Into>, ) -> BasicBuilder<'a, basic_state::SetAccentForeground> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); BasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, S::Background: basic_state::IsUnset, { /// Set the `background` field (required) pub fn background( mut self, value: impl Into>, ) -> BasicBuilder<'a, basic_state::SetBackground> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); BasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, S::Foreground: basic_state::IsUnset, { /// Set the `foreground` field (required) pub fn foreground( mut self, value: impl Into>, ) -> BasicBuilder<'a, basic_state::SetForeground> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); BasicBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, S::Accent: basic_state::IsSet, S::Background: basic_state::IsSet, S::Foreground: basic_state::IsSet, S::AccentForeground: basic_state::IsSet, { /// Build the final struct pub fn build(self) -> Basic<'a> { Basic { accent: self.__unsafe_private_named.0.unwrap(), accent_foreground: self.__unsafe_private_named.1.unwrap(), background: self.__unsafe_private_named.2.unwrap(), foreground: self.__unsafe_private_named.3.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Basic<'a> { Basic { accent: self.__unsafe_private_named.0.unwrap(), accent_foreground: self.__unsafe_private_named.1.unwrap(), background: self.__unsafe_private_named.2.unwrap(), foreground: self.__unsafe_private_named.3.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("site.standard.theme.basic"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("background"), ::jacquard_common::smol_str::SmolStr::new_static("foreground"), ::jacquard_common::smol_str::SmolStr::new_static("accent"), ::jacquard_common::smol_str::SmolStr::new_static("accentForeground") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accent"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: Some( ::jacquard_common::CowStr::new_static( "Color used for links and button backgrounds.", ), ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "accentForeground", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: Some( ::jacquard_common::CowStr::new_static( "Color used for button text.", ), ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "background", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: Some( ::jacquard_common::CowStr::new_static( "Color used for content background.", ), ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "foreground", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: Some( ::jacquard_common::CowStr::new_static( "Color used for content text.", ), ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], closed: None, }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Basic<'a> { fn nsid() -> &'static str { "site.standard.theme.basic" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_site_standard_theme_basic() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }