# 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.EnumPropertyOptions do
  @moduledoc """
  The options for enum properties, which allow you to define a restricted set of strings to match user queries, set rankings for those string values, and define an operator name to be paired with those strings so that users can narrow results to only items with a specific value. For example, for items in a request tracking system with priority information, you could define *p0* as an allowable enum value and tie this enum to the operator name *priority* so that search users could add *priority:p0* to their query to restrict the set of results to only those items indexed with the value *p0*.

  ## Attributes

  *   `operatorOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.EnumOperatorOptions.t`, *default:* `nil`) - If set, describes how the enum should be used as a search operator.
  *   `orderedRanking` (*type:* `String.t`, *default:* `nil`) - Used to specify the ordered ranking for the enumeration that determines how the integer values provided in the possible EnumValuePairs are used to rank results. If specified, integer values must be provided for all possible EnumValuePair values given for this property. Can only be used if isRepeatable is false.
  *   `possibleValues` (*type:* `list(GoogleApi.CloudSearch.V1.Model.EnumValuePair.t)`, *default:* `nil`) - The list of possible values for the enumeration property. All EnumValuePairs must provide a string value. If you specify an integer value for one EnumValuePair, then all possible EnumValuePairs must provide an integer value. Both the string value and integer value must be unique over all possible values. Once set, possible values cannot be removed or modified. If you supply an ordered ranking and think you might insert additional enum values in the future, leave gaps in the initial integer values to allow adding a value in between previously registered values. The maximum number of elements is 100.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :operatorOptions => GoogleApi.CloudSearch.V1.Model.EnumOperatorOptions.t() | nil,
          :orderedRanking => String.t() | nil,
          :possibleValues => list(GoogleApi.CloudSearch.V1.Model.EnumValuePair.t()) | nil
        }

  field(:operatorOptions, as: GoogleApi.CloudSearch.V1.Model.EnumOperatorOptions)
  field(:orderedRanking)
  field(:possibleValues, as: GoogleApi.CloudSearch.V1.Model.EnumValuePair, type: :list)
end

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

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