#[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 Context {
    #[builder(
        default,
        map(key(type = super::VariableName), value(type = super::VariableValue))
    )]
    #[serde(
        rename = "variables",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    variables: std::collections::BTreeMap<super::VariableName, super::VariableValue>,
    #[builder(default, into)]
    #[serde(
        rename = "functionVariables",
        skip_serializing_if = "Option::is_none",
        default
    )]
    function_variables: Option<
        std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
    >,
    #[builder(
        default,
        map(key(type = super::DatasetReferenceName), value(type = super::Dataset))
    )]
    #[serde(
        rename = "datasetReferences",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    dataset_references: std::collections::BTreeMap<
        super::DatasetReferenceName,
        super::Dataset,
    >,
    #[builder(default, into)]
    #[serde(
        rename = "frameReferences",
        skip_serializing_if = "Option::is_none",
        default
    )]
    frame_references: Option<
        std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset>,
    >,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::FillStrategy>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "defaultFillStrategy",
        skip_serializing_if = "Option::is_none",
        default
    )]
    default_fill_strategy: Option<Box<super::FillStrategy>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::Alignment>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "defaultAlignmentStrategy",
        skip_serializing_if = "Option::is_none",
        default
    )]
    default_alignment_strategy: Option<Box<super::Alignment>>,
}
impl Context {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn variables(
        &self,
    ) -> &std::collections::BTreeMap<super::VariableName, super::VariableValue> {
        &self.variables
    }
    #[deprecated(
        note = "This field is deprecated and will be removed in a future version.\n"
    )]
    #[inline]
    pub fn function_variables(
        &self,
    ) -> Option<
        &std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
    > {
        self.function_variables.as_ref().map(|o| &*o)
    }
    /// Named datasets looked up by `DatasetReference` nodes in the compute tree.
    #[inline]
    pub fn dataset_references(
        &self,
    ) -> &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset> {
        &self.dataset_references
    }
    /// Named datasets looked up by `DatasetReference` nodes in the compute tree.
    #[deprecated(note = "use datasetReferences instead.")]
    #[inline]
    pub fn frame_references(
        &self,
    ) -> Option<
        &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset>,
    > {
        self.frame_references.as_ref().map(|o| &*o)
    }
    /// Default fill strategy applied at every multi-input alignment boundary
    /// where no per-node interpolationConfiguration is specified. When absent, falls back
    /// to the server-configured default (forward fill with a 1 second fill limit).
    #[inline]
    pub fn default_fill_strategy(&self) -> Option<&super::FillStrategy> {
        self.default_fill_strategy.as_ref().map(|o| &**o)
    }
    /// Default alignment strategy applied at every multi-input alignment boundary
    /// where no per-node alignment strategy is specified. When absent, falls back
    /// to the server default (driver-series alignment).
    #[inline]
    pub fn default_alignment_strategy(&self) -> Option<&super::Alignment> {
        self.default_alignment_strategy.as_ref().map(|o| &**o)
    }
}
