# 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.GoogleCloudRetailV2Rule do
  @moduledoc """
  A rule is a condition-action pair * A condition defines when a rule is to be triggered. * An action specifies what occurs on that trigger. Currently rules only work for controls with SOLUTION_TYPE_SEARCH.

  ## Attributes

  *   `boostAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleBoostAction.t`, *default:* `nil`) - A boost action.
  *   `condition` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2Condition.t`, *default:* `nil`) - Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.
  *   `doNotAssociateAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleDoNotAssociateAction.t`, *default:* `nil`) - Prevents term from being associated with other terms.
  *   `filterAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleFilterAction.t`, *default:* `nil`) - Filters results.
  *   `forceReturnFacetAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleForceReturnFacetAction.t`, *default:* `nil`) - Force returns an attribute as a facet in the request.
  *   `ignoreAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleIgnoreAction.t`, *default:* `nil`) - Ignores specific terms from query during search.
  *   `onewaySynonymsAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleOnewaySynonymsAction.t`, *default:* `nil`) - Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term.
  *   `pinAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RulePinAction.t`, *default:* `nil`) - Pins one or more specified products to a specific position in the results.
  *   `redirectAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleRedirectAction.t`, *default:* `nil`) - Redirects a shopper to a specific page.
  *   `removeFacetAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleRemoveFacetAction.t`, *default:* `nil`) - Remove an attribute as a facet in the request (if present).
  *   `replacementAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleReplacementAction.t`, *default:* `nil`) - Replaces specific terms in the query.
  *   `twowaySynonymsAction` (*type:* `GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleTwowaySynonymsAction.t`, *default:* `nil`) - Treats a set of terms as synonyms of one another.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :boostAction => GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleBoostAction.t() | nil,
          :condition => GoogleApi.Retail.V2.Model.GoogleCloudRetailV2Condition.t() | nil,
          :doNotAssociateAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleDoNotAssociateAction.t() | nil,
          :filterAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleFilterAction.t() | nil,
          :forceReturnFacetAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleForceReturnFacetAction.t() | nil,
          :ignoreAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleIgnoreAction.t() | nil,
          :onewaySynonymsAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleOnewaySynonymsAction.t() | nil,
          :pinAction => GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RulePinAction.t() | nil,
          :redirectAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleRedirectAction.t() | nil,
          :removeFacetAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleRemoveFacetAction.t() | nil,
          :replacementAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleReplacementAction.t() | nil,
          :twowaySynonymsAction =>
            GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleTwowaySynonymsAction.t() | nil
        }

  field(:boostAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleBoostAction)
  field(:condition, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2Condition)

  field(:doNotAssociateAction,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleDoNotAssociateAction
  )

  field(:filterAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleFilterAction)

  field(:forceReturnFacetAction,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleForceReturnFacetAction
  )

  field(:ignoreAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleIgnoreAction)

  field(:onewaySynonymsAction,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleOnewaySynonymsAction
  )

  field(:pinAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RulePinAction)
  field(:redirectAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleRedirectAction)

  field(:removeFacetAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleRemoveFacetAction)

  field(:replacementAction, as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleReplacementAction)

  field(:twowaySynonymsAction,
    as: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2RuleTwowaySynonymsAction
  )
end

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

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