#[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 CartesianChartDefinitionV1 {
    #[builder(default, list(item(type = super::CartesianPlot)))]
    #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
    plots: Vec<super::CartesianPlot>,
    #[builder(default, into)]
    #[serde(rename = "events", skip_serializing_if = "Option::is_none", default)]
    events: Option<Vec<super::Event>>,
    #[builder(
        default,
        list(item(type = super::super::super::comparisonrun::api::ComparisonRunGroup))
    )]
    #[serde(
        rename = "comparisonRunGroups",
        skip_serializing_if = "Vec::is_empty",
        default
    )]
    comparison_run_groups: Vec<
        super::super::super::comparisonrun::api::ComparisonRunGroup,
    >,
    #[builder(default, into)]
    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
    title: Option<String>,
    #[builder(default, list(item(type = super::ValueAxis)))]
    #[serde(rename = "valueAxes", skip_serializing_if = "Vec::is_empty", default)]
    value_axes: Vec<super::ValueAxis>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ScatterDecimation>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "decimation", skip_serializing_if = "Option::is_none", default)]
    decimation: Option<Box<super::ScatterDecimation>>,
    #[builder(default, into)]
    #[serde(rename = "connectPoints", skip_serializing_if = "Option::is_none", default)]
    connect_points: Option<bool>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::FloatingLegendConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "floatingLegendsConfig",
        skip_serializing_if = "Option::is_none",
        default
    )]
    floating_legends_config: Option<Box<super::FloatingLegendConfig>>,
}
impl CartesianChartDefinitionV1 {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn plots(&self) -> &[super::CartesianPlot] {
        &*self.plots
    }
    #[deprecated(note = "Please use the workbook's eventRefs field instead.")]
    #[inline]
    pub fn events(&self) -> Option<&[super::Event]> {
        self.events.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn comparison_run_groups(
        &self,
    ) -> &[super::super::super::comparisonrun::api::ComparisonRunGroup] {
        &*self.comparison_run_groups
    }
    #[inline]
    pub fn title(&self) -> Option<&str> {
        self.title.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn value_axes(&self) -> &[super::ValueAxis] {
        &*self.value_axes
    }
    /// The strategy for bucketing points together.
    #[inline]
    pub fn decimation(&self) -> Option<&super::ScatterDecimation> {
        self.decimation.as_ref().map(|o| &**o)
    }
    /// If toggled true, will visually connect the points of the series
    #[inline]
    pub fn connect_points(&self) -> Option<bool> {
        self.connect_points.as_ref().map(|o| *o)
    }
    /// Config for showing a floating legend in the chart. If undefined, defaults to hiding.
    #[inline]
    pub fn floating_legends_config(&self) -> Option<&super::FloatingLegendConfig> {
        self.floating_legends_config.as_ref().map(|o| &**o)
    }
}
