/// Produces a list of ranges for each point that is greater than its neighbors.
/// Peaks at edges are discarded, and continuous, multivalue, flat peaks will return all values.
#[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 PeakRanges {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[builder(default, into)]
    #[serde(rename = "returnsPeaks", skip_serializing_if = "Option::is_none", default)]
    returns_peaks: Option<bool>,
    #[builder(default, into)]
    #[serde(rename = "returnType", skip_serializing_if = "Option::is_none", default)]
    return_type: Option<super::PeakType>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DoubleConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "minimumProminence",
        skip_serializing_if = "Option::is_none",
        default
    )]
    minimum_prominence: Option<Box<super::DoubleConstant>>,
}
impl PeakRanges {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(input: super::NumericSeries) -> Self {
        Self::builder().input(input).build()
    }
    #[inline]
    pub fn input(&self) -> &super::NumericSeries {
        &*self.input
    }
    /// True if returning peaks, else troughs.
    #[deprecated(note = "No longer used, use returnType instead")]
    #[inline]
    pub fn returns_peaks(&self) -> Option<bool> {
        self.returns_peaks.as_ref().map(|o| *o)
    }
    /// Optional for backcompatibility.
    #[inline]
    pub fn return_type(&self) -> Option<&super::PeakType> {
        self.return_type.as_ref().map(|o| &*o)
    }
    /// The minimum topographic prominence for an extrema to be returned.
    /// Prominence is the minimum vertical distance needed to travel from an extrema to one of greater magnitude.
    #[inline]
    pub fn minimum_prominence(&self) -> Option<&super::DoubleConstant> {
        self.minimum_prominence.as_ref().map(|o| &**o)
    }
}
