#[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 CommitDerivedDefinitionRequest {
    #[builder(custom(type = super::super::compute::api::Dataset, convert = Box::new))]
    #[serde(rename = "spec")]
    spec: Box<super::super::compute::api::Dataset>,
    #[builder(into)]
    #[serde(rename = "message")]
    message: String,
    #[builder(default, into)]
    #[serde(rename = "latestCommit", skip_serializing_if = "Option::is_none", default)]
    latest_commit: Option<super::super::versioning::api::CommitId>,
}
impl CommitDerivedDefinitionRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        spec: super::super::compute::api::Dataset,
        message: impl Into<String>,
    ) -> Self {
        Self::builder().spec(spec).message(message).build()
    }
    #[inline]
    pub fn spec(&self) -> &super::super::compute::api::Dataset {
        &*self.spec
    }
    #[inline]
    pub fn message(&self) -> &str {
        &*self.message
    }
    /// If present, validates that the latest commit on main matches this id,
    /// and otherwise throws CommitConflict.
    #[inline]
    pub fn latest_commit(&self) -> Option<&super::super::versioning::api::CommitId> {
        self.latest_commit.as_ref().map(|o| &*o)
    }
}
