#[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 FrequencyChartDefinitionV2 {
    #[builder(default, list(item(type = super::FrequencyPlotV2)))]
    #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
    plots: Vec<super::FrequencyPlotV2>,
    #[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::FrequencyPlotType>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "plotType", skip_serializing_if = "Option::is_none", default)]
    plot_type: Option<Box<super::FrequencyPlotType>>,
}
impl FrequencyChartDefinitionV2 {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn plots(&self) -> &[super::FrequencyPlotV2] {
        &*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 type of plot to display. If not specified, the default is FFT.
    #[inline]
    pub fn plot_type(&self) -> Option<&super::FrequencyPlotType> {
        self.plot_type.as_ref().map(|o| &**o)
    }
}
