#[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 Trace {
    #[builder(into)]
    #[serde(rename = "plotlyTrace")]
    plotly_trace: String,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::TraceCompute>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "compute", skip_serializing_if = "Option::is_none", default)]
    compute: Option<Box<super::TraceCompute>>,
}
impl Trace {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(plotly_trace: impl Into<String>) -> Self {
        Self::builder().plotly_trace(plotly_trace).build()
    }
    /// The json trace definition according to plotly's schema
    /// https://plotly.com/python/figure-structure/#the-toplevel-data-attribute
    #[inline]
    pub fn plotly_trace(&self) -> &str {
        &*self.plotly_trace
    }
    /// Information needed to substitute computed data arrays into the trace
    #[inline]
    pub fn compute(&self) -> Option<&super::TraceCompute> {
        self.compute.as_ref().map(|o| &**o)
    }
}
