#[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 SaveChecklistRequest {
    #[builder(default, list(item(type = super::UpdateChecklistEntryRequest)))]
    #[serde(rename = "checks", skip_serializing_if = "Vec::is_empty", default)]
    checks: Vec<super::UpdateChecklistEntryRequest>,
    #[builder(default, list(item(type = super::UnresolvedChecklistVariable)))]
    #[serde(
        rename = "checklistVariables",
        skip_serializing_if = "Vec::is_empty",
        default
    )]
    checklist_variables: Vec<super::UnresolvedChecklistVariable>,
    #[builder(default, into)]
    #[serde(rename = "latestCommit", skip_serializing_if = "Option::is_none", default)]
    latest_commit: Option<super::super::super::versioning::api::CommitId>,
}
impl SaveChecklistRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn checks(&self) -> &[super::UpdateChecklistEntryRequest] {
        &*self.checks
    }
    /// Variables that can be used in checks. Variables are resolved in order of declaration.
    /// If variable `a` depends on variable `b`, then `b` must be defined before `a` in the list.
    #[inline]
    pub fn checklist_variables(&self) -> &[super::UnresolvedChecklistVariable] {
        &*self.checklist_variables
    }
    /// If present, will validate that the latest commit matches this id,
    /// and otherwise throw CommitConflict.
    #[inline]
    pub fn latest_commit(
        &self,
    ) -> Option<&super::super::super::versioning::api::CommitId> {
        self.latest_commit.as_ref().map(|o| &*o)
    }
}
