# 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.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig do
  @moduledoc """
  Options to rerank based on facet values engaged by the user for the current key. That key needs to be a custom textual key and facetable. To use this control, you also need to pass all the facet keys engaged by the user in the request using the field [SearchRequest.FacetSpec]. In particular, if you don't pass the facet keys engaged that you want to rerank on, this control won't be effective. Moreover, to obtain better results, the facet values that you want to rerank on should be close to English (ideally made of words, underscores, and spaces).

  ## Attributes

  *   `facetValues` (*type:* `list(String.t)`, *default:* `nil`) - If empty, rerank on all facet values for the current key. Otherwise, will rerank on the facet values from this list only.
  *   `rerankFacet` (*type:* `boolean()`, *default:* `nil`) - If set to true, then we also rerank the dynamic facets based on the facet values engaged by the user for the current attribute key during serving.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :facetValues => list(String.t()) | nil,
          :rerankFacet => boolean() | nil
        }

  field(:facetValues, type: :list)
  field(:rerankFacet)
end

defimpl Poison.Decoder,
  for: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig do
  def decode(value, options) do
    GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
