#[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 Notebook {
    #[serde(rename = "rid")]
    rid: super::super::super::rids::api::NotebookRid,
    #[serde(rename = "snapshotRid")]
    snapshot_rid: super::super::super::rids::api::SnapshotRid,
    #[serde(rename = "snapshotAuthorRid")]
    snapshot_author_rid: super::super::super::rids::api::UserRid,
    #[serde(rename = "snapshotCreatedAt")]
    snapshot_created_at: conjure_object::DateTime<conjure_object::Utc>,
    #[builder(custom(type = super::NotebookMetadata, convert = Box::new))]
    #[serde(rename = "metadata")]
    metadata: Box<super::NotebookMetadata>,
    #[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(
        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(
        custom(
            type = super::super::super::workbookcommon::api::UnifiedWorkbookContent,
            convert = Box::new
        )
    )]
    #[serde(rename = "contentV2")]
    content_v2: 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,
        >,
    >,
}
impl Notebook {
    #[inline]
    pub fn rid(&self) -> &super::super::super::rids::api::NotebookRid {
        &self.rid
    }
    #[inline]
    pub fn snapshot_rid(&self) -> &super::super::super::rids::api::SnapshotRid {
        &self.snapshot_rid
    }
    #[inline]
    pub fn snapshot_author_rid(&self) -> &super::super::super::rids::api::UserRid {
        &self.snapshot_author_rid
    }
    #[inline]
    pub fn snapshot_created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
        self.snapshot_created_at
    }
    #[inline]
    pub fn metadata(&self) -> &super::NotebookMetadata {
        &*self.metadata
    }
    #[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)
    }
    #[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)
    }
    #[inline]
    pub fn content_v2(
        &self,
    ) -> &super::super::super::workbookcommon::api::UnifiedWorkbookContent {
        &*self.content_v2
    }
    #[inline]
    pub fn event_refs(
        &self,
    ) -> &std::collections::BTreeSet<
        super::super::super::workbookcommon::api::EventReference,
    > {
        &self.event_refs
    }
    #[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)
    }
}
