# 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.SourceCrowdingConfig do
  @moduledoc """
  Set search results crowding limits. Crowding is a situation in which multiple results from the same source or host "crowd out" other results, diminishing the quality of search for users. To foster better search quality and source diversity in search results, you can set a condition to reduce repetitive results by source.

  ## Attributes

  *   `numResults` (*type:* `integer()`, *default:* `nil`) - Maximum number of results allowed from a datasource in a result page as long as results from other sources are not exhausted. Value specified must not be negative. A default value is used if this value is equal to 0. To disable crowding, set the value greater than 100.
  *   `numSuggestions` (*type:* `integer()`, *default:* `nil`) - Maximum number of suggestions allowed from a source. No limits will be set on results if this value is less than or equal to 0.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :numResults => integer() | nil,
          :numSuggestions => integer() | nil
        }

  field(:numResults)
  field(:numSuggestions)
end

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

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