# 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.GoogleCloudRetailV2CatalogAttributeFacetConfig do
  @moduledoc """
  Possible options for the facet that corresponds to the current attribute config.

  ## Attributes

  *   `facetIntervals` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2Interval.t)`, *default:* `nil`) - If you don't set the facet SearchRequest.FacetSpec.FacetKey.intervals in the request to a numerical attribute, then we use the computed intervals with rounded bounds obtained from all its product numerical attribute values. The computed intervals might not be ideal for some attributes. Therefore, we give you the option to overwrite them with the facet_intervals field. The maximum of facet intervals per CatalogAttribute is 40. Each interval must have a lower bound or an upper bound. If both bounds are provided, then the lower bound must be smaller or equal than the upper bound.
  *   `ignoredFacetValues` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigIgnoredFacetValues.t)`, *default:* `nil`) - Each instance represents a list of attribute values to ignore as facet values for a specific time range. The maximum number of instances per CatalogAttribute is 25.
  *   `mergedFacet` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigMergedFacet.t`, *default:* `nil`) - Use this field only if you want to merge a facet key into another facet key.
  *   `mergedFacetValues` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigMergedFacetValue.t)`, *default:* `nil`) - Each instance replaces a list of facet values by a merged facet value. If a facet value is not in any list, then it will stay the same. To avoid conflicts, only paths of length 1 are accepted. In other words, if "dark_blue" merged into "BLUE", then the latter can't merge into "blues" because this would create a path of length 2. The maximum number of instances of MergedFacetValue per CatalogAttribute is 100. This feature is available only for textual custom attributes.
  *   `rerankConfig` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig.t`, *default:* `nil`) - Set this field only if you want to rerank based on facet values engaged by the user for the current key. This option is only possible for custom facetable textual keys.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :facetIntervals =>
            list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2Interval.t()) | nil,
          :ignoredFacetValues =>
            list(
              GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigIgnoredFacetValues.t()
            )
            | nil,
          :mergedFacet =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigMergedFacet.t()
            | nil,
          :mergedFacetValues =>
            list(
              GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigMergedFacetValue.t()
            )
            | nil,
          :rerankConfig =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig.t()
            | nil
        }

  field(:facetIntervals, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2Interval, type: :list)

  field(:ignoredFacetValues,
    as:
      GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigIgnoredFacetValues,
    type: :list
  )

  field(:mergedFacet,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigMergedFacet
  )

  field(:mergedFacetValues,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigMergedFacetValue,
    type: :list
  )

  field(:rerankConfig,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CatalogAttributeFacetConfigRerankConfig
  )
end

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

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