# 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.Datastore.V1.Model.RunQueryRequest do
  @moduledoc """
  The request for Datastore.RunQuery.

  ## Attributes

  *   `databaseId` (*type:* `String.t`, *default:* `nil`) - The ID of the database against which to make the request. '(default)' is not allowed; please use empty string '' to refer the default database.
  *   `explainOptions` (*type:* `GoogleApi.Datastore.V1.Model.ExplainOptions.t`, *default:* `nil`) - Optional. Explain options for the query. If set, additional query statistics will be returned. If not, only query results will be returned.
  *   `gqlQuery` (*type:* `GoogleApi.Datastore.V1.Model.GqlQuery.t`, *default:* `nil`) - The GQL query to run. This query must be a non-aggregation query.
  *   `partitionId` (*type:* `GoogleApi.Datastore.V1.Model.PartitionId.t`, *default:* `nil`) - Entities are partitioned into subsets, identified by a partition ID. Queries are scoped to a single partition. This partition ID is normalized with the standard default context partition ID.
  *   `propertyMask` (*type:* `GoogleApi.Datastore.V1.Model.PropertyMask.t`, *default:* `nil`) - The properties to return. This field must not be set for a projection query. See LookupRequest.property_mask.
  *   `query` (*type:* `GoogleApi.Datastore.V1.Model.Query.t`, *default:* `nil`) - The query to run.
  *   `readOptions` (*type:* `GoogleApi.Datastore.V1.Model.ReadOptions.t`, *default:* `nil`) - The options for this query.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :databaseId => String.t() | nil,
          :explainOptions => GoogleApi.Datastore.V1.Model.ExplainOptions.t() | nil,
          :gqlQuery => GoogleApi.Datastore.V1.Model.GqlQuery.t() | nil,
          :partitionId => GoogleApi.Datastore.V1.Model.PartitionId.t() | nil,
          :propertyMask => GoogleApi.Datastore.V1.Model.PropertyMask.t() | nil,
          :query => GoogleApi.Datastore.V1.Model.Query.t() | nil,
          :readOptions => GoogleApi.Datastore.V1.Model.ReadOptions.t() | nil
        }

  field(:databaseId)
  field(:explainOptions, as: GoogleApi.Datastore.V1.Model.ExplainOptions)
  field(:gqlQuery, as: GoogleApi.Datastore.V1.Model.GqlQuery)
  field(:partitionId, as: GoogleApi.Datastore.V1.Model.PartitionId)
  field(:propertyMask, as: GoogleApi.Datastore.V1.Model.PropertyMask)
  field(:query, as: GoogleApi.Datastore.V1.Model.Query)
  field(:readOptions, as: GoogleApi.Datastore.V1.Model.ReadOptions)
end

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

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