/// A secondary variable to associate with a trace
#[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 SecondaryVariable {
    #[serde(rename = "variableName")]
    variable_name: super::super::super::channelvariables::api::ChannelVariableName,
    #[builder(default, into)]
    #[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
    label: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none", default)]
    enabled: Option<bool>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::SecondaryVariableOptions>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "visualizationOption",
        skip_serializing_if = "Option::is_none",
        default
    )]
    visualization_option: Option<Box<super::SecondaryVariableOptions>>,
}
impl SecondaryVariable {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        variable_name: super::super::super::channelvariables::api::ChannelVariableName,
    ) -> Self {
        Self::builder().variable_name(variable_name).build()
    }
    #[inline]
    pub fn variable_name(
        &self,
    ) -> &super::super::super::channelvariables::api::ChannelVariableName {
        &self.variable_name
    }
    #[inline]
    pub fn label(&self) -> Option<&str> {
        self.label.as_ref().map(|o| &**o)
    }
    /// Default true
    #[inline]
    pub fn enabled(&self) -> Option<bool> {
        self.enabled.as_ref().map(|o| *o)
    }
    #[inline]
    pub fn visualization_option(&self) -> Option<&super::SecondaryVariableOptions> {
        self.visualization_option.as_ref().map(|o| &**o)
    }
}
