# Copyright 2019 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
#
#     http://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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudSearch.V1.Model.Item do
  @moduledoc """
  Represents a single object that is an item in the search index, such as a file, folder, or a database record.

  ## Attributes

  *   `acl` (*type:* `GoogleApi.CloudSearch.V1.Model.ItemAcl.t`, *default:* `nil`) - Access control list for this item.
  *   `content` (*type:* `GoogleApi.CloudSearch.V1.Model.ItemContent.t`, *default:* `nil`) - Item content to be indexed and made text searchable.
  *   `itemType` (*type:* `String.t`, *default:* `nil`) - The type for this item.
  *   `metadata` (*type:* `GoogleApi.CloudSearch.V1.Model.ItemMetadata.t`, *default:* `nil`) - The metadata information.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the Item. Format: datasources/{source_id}/items/{item_id} This is a required field. The maximum length is 1536 characters.
  *   `payload` (*type:* `String.t`, *default:* `nil`) - Additional state connector can store for this item. The maximum length is 10000 bytes.
  *   `queue` (*type:* `String.t`, *default:* `nil`) - Queue this item belongs to. The maximum length is 100 characters.
  *   `status` (*type:* `GoogleApi.CloudSearch.V1.Model.ItemStatus.t`, *default:* `nil`) - Status of the item. Output only field.
  *   `structuredData` (*type:* `GoogleApi.CloudSearch.V1.Model.ItemStructuredData.t`, *default:* `nil`) - The structured data for the item that should conform to a registered object definition in the schema for the data source.
  *   `version` (*type:* `String.t`, *default:* `nil`) - Required. The indexing system stores the version from the datasource as a byte string and compares the Item version in the index to the version of the queued Item using lexical ordering. Cloud Search Indexing won't index or delete any queued item with a version value that is less than or equal to the version of the currently indexed item. The maximum length for this field is 1024 bytes. For information on how item version affects the deletion process, refer to [Handle revisions after manual deletes](https://developers.google.com/cloud-search/docs/guides/operations).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :acl => GoogleApi.CloudSearch.V1.Model.ItemAcl.t() | nil,
          :content => GoogleApi.CloudSearch.V1.Model.ItemContent.t() | nil,
          :itemType => String.t() | nil,
          :metadata => GoogleApi.CloudSearch.V1.Model.ItemMetadata.t() | nil,
          :name => String.t() | nil,
          :payload => String.t() | nil,
          :queue => String.t() | nil,
          :status => GoogleApi.CloudSearch.V1.Model.ItemStatus.t() | nil,
          :structuredData => GoogleApi.CloudSearch.V1.Model.ItemStructuredData.t() | nil,
          :version => String.t() | nil
        }

  field(:acl, as: GoogleApi.CloudSearch.V1.Model.ItemAcl)
  field(:content, as: GoogleApi.CloudSearch.V1.Model.ItemContent)
  field(:itemType)
  field(:metadata, as: GoogleApi.CloudSearch.V1.Model.ItemMetadata)
  field(:name)
  field(:payload)
  field(:queue)
  field(:status, as: GoogleApi.CloudSearch.V1.Model.ItemStatus)
  field(:structuredData, as: GoogleApi.CloudSearch.V1.Model.ItemStructuredData)
  field(:version)
end

defimpl Poison.Decoder, for: GoogleApi.CloudSearch.V1.Model.Item do
  def decode(value, options) do
    GoogleApi.CloudSearch.V1.Model.Item.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudSearch.V1.Model.Item do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
