#[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 UpdateRefNameRequest {
    #[builder(
        default,
        map(
            key(type = super::super::super::api::DataSourceRefName),
            value(type = super::super::super::api::DataSourceRefName)
        )
    )]
    #[serde(
        rename = "refNameUpdates",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    ref_name_updates: std::collections::BTreeMap<
        super::super::super::api::DataSourceRefName,
        super::super::super::api::DataSourceRefName,
    >,
    #[builder(default, into)]
    #[serde(rename = "latestCommit", skip_serializing_if = "Option::is_none", default)]
    latest_commit: Option<super::super::super::versioning::api::CommitId>,
}
impl UpdateRefNameRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn ref_name_updates(
        &self,
    ) -> &std::collections::BTreeMap<
        super::super::super::api::DataSourceRefName,
        super::super::super::api::DataSourceRefName,
    > {
        &self.ref_name_updates
    }
    /// 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)
    }
}
