# 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.Connectors.V2.Model.Query do
  @moduledoc """
  A wrapper around the SQL query statement. This is needed so that the JSON representation of ExecuteSqlQueryRequest has the following format: `{"query":"select *"}`.

  ## Attributes

  *   `maxRows` (*type:* `String.t`, *default:* `nil`) - Sets the limit for the maximum number of rows returned after the query execution.
  *   `query` (*type:* `String.t`, *default:* `nil`) - Required. Sql query to execute.
  *   `queryParameters` (*type:* `list(GoogleApi.Connectors.V2.Model.QueryParameter.t)`, *default:* `nil`) - In the struct, the value corresponds to the value of query parameter and date type corresponds to the date type of the query parameter.
  *   `timeout` (*type:* `String.t`, *default:* `nil`) - Sets the number of seconds the driver will wait for a query to execute.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :maxRows => String.t() | nil,
          :query => String.t() | nil,
          :queryParameters => list(GoogleApi.Connectors.V2.Model.QueryParameter.t()) | nil,
          :timeout => String.t() | nil
        }

  field(:maxRows)
  field(:query)
  field(:queryParameters, as: GoogleApi.Connectors.V2.Model.QueryParameter, type: :list)
  field(:timeout)
end

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

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