// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The start of a message.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct MessageStartEvent {
    /// <p>The role for the message.</p>
    pub role: crate::types::ConversationRole,
}
impl MessageStartEvent {
    /// <p>The role for the message.</p>
    pub fn role(&self) -> &crate::types::ConversationRole {
        &self.role
    }
}
impl MessageStartEvent {
    /// Creates a new builder-style object to manufacture [`MessageStartEvent`](crate::types::MessageStartEvent).
    pub fn builder() -> crate::types::builders::MessageStartEventBuilder {
        crate::types::builders::MessageStartEventBuilder::default()
    }
}

/// A builder for [`MessageStartEvent`](crate::types::MessageStartEvent).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct MessageStartEventBuilder {
    pub(crate) role: ::std::option::Option<crate::types::ConversationRole>,
}
impl MessageStartEventBuilder {
    /// <p>The role for the message.</p>
    /// This field is required.
    pub fn role(mut self, input: crate::types::ConversationRole) -> Self {
        self.role = ::std::option::Option::Some(input);
        self
    }
    /// <p>The role for the message.</p>
    pub fn set_role(mut self, input: ::std::option::Option<crate::types::ConversationRole>) -> Self {
        self.role = input;
        self
    }
    /// <p>The role for the message.</p>
    pub fn get_role(&self) -> &::std::option::Option<crate::types::ConversationRole> {
        &self.role
    }
    /// Consumes the builder and constructs a [`MessageStartEvent`](crate::types::MessageStartEvent).
    /// This method will fail if any of the following fields are not set:
    /// - [`role`](crate::types::builders::MessageStartEventBuilder::role)
    pub fn build(self) -> ::std::result::Result<crate::types::MessageStartEvent, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::MessageStartEvent {
            role: self.role.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "role",
                    "role was not specified but it is required when building MessageStartEvent",
                )
            })?,
        })
    }
}
