#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct SubscriptionOptions {
    #[serde(rename = "minDelay")]
    min_delay: super::Milliseconds,
    #[builder(default, into)]
    #[serde(rename = "allowAppends", skip_serializing_if = "Option::is_none", default)]
    allow_appends: Option<bool>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ResultConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "resultConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    result_configuration: Option<Box<super::ResultConfiguration>>,
    #[builder(default, into)]
    #[serde(rename = "useFlink", skip_serializing_if = "Option::is_none", default)]
    use_flink: Option<bool>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::scout::run::api::Duration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "allowedLateness",
        skip_serializing_if = "Option::is_none",
        default
    )]
    allowed_lateness: Option<Box<super::super::super::super::scout::run::api::Duration>>,
}
impl SubscriptionOptions {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(min_delay: super::Milliseconds) -> Self {
        Self::builder().min_delay(min_delay).build()
    }
    /// The minimum delay between `SubscriptionUpdate`s sent for this subscription.
    #[inline]
    pub fn min_delay(&self) -> super::Milliseconds {
        self.min_delay
    }
    /// Can be set to `false` by the client to indicate that it doesn't support appends for this subscription
    /// and always wants to receive full results. Defaults to `false` if not set.
    /// The expectation is that clients should implement support for appends for any of the results covered in
    /// `ComputeNodeAppendResponse` and set this to `true` as quickly as possible. However, in order to support
    /// adding new sub-types to `ComputeNodeAppendResponse` without breaking clients that haven't upgraded yet
    /// and haven't yet added support for them, we default this to `false` and make clients opt-in as soon as they
    /// implement support.
    #[deprecated(note = "Use `resultConfiguration` instead.\n")]
    #[inline]
    pub fn allow_appends(&self) -> Option<bool> {
        self.allow_appends.as_ref().map(|o| *o)
    }
    /// Defines the results that are sent for this subscription. If not set, falls back to the behavior
    /// defined by `allowAppends`.
    #[inline]
    pub fn result_configuration(&self) -> Option<&super::ResultConfiguration> {
        self.result_configuration.as_ref().map(|o| &**o)
    }
    /// If true and server has Flink enabled, use Flink-based streaming computation.
    /// Defaults to false if not specified.
    #[inline]
    pub fn use_flink(&self) -> Option<bool> {
        self.use_flink.as_ref().map(|o| *o)
    }
    /// Configures the lateness threshold for the raw points.
    /// Results will be delayed by the duration specified by this setting.
    /// Note this configuration is only available if we are using Flink.
    /// Defaults to 1 second.
    #[inline]
    pub fn allowed_lateness(
        &self,
    ) -> Option<&super::super::super::super::scout::run::api::Duration> {
        self.allowed_lateness.as_ref().map(|o| &**o)
    }
}
