// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: tools.ozone.communication.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod create_template; pub mod delete_template; pub mod list_templates; pub mod update_template; #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct TemplateView<'a> { /// Subject of the message, used in emails. #[serde(borrow)] pub content_markdown: jacquard_common::CowStr<'a>, pub created_at: jacquard_common::types::string::Datetime, pub disabled: bool, #[serde(borrow)] pub id: jacquard_common::CowStr<'a>, /// Message language. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub lang: std::option::Option, /// DID of the user who last updated the template. #[serde(borrow)] pub last_updated_by: jacquard_common::types::string::Did<'a>, /// Name of the template. #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, /// Content of the template, can contain markdown and variable placeholders. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub subject: std::option::Option>, pub updated_at: jacquard_common::types::string::Datetime, } pub mod template_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type UpdatedAt; type Id; type LastUpdatedBy; type Name; type ContentMarkdown; type Disabled; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type UpdatedAt = Unset; type Id = Unset; type LastUpdatedBy = Unset; type Name = Unset; type ContentMarkdown = Unset; type Disabled = Unset; type CreatedAt = Unset; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt(PhantomData S>); impl sealed::Sealed for SetUpdatedAt {} impl State for SetUpdatedAt { type UpdatedAt = Set; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type Name = S::Name; type ContentMarkdown = S::ContentMarkdown; type Disabled = S::Disabled; type CreatedAt = S::CreatedAt; } ///State transition - sets the `id` field to Set pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { type UpdatedAt = S::UpdatedAt; type Id = Set; type LastUpdatedBy = S::LastUpdatedBy; type Name = S::Name; type ContentMarkdown = S::ContentMarkdown; type Disabled = S::Disabled; type CreatedAt = S::CreatedAt; } ///State transition - sets the `last_updated_by` field to Set pub struct SetLastUpdatedBy(PhantomData S>); impl sealed::Sealed for SetLastUpdatedBy {} impl State for SetLastUpdatedBy { type UpdatedAt = S::UpdatedAt; type Id = S::Id; type LastUpdatedBy = Set; type Name = S::Name; type ContentMarkdown = S::ContentMarkdown; type Disabled = S::Disabled; type CreatedAt = S::CreatedAt; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { type UpdatedAt = S::UpdatedAt; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type Name = Set; type ContentMarkdown = S::ContentMarkdown; type Disabled = S::Disabled; type CreatedAt = S::CreatedAt; } ///State transition - sets the `content_markdown` field to Set pub struct SetContentMarkdown(PhantomData S>); impl sealed::Sealed for SetContentMarkdown {} impl State for SetContentMarkdown { type UpdatedAt = S::UpdatedAt; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type Name = S::Name; type ContentMarkdown = Set; type Disabled = S::Disabled; type CreatedAt = S::CreatedAt; } ///State transition - sets the `disabled` field to Set pub struct SetDisabled(PhantomData S>); impl sealed::Sealed for SetDisabled {} impl State for SetDisabled { type UpdatedAt = S::UpdatedAt; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type Name = S::Name; type ContentMarkdown = S::ContentMarkdown; type Disabled = Set; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type UpdatedAt = S::UpdatedAt; type Id = S::Id; type LastUpdatedBy = S::LastUpdatedBy; type Name = S::Name; type ContentMarkdown = S::ContentMarkdown; type Disabled = S::Disabled; type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `updated_at` field pub struct updated_at(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `last_updated_by` field pub struct last_updated_by(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `content_markdown` field pub struct content_markdown(()); ///Marker type for the `disabled` field pub struct disabled(()); ///Marker type for the `created_at` field pub struct created_at(()); } } /// Builder for constructing an instance of this type pub struct TemplateViewBuilder<'a, S: template_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> TemplateView<'a> { /// Create a new builder for this type pub fn new() -> TemplateViewBuilder<'a, template_view_state::Empty> { TemplateViewBuilder::new() } } impl<'a> TemplateViewBuilder<'a, template_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::ContentMarkdown: template_view_state::IsUnset, { /// Set the `contentMarkdown` field (required) pub fn content_markdown( mut self, value: impl Into>, ) -> TemplateViewBuilder<'a, template_view_state::SetContentMarkdown> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::CreatedAt: template_view_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> TemplateViewBuilder<'a, template_view_state::SetCreatedAt> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::Disabled: template_view_state::IsUnset, { /// Set the `disabled` field (required) pub fn disabled( mut self, value: impl Into, ) -> TemplateViewBuilder<'a, template_view_state::SetDisabled> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::Id: template_view_state::IsUnset, { /// Set the `id` field (required) pub fn id( mut self, value: impl Into>, ) -> TemplateViewBuilder<'a, template_view_state::SetId> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: template_view_state::State> TemplateViewBuilder<'a, S> { /// Set the `lang` field (optional) pub fn lang( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `lang` field to an Option value (optional) pub fn maybe_lang( mut self, value: Option, ) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::LastUpdatedBy: template_view_state::IsUnset, { /// Set the `lastUpdatedBy` field (required) pub fn last_updated_by( mut self, value: impl Into>, ) -> TemplateViewBuilder<'a, template_view_state::SetLastUpdatedBy> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::Name: template_view_state::IsUnset, { /// Set the `name` field (required) pub fn name( mut self, value: impl Into>, ) -> TemplateViewBuilder<'a, template_view_state::SetName> { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: template_view_state::State> TemplateViewBuilder<'a, S> { /// Set the `subject` field (optional) pub fn subject( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.7 = value.into(); self } /// Set the `subject` field to an Option value (optional) pub fn maybe_subject(mut self, value: Option>) -> Self { self.__unsafe_private_named.7 = value; self } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::UpdatedAt: template_view_state::IsUnset, { /// Set the `updatedAt` field (required) pub fn updated_at( mut self, value: impl Into, ) -> TemplateViewBuilder<'a, template_view_state::SetUpdatedAt> { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); TemplateViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, S::UpdatedAt: template_view_state::IsSet, S::Id: template_view_state::IsSet, S::LastUpdatedBy: template_view_state::IsSet, S::Name: template_view_state::IsSet, S::ContentMarkdown: template_view_state::IsSet, S::Disabled: template_view_state::IsSet, S::CreatedAt: template_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TemplateView<'a> { TemplateView { content_markdown: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1.unwrap(), disabled: self.__unsafe_private_named.2.unwrap(), id: self.__unsafe_private_named.3.unwrap(), lang: self.__unsafe_private_named.4, last_updated_by: self.__unsafe_private_named.5.unwrap(), name: self.__unsafe_private_named.6.unwrap(), subject: self.__unsafe_private_named.7, updated_at: self.__unsafe_private_named.8.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>, >, ) -> TemplateView<'a> { TemplateView { content_markdown: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1.unwrap(), disabled: self.__unsafe_private_named.2.unwrap(), id: self.__unsafe_private_named.3.unwrap(), lang: self.__unsafe_private_named.4, last_updated_by: self.__unsafe_private_named.5.unwrap(), name: self.__unsafe_private_named.6.unwrap(), subject: self.__unsafe_private_named.7, updated_at: self.__unsafe_private_named.8.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_tools_ozone_communication_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("tools.ozone.communication.defs"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("templateView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_common::smol_str::SmolStr::new_static("contentMarkdown"), ::jacquard_common::smol_str::SmolStr::new_static("disabled"), ::jacquard_common::smol_str::SmolStr::new_static("lastUpdatedBy"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt"), ::jacquard_common::smol_str::SmolStr::new_static("updatedAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "contentMarkdown", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Subject of the message, used in emails.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("disabled"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("lang"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static("Message language."), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Language, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "lastUpdatedBy", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "DID of the user who last updated the template.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Name of the template.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("subject"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Content of the template, can contain markdown and variable placeholders.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "updatedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TemplateView<'a> { fn nsid() -> &'static str { "tools.ozone.communication.defs" } fn def_name() -> &'static str { "templateView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_tools_ozone_communication_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }