aws-sdk-textract 1.101.0

AWS SDK for Amazon Textract
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Information about how blocks are related to each other. A <code>Block</code> object contains 0 or more <code>Relation</code> objects in a list, <code>Relationships</code>. For more information, see <code>Block</code>.</p>
/// <p>The <code>Type</code> element provides the type of the relationship for all blocks in the <code>IDs</code> array.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Relationship {
    /// <p>The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.</p>
    /// <ul>
    /// <li>
    /// <p><i>VALUE</i> - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.</p></li>
    /// <li>
    /// <p><i>CHILD</i> - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.</p></li>
    /// <li>
    /// <p><i>MERGED_CELL</i> - A list of IDs that identify each of the MERGED_CELL block types in a table.</p></li>
    /// <li>
    /// <p><i>ANSWER</i> - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.</p></li>
    /// <li>
    /// <p><i>TABLE</i> - A list of IDs that identify associated TABLE block types.</p></li>
    /// <li>
    /// <p><i>TABLE_TITLE</i> - A list that contains the ID for the TABLE_TITLE block type in a table.</p></li>
    /// <li>
    /// <p><i>TABLE_FOOTER</i> - A list of IDs that identify the TABLE_FOOTER block types in a table.</p></li>
    /// </ul>
    pub r#type: ::std::option::Option<crate::types::RelationshipType>,
    /// <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
    pub ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Relationship {
    /// <p>The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.</p>
    /// <ul>
    /// <li>
    /// <p><i>VALUE</i> - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.</p></li>
    /// <li>
    /// <p><i>CHILD</i> - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.</p></li>
    /// <li>
    /// <p><i>MERGED_CELL</i> - A list of IDs that identify each of the MERGED_CELL block types in a table.</p></li>
    /// <li>
    /// <p><i>ANSWER</i> - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.</p></li>
    /// <li>
    /// <p><i>TABLE</i> - A list of IDs that identify associated TABLE block types.</p></li>
    /// <li>
    /// <p><i>TABLE_TITLE</i> - A list that contains the ID for the TABLE_TITLE block type in a table.</p></li>
    /// <li>
    /// <p><i>TABLE_FOOTER</i> - A list of IDs that identify the TABLE_FOOTER block types in a table.</p></li>
    /// </ul>
    pub fn r#type(&self) -> ::std::option::Option<&crate::types::RelationshipType> {
        self.r#type.as_ref()
    }
    /// <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.ids.is_none()`.
    pub fn ids(&self) -> &[::std::string::String] {
        self.ids.as_deref().unwrap_or_default()
    }
}
impl Relationship {
    /// Creates a new builder-style object to manufacture [`Relationship`](crate::types::Relationship).
    pub fn builder() -> crate::types::builders::RelationshipBuilder {
        crate::types::builders::RelationshipBuilder::default()
    }
}

/// A builder for [`Relationship`](crate::types::Relationship).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RelationshipBuilder {
    pub(crate) r#type: ::std::option::Option<crate::types::RelationshipType>,
    pub(crate) ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl RelationshipBuilder {
    /// <p>The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.</p>
    /// <ul>
    /// <li>
    /// <p><i>VALUE</i> - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.</p></li>
    /// <li>
    /// <p><i>CHILD</i> - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.</p></li>
    /// <li>
    /// <p><i>MERGED_CELL</i> - A list of IDs that identify each of the MERGED_CELL block types in a table.</p></li>
    /// <li>
    /// <p><i>ANSWER</i> - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.</p></li>
    /// <li>
    /// <p><i>TABLE</i> - A list of IDs that identify associated TABLE block types.</p></li>
    /// <li>
    /// <p><i>TABLE_TITLE</i> - A list that contains the ID for the TABLE_TITLE block type in a table.</p></li>
    /// <li>
    /// <p><i>TABLE_FOOTER</i> - A list of IDs that identify the TABLE_FOOTER block types in a table.</p></li>
    /// </ul>
    pub fn r#type(mut self, input: crate::types::RelationshipType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.</p>
    /// <ul>
    /// <li>
    /// <p><i>VALUE</i> - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.</p></li>
    /// <li>
    /// <p><i>CHILD</i> - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.</p></li>
    /// <li>
    /// <p><i>MERGED_CELL</i> - A list of IDs that identify each of the MERGED_CELL block types in a table.</p></li>
    /// <li>
    /// <p><i>ANSWER</i> - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.</p></li>
    /// <li>
    /// <p><i>TABLE</i> - A list of IDs that identify associated TABLE block types.</p></li>
    /// <li>
    /// <p><i>TABLE_TITLE</i> - A list that contains the ID for the TABLE_TITLE block type in a table.</p></li>
    /// <li>
    /// <p><i>TABLE_FOOTER</i> - A list of IDs that identify the TABLE_FOOTER block types in a table.</p></li>
    /// </ul>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::RelationshipType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.</p>
    /// <ul>
    /// <li>
    /// <p><i>VALUE</i> - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.</p></li>
    /// <li>
    /// <p><i>CHILD</i> - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.</p></li>
    /// <li>
    /// <p><i>MERGED_CELL</i> - A list of IDs that identify each of the MERGED_CELL block types in a table.</p></li>
    /// <li>
    /// <p><i>ANSWER</i> - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.</p></li>
    /// <li>
    /// <p><i>TABLE</i> - A list of IDs that identify associated TABLE block types.</p></li>
    /// <li>
    /// <p><i>TABLE_TITLE</i> - A list that contains the ID for the TABLE_TITLE block type in a table.</p></li>
    /// <li>
    /// <p><i>TABLE_FOOTER</i> - A list of IDs that identify the TABLE_FOOTER block types in a table.</p></li>
    /// </ul>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::RelationshipType> {
        &self.r#type
    }
    /// Appends an item to `ids`.
    ///
    /// To override the contents of this collection use [`set_ids`](Self::set_ids).
    ///
    /// <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
    pub fn ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.ids.unwrap_or_default();
        v.push(input.into());
        self.ids = ::std::option::Option::Some(v);
        self
    }
    /// <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
    pub fn set_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.ids = input;
        self
    }
    /// <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
    pub fn get_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.ids
    }
    /// Consumes the builder and constructs a [`Relationship`](crate::types::Relationship).
    pub fn build(self) -> crate::types::Relationship {
        crate::types::Relationship {
            r#type: self.r#type,
            ids: self.ids,
        }
    }
}