/// The root figure definition for a plotly instance
#[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 Figure {
    #[builder(default, list(item(type = super::Trace)))]
    #[serde(rename = "data", skip_serializing_if = "Vec::is_empty", default)]
    data: Vec<super::Trace>,
    #[builder(custom(type = super::Layout, convert = Box::new))]
    #[serde(rename = "layout")]
    layout: Box<super::Layout>,
    #[builder(into)]
    #[serde(rename = "plotlyConfig")]
    plotly_config: String,
}
impl Figure {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(layout: super::Layout, plotly_config: impl Into<String>) -> Self {
        Self::builder().layout(layout).plotly_config(plotly_config).build()
    }
    #[inline]
    pub fn data(&self) -> &[super::Trace] {
        &*self.data
    }
    #[inline]
    pub fn layout(&self) -> &super::Layout {
        &*self.layout
    }
    /// The json config definition according to plotly's schema
    /// https://plotly.com/python/figure-structure/#the-toplevel-config-attribute
    #[inline]
    pub fn plotly_config(&self) -> &str {
        &*self.plotly_config
    }
}
