# 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.TrafficDirector.V3.Model.ValueMatcher do
  @moduledoc """
  Specifies the way to match a ProtobufWkt::Value. Primitive values and ListValue are supported. StructValue is not supported and is always not matched. [#next-free-field: 8]

  ## Attributes

  *   `boolMatch` (*type:* `boolean()`, *default:* `nil`) - If specified, a match occurs if and only if the target value is a bool value and is equal to this field.
  *   `doubleMatch` (*type:* `GoogleApi.TrafficDirector.V3.Model.DoubleMatcher.t`, *default:* `nil`) - If specified, a match occurs if and only if the target value is a double value and is matched to this field.
  *   `listMatch` (*type:* `GoogleApi.TrafficDirector.V3.Model.ListMatcher.t`, *default:* `nil`) - If specified, a match occurs if and only if the target value is a list value and is matched to this field.
  *   `nullMatch` (*type:* `GoogleApi.TrafficDirector.V3.Model.NullMatch.t`, *default:* `nil`) - If specified, a match occurs if and only if the target value is a NullValue.
  *   `orMatch` (*type:* `GoogleApi.TrafficDirector.V3.Model.OrMatcher.t`, *default:* `nil`) - If specified, a match occurs if and only if any of the alternatives in the match accept the value.
  *   `presentMatch` (*type:* `boolean()`, *default:* `nil`) - If specified, value match will be performed based on whether the path is referring to a valid primitive value in the metadata. If the path is referring to a non-primitive value, the result is always not matched.
  *   `stringMatch` (*type:* `GoogleApi.TrafficDirector.V3.Model.StringMatcher.t`, *default:* `nil`) - If specified, a match occurs if and only if the target value is a string value and is matched to this field.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :boolMatch => boolean() | nil,
          :doubleMatch => GoogleApi.TrafficDirector.V3.Model.DoubleMatcher.t() | nil,
          :listMatch => GoogleApi.TrafficDirector.V3.Model.ListMatcher.t() | nil,
          :nullMatch => GoogleApi.TrafficDirector.V3.Model.NullMatch.t() | nil,
          :orMatch => GoogleApi.TrafficDirector.V3.Model.OrMatcher.t() | nil,
          :presentMatch => boolean() | nil,
          :stringMatch => GoogleApi.TrafficDirector.V3.Model.StringMatcher.t() | nil
        }

  field(:boolMatch)
  field(:doubleMatch, as: GoogleApi.TrafficDirector.V3.Model.DoubleMatcher)
  field(:listMatch, as: GoogleApi.TrafficDirector.V3.Model.ListMatcher)
  field(:nullMatch, as: GoogleApi.TrafficDirector.V3.Model.NullMatch)
  field(:orMatch, as: GoogleApi.TrafficDirector.V3.Model.OrMatcher)
  field(:presentMatch)
  field(:stringMatch, as: GoogleApi.TrafficDirector.V3.Model.StringMatcher)
end

defimpl Poison.Decoder, for: GoogleApi.TrafficDirector.V3.Model.ValueMatcher do
  def decode(value, options) do
    GoogleApi.TrafficDirector.V3.Model.ValueMatcher.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.TrafficDirector.V3.Model.ValueMatcher do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
