/// Returns the single sided amplitude spectrum of the input series.
#[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 Fft {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[builder(default, into)]
    #[serde(rename = "window", skip_serializing_if = "Option::is_none", default)]
    window: Option<super::FftWindow>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::FrequencySummarizationStrategy>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "summarizationStrategy",
        skip_serializing_if = "Option::is_none",
        default
    )]
    summarization_strategy: Option<Box<super::FrequencySummarizationStrategy>>,
    #[builder(default, into)]
    #[serde(rename = "nfft", skip_serializing_if = "Option::is_none", default)]
    nfft: Option<i32>,
}
impl Fft {
    /// 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
    }
    /// Window function applied to the input series. Defaults to RECT is not specified.
    #[inline]
    pub fn window(&self) -> Option<&super::FftWindow> {
        self.window.as_ref().map(|o| &*o)
    }
    /// Strategy to downsample the output frequency spectrum.
    #[inline]
    pub fn summarization_strategy(
        &self,
    ) -> Option<&super::FrequencySummarizationStrategy> {
        self.summarization_strategy.as_ref().map(|o| &**o)
    }
    /// Length of the FFT. When nfft < input length, the input is truncated to the first nfft samples before
    /// windowing and transforming. When nfft > input length, the windowed input is zero-padded up to nfft
    /// before transforming. When nfft is unset, defaults to the input length, producing the same result as
    /// setting nfft to the input length. The output contains nfft/2 + 1 single-sided frequency bins with spacing
    /// fs/nfft. For best performance, prefer a power of 2 (e.g. 512, 1024, 2048).
    #[inline]
    pub fn nfft(&self) -> Option<i32> {
        self.nfft.as_ref().map(|o| *o)
    }
}
