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

/// <p>Content block start information.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum ContentBlockStart {
    /// <p>The</p>
    ToolResult(crate::types::ToolResultBlockStart),
    /// <p>Information about a tool that the model is requesting to use.</p>
    ToolUse(crate::types::ToolUseBlockStart),
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
    /// An unknown enum variant
    ///
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
    #[non_exhaustive]
    Unknown,
}
impl ContentBlockStart {
    /// Tries to convert the enum instance into [`ToolResult`](crate::types::ContentBlockStart::ToolResult), extracting the inner [`ToolResultBlockStart`](crate::types::ToolResultBlockStart).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_tool_result(&self) -> ::std::result::Result<&crate::types::ToolResultBlockStart, &Self> {
        if let ContentBlockStart::ToolResult(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`ToolResult`](crate::types::ContentBlockStart::ToolResult).
    pub fn is_tool_result(&self) -> bool {
        self.as_tool_result().is_ok()
    }
    /// Tries to convert the enum instance into [`ToolUse`](crate::types::ContentBlockStart::ToolUse), extracting the inner [`ToolUseBlockStart`](crate::types::ToolUseBlockStart).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_tool_use(&self) -> ::std::result::Result<&crate::types::ToolUseBlockStart, &Self> {
        if let ContentBlockStart::ToolUse(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`ToolUse`](crate::types::ContentBlockStart::ToolUse).
    pub fn is_tool_use(&self) -> bool {
        self.as_tool_use().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}
