# frozen_string_literal: true

# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!


module Google
  module Cloud
    module DiscoveryEngine
      module V1
        # Chunk captures all raw metadata information of items to be recommended or
        # searched in the chunk mode.
        # @!attribute [rw] name
        #   @return [::String]
        #     The full resource name of the chunk.
        #     Format:
        #     `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.
        #
        #     This field must be a UTF-8 encoded string with a length limit of 1024
        #     characters.
        # @!attribute [rw] id
        #   @return [::String]
        #     Unique chunk ID of the current chunk.
        # @!attribute [rw] content
        #   @return [::String]
        #     Content is a string from a document (parsed content).
        # @!attribute [r] relevance_score
        #   @return [::Float]
        #     Output only. Represents the relevance score based on similarity.
        #     Higher score indicates higher chunk relevance.
        #     The score is in range [-1.0, 1.0].
        #     Only populated on
        #     {::Google::Cloud::DiscoveryEngine::V1::SearchResponse SearchResponse}.
        # @!attribute [rw] document_metadata
        #   @return [::Google::Cloud::DiscoveryEngine::V1::Chunk::DocumentMetadata]
        #     Metadata of the document from the current chunk.
        # @!attribute [r] derived_struct_data
        #   @return [::Google::Protobuf::Struct]
        #     Output only. This field is OUTPUT_ONLY.
        #     It contains derived data that are not in the original input document.
        # @!attribute [rw] page_span
        #   @return [::Google::Cloud::DiscoveryEngine::V1::Chunk::PageSpan]
        #     Page span of the chunk.
        # @!attribute [r] chunk_metadata
        #   @return [::Google::Cloud::DiscoveryEngine::V1::Chunk::ChunkMetadata]
        #     Output only. Metadata of the current chunk.
        # @!attribute [r] data_urls
        #   @return [::Array<::String>]
        #     Output only. Image Data URLs if the current chunk contains images.
        #     Data URLs are composed of four parts: a prefix (data:), a MIME type
        #     indicating the type of data, an optional base64 token if non-textual,
        #     and the data itself:
        #     data:[<mediatype>][;base64],<data>
        # @!attribute [r] annotation_contents
        #   @return [::Array<::String>]
        #     Output only. Annotation contents if the current chunk contains annotations.
        # @!attribute [r] annotation_metadata
        #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1::Chunk::AnnotationMetadata>]
        #     Output only. The annotation metadata includes structured content in the
        #     current chunk.
        class Chunk
          include ::Google::Protobuf::MessageExts
          extend ::Google::Protobuf::MessageExts::ClassMethods

          # Document metadata contains the information of the document of the current
          # chunk.
          # @!attribute [rw] uri
          #   @return [::String]
          #     Uri of the document.
          # @!attribute [rw] title
          #   @return [::String]
          #     Title of the document.
          # @!attribute [rw] struct_data
          #   @return [::Google::Protobuf::Struct]
          #     Data representation.
          #     The structured JSON data for the document. It should conform to the
          #     registered {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} or an
          #     `INVALID_ARGUMENT` error is thrown.
          class DocumentMetadata
            include ::Google::Protobuf::MessageExts
            extend ::Google::Protobuf::MessageExts::ClassMethods
          end

          # Page span of the chunk.
          # @!attribute [rw] page_start
          #   @return [::Integer]
          #     The start page of the chunk.
          # @!attribute [rw] page_end
          #   @return [::Integer]
          #     The end page of the chunk.
          class PageSpan
            include ::Google::Protobuf::MessageExts
            extend ::Google::Protobuf::MessageExts::ClassMethods
          end

          # Metadata of the current chunk. This field is only populated on
          # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search}
          # API.
          # @!attribute [rw] previous_chunks
          #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1::Chunk>]
          #     The previous chunks of the current chunk. The number is controlled by
          #     {::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec::ChunkSpec#num_previous_chunks SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks}.
          #     This field is only populated on
          #     {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search}
          #     API.
          # @!attribute [rw] next_chunks
          #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1::Chunk>]
          #     The next chunks of the current chunk. The number is controlled by
          #     {::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec::ChunkSpec#num_next_chunks SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks}.
          #     This field is only populated on
          #     {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search}
          #     API.
          class ChunkMetadata
            include ::Google::Protobuf::MessageExts
            extend ::Google::Protobuf::MessageExts::ClassMethods
          end

          # The structured content information.
          # @!attribute [r] structure_type
          #   @return [::Google::Cloud::DiscoveryEngine::V1::Chunk::StructureType]
          #     Output only. The structure type of the structured content.
          # @!attribute [r] content
          #   @return [::String]
          #     Output only. The content of the structured content.
          class StructuredContent
            include ::Google::Protobuf::MessageExts
            extend ::Google::Protobuf::MessageExts::ClassMethods
          end

          # The annotation metadata includes structured content in the current chunk.
          # @!attribute [r] structured_content
          #   @return [::Google::Cloud::DiscoveryEngine::V1::Chunk::StructuredContent]
          #     Output only. The structured content information.
          # @!attribute [r] image_id
          #   @return [::String]
          #     Output only. Image id is provided if the structured content is based on
          #     an image.
          class AnnotationMetadata
            include ::Google::Protobuf::MessageExts
            extend ::Google::Protobuf::MessageExts::ClassMethods
          end

          # Defines the types of the structured content that can be extracted.
          module StructureType
            # Default value.
            STRUCTURE_TYPE_UNSPECIFIED = 0

            # Shareholder structure.
            SHAREHOLDER_STRUCTURE = 1

            # Signature structure.
            SIGNATURE_STRUCTURE = 2

            # Checkbox structure.
            CHECKBOX_STRUCTURE = 3
          end
        end
      end
    end
  end
end
