#[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 CreateNotebookRequest {
    #[builder(into)]
    #[serde(rename = "title")]
    title: String,
    #[builder(into)]
    #[serde(rename = "description")]
    description: String,
    #[builder(default, into)]
    #[serde(rename = "notebookType", skip_serializing_if = "Option::is_none", default)]
    notebook_type: Option<super::NotebookType>,
    #[serde(rename = "isDraft")]
    is_draft: bool,
    #[builder(into)]
    #[serde(rename = "stateAsJson")]
    state_as_json: String,
    #[builder(default, into)]
    #[serde(rename = "charts", skip_serializing_if = "Option::is_none", default)]
    charts: Option<Vec<super::ChartWithOverlays>>,
    #[builder(default, into)]
    #[serde(rename = "runRid", skip_serializing_if = "Option::is_none", default)]
    run_rid: Option<super::super::super::run::api::RunRid>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::NotebookDataScope>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "dataScope", skip_serializing_if = "Option::is_none", default)]
    data_scope: Option<Box<super::NotebookDataScope>>,
    #[builder(
        custom(
            type = super::super::super::layout::api::WorkbookLayout,
            convert = Box::new
        )
    )]
    #[serde(rename = "layout")]
    layout: Box<super::super::super::layout::api::WorkbookLayout>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::workbookcommon::api::WorkbookContent>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "content", skip_serializing_if = "Option::is_none", default)]
    content: Option<Box<super::super::super::workbookcommon::api::WorkbookContent>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::workbookcommon::api::UnifiedWorkbookContent>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "contentV2", skip_serializing_if = "Option::is_none", default)]
    content_v2: Option<
        Box<super::super::super::workbookcommon::api::UnifiedWorkbookContent>,
    >,
    #[builder(
        default,
        set(item(type = super::super::super::workbookcommon::api::EventReference))
    )]
    #[serde(
        rename = "eventRefs",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    event_refs: std::collections::BTreeSet<
        super::super::super::workbookcommon::api::EventReference,
    >,
    #[builder(default, into)]
    #[serde(rename = "checkAlertRefs", skip_serializing_if = "Option::is_none", default)]
    check_alert_refs: Option<
        std::collections::BTreeSet<
            super::super::super::workbookcommon::api::CheckAlertReference,
        >,
    >,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<conjure_object::ResourceIdentifier>,
    #[builder(default, into)]
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none", default)]
    labels: Option<std::collections::BTreeSet<String>>,
    #[builder(default, into)]
    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
    properties: Option<std::collections::BTreeMap<String, 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>>,
}
impl CreateNotebookRequest {
    #[inline]
    pub fn title(&self) -> &str {
        &*self.title
    }
    #[inline]
    pub fn description(&self) -> &str {
        &*self.description
    }
    /// Optional for backcompatibility. Default is a normal workbook.
    #[inline]
    pub fn notebook_type(&self) -> Option<&super::NotebookType> {
        self.notebook_type.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn is_draft(&self) -> bool {
        self.is_draft
    }
    #[inline]
    pub fn state_as_json(&self) -> &str {
        &*self.state_as_json
    }
    #[deprecated(note = "charts are now stored in contentV2")]
    #[inline]
    pub fn charts(&self) -> Option<&[super::ChartWithOverlays]> {
        self.charts.as_ref().map(|o| &**o)
    }
    /// deprecated. Use dataScope instead
    #[inline]
    pub fn run_rid(&self) -> Option<&super::super::super::run::api::RunRid> {
        self.run_rid.as_ref().map(|o| &*o)
    }
    /// Optional for back-compatibility.
    #[inline]
    pub fn data_scope(&self) -> Option<&super::NotebookDataScope> {
        self.data_scope.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn layout(&self) -> &super::super::super::layout::api::WorkbookLayout {
        &*self.layout
    }
    #[deprecated(note = "use contentV2 instead")]
    #[inline]
    pub fn content(
        &self,
    ) -> Option<&super::super::super::workbookcommon::api::WorkbookContent> {
        self.content.as_ref().map(|o| &**o)
    }
    /// Optional for backcompatibility
    #[inline]
    pub fn content_v2(
        &self,
    ) -> Option<&super::super::super::workbookcommon::api::UnifiedWorkbookContent> {
        self.content_v2.as_ref().map(|o| &**o)
    }
    /// Field to pin events to a workbook on creation.
    #[inline]
    pub fn event_refs(
        &self,
    ) -> &std::collections::BTreeSet<
        super::super::super::workbookcommon::api::EventReference,
    > {
        &self.event_refs
    }
    /// Field to pin check alerts to a workbook on creation.
    /// Any specified CheckAlertReference will be added to the workbook along with it's corresponding EventReference.
    #[deprecated(
        note = "CheckAlerts are no longer supported and will be removed in the future.\nUse eventRefs to pin events to workbooks instead.\n"
    )]
    #[inline]
    pub fn check_alert_refs(
        &self,
    ) -> Option<
        &std::collections::BTreeSet<
            super::super::super::workbookcommon::api::CheckAlertReference,
        >,
    > {
        self.check_alert_refs.as_ref().map(|o| &*o)
    }
    /// The workspace in which to create the workbook. If not provided, the workbook 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)
    }
    /// Labels to apply to the workbook on creation. Defaults to empty if not provided.
    #[inline]
    pub fn labels(&self) -> Option<&std::collections::BTreeSet<String>> {
        self.labels.as_ref().map(|o| &*o)
    }
    /// Properties to apply to the workbook on creation. Defaults to empty if not provided.
    #[inline]
    pub fn properties(&self) -> Option<&std::collections::BTreeMap<String, String>> {
        self.properties.as_ref().map(|o| &*o)
    }
    /// Theme-aware preview image for the workbook. 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)
    }
}
