#[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 TimeSeriesChartDefinitionV1 {
    #[builder(default, list(item(type = super::TimeSeriesRow)))]
    #[serde(rename = "rows", skip_serializing_if = "Vec::is_empty", default)]
    rows: Vec<super::TimeSeriesRow>,
    #[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 = "events", skip_serializing_if = "Option::is_none", default)]
    events: Option<Vec<super::Event>>,
    #[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, into)]
    #[serde(rename = "thresholds", skip_serializing_if = "Option::is_none", default)]
    thresholds: Option<Vec<super::AxisThresholdVisualization>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DisconnectedValueVisualization>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "disconnectedValues",
        skip_serializing_if = "Option::is_none",
        default
    )]
    disconnected_values: Option<Box<super::DisconnectedValueVisualization>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::StalenessConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "stalenessConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    staleness_configuration: Option<Box<super::StalenessConfiguration>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::PlotColoringConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "plotColoringConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    plot_coloring_configuration: Option<Box<super::PlotColoringConfiguration>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::Timestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "anchorPoint", skip_serializing_if = "Option::is_none", default)]
    anchor_point: Option<Box<super::super::super::super::api::Timestamp>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::PanelBucketStrategy>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "bucketStrategy", skip_serializing_if = "Option::is_none", default)]
    bucket_strategy: Option<Box<super::PanelBucketStrategy>>,
    #[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>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::BucketDisplayConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "bucketDisplayConfig",
        skip_serializing_if = "Option::is_none",
        default
    )]
    bucket_display_config: Option<Box<super::BucketDisplayConfig>>,
}
impl TimeSeriesChartDefinitionV1 {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn rows(&self) -> &[super::TimeSeriesRow] {
        &*self.rows
    }
    #[inline]
    pub fn comparison_run_groups(
        &self,
    ) -> &[super::super::super::comparisonrun::api::ComparisonRunGroup] {
        &*self.comparison_run_groups
    }
    #[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 title(&self) -> Option<&str> {
        self.title.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn value_axes(&self) -> &[super::ValueAxis] {
        &*self.value_axes
    }
    #[inline]
    pub fn thresholds(&self) -> Option<&[super::AxisThresholdVisualization]> {
        self.thresholds.as_ref().map(|o| &**o)
    }
    /// Determines when disconnected values should be connected. By default, they are always connected.
    #[deprecated(note = "Use stalenessConfiguration instead")]
    #[inline]
    pub fn disconnected_values(&self) -> Option<&super::DisconnectedValueVisualization> {
        self.disconnected_values.as_ref().map(|o| &**o)
    }
    /// Determines when to draw lines between points. By default, the staleness threshold is 1s and stale points are connected.
    #[inline]
    pub fn staleness_configuration(&self) -> Option<&super::StalenessConfiguration> {
        self.staleness_configuration.as_ref().map(|o| &**o)
    }
    /// Configuration for coloring time series plots in this chart. By default, plots are colored
    /// independently between rows with a unique color if possible when created.
    #[inline]
    pub fn plot_coloring_configuration(
        &self,
    ) -> Option<&super::PlotColoringConfiguration> {
        self.plot_coloring_configuration.as_ref().map(|o| &**o)
    }
    /// Optional anchor point for fixed bucket alignment. When set,
    /// buckets align to this time instead of the viewport start.
    #[inline]
    pub fn anchor_point(&self) -> Option<&super::super::super::super::api::Timestamp> {
        self.anchor_point.as_ref().map(|o| &**o)
    }
    /// Custom bucket size to use when loading data.
    #[inline]
    pub fn bucket_strategy(&self) -> Option<&super::PanelBucketStrategy> {
        self.bucket_strategy.as_ref().map(|o| &**o)
    }
    /// Config for showing floating legends 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)
    }
    /// Controls how decimated bucket data is displayed (e.g. show mean, min, max, count, sum,
    /// or a specific percentile). If undefined, defaults to BucketDisplayConfigDefault.
    #[inline]
    pub fn bucket_display_config(&self) -> Option<&super::BucketDisplayConfig> {
        self.bucket_display_config.as_ref().map(|o| &**o)
    }
}
