#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct CreateTemplateRequest {
    #[builder(into)]
    #[serde(rename = "title")]
    title: String,
    #[builder(into)]
    #[serde(rename = "description")]
    description: String,
    #[builder(default, set(item(type = String, into)))]
    #[serde(
        rename = "labels",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    labels: std::collections::BTreeSet<String>,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "properties",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    properties: std::collections::BTreeMap<String, String>,
    #[builder(default, into)]
    #[serde(rename = "isPublished", skip_serializing_if = "Option::is_none", default)]
    is_published: Option<bool>,
    #[builder(default, into)]
    #[serde(rename = "charts", skip_serializing_if = "Option::is_none", default)]
    charts: Option<Vec<super::super::super::rids::api::VersionedVizId>>,
    #[builder(
        custom(
            type = super::super::super::layout::api::WorkbookLayout,
            convert = Box::new
        )
    )]
    #[serde(rename = "layout")]
    layout: Box<super::super::super::layout::api::WorkbookLayout>,
    #[builder(
        custom(
            type = super::super::super::workbookcommon::api::WorkbookContent,
            convert = Box::new
        )
    )]
    #[serde(rename = "content")]
    content: Box<super::super::super::workbookcommon::api::WorkbookContent>,
    #[builder(into)]
    #[serde(rename = "message")]
    message: String,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::ThemeAwareImage>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "previewImage", skip_serializing_if = "Option::is_none", default)]
    preview_image: Option<Box<super::super::super::super::api::ThemeAwareImage>>,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<conjure_object::ResourceIdentifier>,
}
impl CreateTemplateRequest {
    #[inline]
    pub fn title(&self) -> &str {
        &*self.title
    }
    #[inline]
    pub fn description(&self) -> &str {
        &*self.description
    }
    #[inline]
    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
        &self.labels
    }
    #[inline]
    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
        &self.properties
    }
    /// Default is true
    #[inline]
    pub fn is_published(&self) -> Option<bool> {
        self.is_published.as_ref().map(|o| *o)
    }
    #[deprecated(
        note = "charts are no longer versioned resources. They are stored in workbook content."
    )]
    #[inline]
    pub fn charts(&self) -> Option<&[super::super::super::rids::api::VersionedVizId]> {
        self.charts.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn layout(&self) -> &super::super::super::layout::api::WorkbookLayout {
        &*self.layout
    }
    #[inline]
    pub fn content(&self) -> &super::super::super::workbookcommon::api::WorkbookContent {
        &*self.content
    }
    #[inline]
    pub fn message(&self) -> &str {
        &*self.message
    }
    /// Theme-aware preview image for the template. Falls back to a default illustration if not provided.
    #[inline]
    pub fn preview_image(
        &self,
    ) -> Option<&super::super::super::super::api::ThemeAwareImage> {
        self.preview_image.as_ref().map(|o| &**o)
    }
    /// The workspace in which to create the template. If not provided, the template will be created in the default workspace for
    /// the user's organization, if the default workspace for the organization is configured.
    #[inline]
    pub fn workspace(&self) -> Option<&conjure_object::ResourceIdentifier> {
        self.workspace.as_ref().map(|o| &*o)
    }
}
