# 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.GoogleCloudRetailV2CompletionConfig do
  @moduledoc """
  Catalog level autocomplete config for customers to customize autocomplete feature's settings.

  ## Attributes

  *   `allowlistInputConfig` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig.t`, *default:* `nil`) - Output only. The source data for the latest import of the autocomplete allowlist phrases.
  *   `autoLearning` (*type:* `boolean()`, *default:* `nil`) - If set to true, the auto learning function is enabled. Auto learning uses user data to generate suggestions using ML techniques. Default value is false. Only after enabling auto learning can users use `cloud-retail` data in CompleteQueryRequest.
  *   `denylistInputConfig` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig.t`, *default:* `nil`) - Output only. The source data for the latest import of the autocomplete denylist phrases.
  *   `lastAllowlistImportOperation` (*type:* `String.t`, *default:* `nil`) - Output only. Name of the LRO corresponding to the latest allowlist import. Can use GetOperation API to retrieve the latest state of the Long Running Operation.
  *   `lastDenylistImportOperation` (*type:* `String.t`, *default:* `nil`) - Output only. Name of the LRO corresponding to the latest denylist import. Can use GetOperation API to retrieve the latest state of the Long Running Operation.
  *   `lastSuggestionsImportOperation` (*type:* `String.t`, *default:* `nil`) - Output only. Name of the LRO corresponding to the latest suggestion terms list import. Can use GetOperation API method to retrieve the latest state of the Long Running Operation.
  *   `matchingOrder` (*type:* `String.t`, *default:* `nil`) - Specifies the matching order for autocomplete suggestions, e.g., a query consisting of 'sh' with 'out-of-order' specified would suggest "women's shoes", whereas a query of 'red s' with 'exact-prefix' specified would suggest "red shoes". Currently supported values: * 'out-of-order' * 'exact-prefix' Default value: 'exact-prefix'.
  *   `maxSuggestions` (*type:* `integer()`, *default:* `nil`) - The maximum number of autocomplete suggestions returned per term. Default value is 20. If left unset or set to 0, then will fallback to default value. Value range is 1 to 20.
  *   `minPrefixLength` (*type:* `integer()`, *default:* `nil`) - The minimum number of characters needed to be typed in order to get suggestions. Default value is 2. If left unset or set to 0, then will fallback to default value. Value range is 1 to 20.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. Fully qualified name `projects/*/locations/*/catalogs/*/completionConfig`
  *   `suggestionsInputConfig` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig.t`, *default:* `nil`) - Output only. The source data for the latest import of the autocomplete suggestion phrases.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowlistInputConfig =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig.t() | nil,
          :autoLearning => boolean() | nil,
          :denylistInputConfig =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig.t() | nil,
          :lastAllowlistImportOperation => String.t() | nil,
          :lastDenylistImportOperation => String.t() | nil,
          :lastSuggestionsImportOperation => String.t() | nil,
          :matchingOrder => String.t() | nil,
          :maxSuggestions => integer() | nil,
          :minPrefixLength => integer() | nil,
          :name => String.t() | nil,
          :suggestionsInputConfig =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig.t() | nil
        }

  field(:allowlistInputConfig,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig
  )

  field(:autoLearning)

  field(:denylistInputConfig,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig
  )

  field(:lastAllowlistImportOperation)
  field(:lastDenylistImportOperation)
  field(:lastSuggestionsImportOperation)
  field(:matchingOrder)
  field(:maxSuggestions)
  field(:minPrefixLength)
  field(:name)

  field(:suggestionsInputConfig,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2CompletionDataInputConfig
  )
end

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

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