#[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 ChannelVariableComputeExpressionV1Python {
    #[builder(into)]
    #[serde(rename = "expression")]
    expression: String,
    #[builder(
        default,
        map(
            key(type = String, into),
            value(type = super::ChannelVariableComputeExpressionInput)
        )
    )]
    #[serde(
        rename = "inputMap",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    input_map: std::collections::BTreeMap<
        String,
        super::ChannelVariableComputeExpressionInput,
    >,
    #[builder(default, into)]
    #[serde(
        rename = "nominalComputePythonVersion",
        skip_serializing_if = "Option::is_none",
        default
    )]
    nominal_compute_python_version: Option<String>,
}
impl ChannelVariableComputeExpressionV1Python {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(expression: impl Into<String>) -> Self {
        Self::builder().expression(expression).build()
    }
    /// The python code string representing the compute for this variable.
    /// Can be up to 10000 characters long.
    #[inline]
    pub fn expression(&self) -> &str {
        &*self.expression
    }
    /// A map of inputs by the name they're referenced by in the expression.
    /// Inputs can be other channel variables.
    #[inline]
    pub fn input_map(
        &self,
    ) -> &std::collections::BTreeMap<
        String,
        super::ChannelVariableComputeExpressionInput,
    > {
        &self.input_map
    }
    /// The Nominal compute python version identifier which the expression was written in. Used to determine if any
    /// migrations are needed to later versions of the python compute syntax. If not present, assumes the oldest
    /// version.
    #[inline]
    pub fn nominal_compute_python_version(&self) -> Option<&str> {
        self.nominal_compute_python_version.as_ref().map(|o| &**o)
    }
}
