/// Calculates the first discrete difference of the input series. For each point, computes the difference between
/// the current value and the previous value (current - previous). The first point in the input series is omitted
/// from the output since it has no previous point to compare against.
///
/// This is equivalent to pandas DataFrame.diff() with period=1. Useful for analyzing changes between consecutive
/// data points in time series data, such as detecting value increases or decreases.
///
/// Example: For input values [1.0, 1.0, 2.0, 2.5, 1.8], the output would be [0.0, 1.0, 0.5, -0.7] at the
/// corresponding timestamps (the first timestamp is omitted).
#[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 ValueDifferenceSeries {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::NegativeValueConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "negativeValuesConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    negative_values_configuration: Option<Box<super::NegativeValueConfiguration>>,
}
impl ValueDifferenceSeries {
    /// 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
    }
    /// Defines the strategy for handling negative output values. Defaults to allowNegativeValues if not specified.
    #[inline]
    pub fn negative_values_configuration(
        &self,
    ) -> Option<&super::NegativeValueConfiguration> {
        self.negative_values_configuration.as_ref().map(|o| &**o)
    }
}
