# 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.CloudSearch.V1.Model.Filter do
  @moduledoc """
  A generic way of expressing filters in a query, which supports two approaches: **1. Setting a ValueFilter.** The name must match an operator_name defined in the schema for your data source. **2. Setting a CompositeFilter.** The filters are evaluated using the logical operator. The top-level operators can only be either an AND or a NOT. AND can appear only at the top-most level. OR can appear only under a top-level AND.

  ## Attributes

  *   `compositeFilter` (*type:* `GoogleApi.CloudSearch.V1.Model.CompositeFilter.t`, *default:* `nil`) - 
  *   `valueFilter` (*type:* `GoogleApi.CloudSearch.V1.Model.ValueFilter.t`, *default:* `nil`) - 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :compositeFilter => GoogleApi.CloudSearch.V1.Model.CompositeFilter.t() | nil,
          :valueFilter => GoogleApi.CloudSearch.V1.Model.ValueFilter.t() | nil
        }

  field(:compositeFilter, as: GoogleApi.CloudSearch.V1.Model.CompositeFilter)
  field(:valueFilter, as: GoogleApi.CloudSearch.V1.Model.ValueFilter)
end

defimpl Poison.Decoder, for: GoogleApi.CloudSearch.V1.Model.Filter do
  def decode(value, options) do
    GoogleApi.CloudSearch.V1.Model.Filter.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudSearch.V1.Model.Filter do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
