#[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 PolynomialCurve {
    #[builder(custom(type = super::IntegerConstant, convert = Box::new))]
    #[serde(rename = "degree")]
    degree: Box<super::IntegerConstant>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DoubleConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "intercept", skip_serializing_if = "Option::is_none", default)]
    intercept: Option<Box<super::DoubleConstant>>,
}
impl PolynomialCurve {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(degree: super::IntegerConstant) -> Self {
        Self::builder().degree(degree).build()
    }
    /// The highest allowable degree of the fit polynomial.
    #[inline]
    pub fn degree(&self) -> &super::IntegerConstant {
        &*self.degree
    }
    /// The y-value at the point x (or t) = 0. If omitted, the y-intercept will also be fit to the data.
    #[inline]
    pub fn intercept(&self) -> Option<&super::DoubleConstant> {
        self.intercept.as_ref().map(|o| &**o)
    }
}
