# 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.EnumValuePair do
  @moduledoc """
  The enumeration value pair defines two things: a required string value and an optional integer value. The string value defines the necessary query term required to retrieve that item, such as *p0* for a priority item. The integer value determines the ranking of that string value relative to other enumerated values for the same property. For example, you might associate *p0* with *0* and define another enum pair such as *p1* and *1*. You must use the integer value in combination with ordered ranking to set the ranking of a given value relative to other enumerated values for the same property name. Here, a ranking order of DESCENDING for *priority* properties results in a ranking boost for items indexed with a value of *p0* compared to items indexed with a value of *p1*. Without a specified ranking order, the integer value has no effect on item ranking.

  ## Attributes

  *   `integerValue` (*type:* `integer()`, *default:* `nil`) - The integer value of the EnumValuePair which must be non-negative. Optional.
  *   `stringValue` (*type:* `String.t`, *default:* `nil`) - The string value of the EnumValuePair. The maximum length is 32 characters.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :integerValue => integer() | nil,
          :stringValue => String.t() | nil
        }

  field(:integerValue)
  field(:stringValue)
end

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

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