# 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.Metadata do
  @moduledoc """
  Metadata of a matched search result.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - The creation time for this document or object in the search result.
  *   `displayOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.ResultDisplayMetadata.t`, *default:* `nil`) - Options that specify how to display a structured data search result.
  *   `fields` (*type:* `list(GoogleApi.CloudSearch.V1.Model.NamedProperty.t)`, *default:* `nil`) - Indexed fields in structured data, returned as a generic named property.
  *   `mimeType` (*type:* `String.t`, *default:* `nil`) - Mime type of the search result.
  *   `objectType` (*type:* `String.t`, *default:* `nil`) - Object type of the search result.
  *   `owner` (*type:* `GoogleApi.CloudSearch.V1.Model.Person.t`, *default:* `nil`) - Owner (usually creator) of the document or object of the search result.
  *   `source` (*type:* `GoogleApi.CloudSearch.V1.Model.Source.t`, *default:* `nil`) - The named source for the result, such as Gmail.
  *   `thumbnailUrl` (*type:* `String.t`, *default:* `nil`) - The thumbnail URL of the result.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - The last modified date for the object in the search result. If not set in the item, the value returned here is empty. When `updateTime` is used for calculating freshness and is not set, this value defaults to 2 years from the current time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :displayOptions => GoogleApi.CloudSearch.V1.Model.ResultDisplayMetadata.t() | nil,
          :fields => list(GoogleApi.CloudSearch.V1.Model.NamedProperty.t()) | nil,
          :mimeType => String.t() | nil,
          :objectType => String.t() | nil,
          :owner => GoogleApi.CloudSearch.V1.Model.Person.t() | nil,
          :source => GoogleApi.CloudSearch.V1.Model.Source.t() | nil,
          :thumbnailUrl => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:displayOptions, as: GoogleApi.CloudSearch.V1.Model.ResultDisplayMetadata)
  field(:fields, as: GoogleApi.CloudSearch.V1.Model.NamedProperty, type: :list)
  field(:mimeType)
  field(:objectType)
  field(:owner, as: GoogleApi.CloudSearch.V1.Model.Person)
  field(:source, as: GoogleApi.CloudSearch.V1.Model.Source)
  field(:thumbnailUrl)
  field(:updateTime, as: DateTime)
end

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

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