/// Request to duplicate a workbook. All content fields (layout, charts, contentV2, eventRefs) are
/// copied from the source workbook. Metadata fields can be optionally overridden; if not provided,
/// they default to the source workbook's values (except isDraft which defaults to true, and
/// isLocked which defaults to false).
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct DuplicateNotebookRequest {
    #[builder(default, into)]
    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
    title: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "titleSuffix", skip_serializing_if = "Option::is_none", default)]
    title_suffix: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[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(default, into)]
    #[serde(rename = "isDraft", skip_serializing_if = "Option::is_none", default)]
    is_draft: Option<bool>,
    #[builder(default, into)]
    #[serde(rename = "isLocked", skip_serializing_if = "Option::is_none", default)]
    is_locked: Option<bool>,
    #[serde(rename = "workspace")]
    workspace: 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 DuplicateNotebookRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(workspace: conjure_object::ResourceIdentifier) -> Self {
        Self::builder().workspace(workspace).build()
    }
    /// Override the title of the duplicated workbook. If not provided, generates a copy title
    /// from the source using the titleSuffix.
    #[inline]
    pub fn title(&self) -> Option<&str> {
        self.title.as_ref().map(|o| &**o)
    }
    /// Custom suffix for generating the copy title (e.g., "Run analysis").
    /// Defaults to "copy". Ignored if title is explicitly provided.
    #[inline]
    pub fn title_suffix(&self) -> Option<&str> {
        self.title_suffix.as_ref().map(|o| &**o)
    }
    /// Override description. Defaults to the source workbook's description.
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    /// Override data scope. Defaults to the source workbook's data scope.
    #[inline]
    pub fn data_scope(&self) -> Option<&super::NotebookDataScope> {
        self.data_scope.as_ref().map(|o| &**o)
    }
    /// Override draft status. Defaults to true — even published (and locked) workbooks become
    /// drafts when duplicated, since the copy is a new working version for the caller to review
    /// before publishing.
    #[inline]
    pub fn is_draft(&self) -> Option<bool> {
        self.is_draft.as_ref().map(|o| *o)
    }
    /// Override lock status. Defaults to false — locked workbooks are unlocked when duplicated,
    /// since the copy is a new draft for the caller to iterate on.
    #[inline]
    pub fn is_locked(&self) -> Option<bool> {
        self.is_locked.as_ref().map(|o| *o)
    }
    /// The workspace for the duplicated workbook.
    #[inline]
    pub fn workspace(&self) -> &conjure_object::ResourceIdentifier {
        &self.workspace
    }
    /// Override labels. Defaults to the source workbook's labels.
    #[inline]
    pub fn labels(&self) -> Option<&std::collections::BTreeSet<String>> {
        self.labels.as_ref().map(|o| &*o)
    }
    /// Override properties. Defaults to the source workbook's properties.
    #[inline]
    pub fn properties(&self) -> Option<&std::collections::BTreeMap<String, String>> {
        self.properties.as_ref().map(|o| &*o)
    }
    /// Override preview image. Defaults to the source workbook's preview image.
    #[inline]
    pub fn preview_image(
        &self,
    ) -> Option<&super::super::super::super::api::ThemeAwareImage> {
        self.preview_image.as_ref().map(|o| &**o)
    }
}
