#[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 MergeToMainRequest {
    #[serde(rename = "branchName")]
    branch_name: super::super::super::versioning::api::BranchName,
    #[builder(into)]
    #[serde(rename = "message")]
    message: String,
    #[builder(default, into)]
    #[serde(
        rename = "latestCommitOnMain",
        skip_serializing_if = "Option::is_none",
        default
    )]
    latest_commit_on_main: Option<super::super::super::versioning::api::CommitId>,
}
impl MergeToMainRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        branch_name: super::super::super::versioning::api::BranchName,
        message: impl Into<String>,
    ) -> Self {
        Self::builder().branch_name(branch_name).message(message).build()
    }
    /// If "main", the request will throw.
    #[inline]
    pub fn branch_name(&self) -> &super::super::super::versioning::api::BranchName {
        &self.branch_name
    }
    #[inline]
    pub fn message(&self) -> &str {
        &*self.message
    }
    /// If present, will validate that the latest commit matches this id,
    /// and otherwise throw CommitConflict.
    #[inline]
    pub fn latest_commit_on_main(
        &self,
    ) -> Option<&super::super::super::versioning::api::CommitId> {
        self.latest_commit_on_main.as_ref().map(|o| &*o)
    }
}
