# 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.Sheets.V4.Model.DataSourceTable do
  @moduledoc """
  A data source table, which allows the user to import a static table of data from the DataSource into Sheets. This is also known as "Extract" in the Sheets editor.

  ## Attributes

  *   `columnSelectionType` (*type:* `String.t`, *default:* `nil`) - The type to select columns for the data source table. Defaults to SELECTED.
  *   `columns` (*type:* `list(GoogleApi.Sheets.V4.Model.DataSourceColumnReference.t)`, *default:* `nil`) - Columns selected for the data source table. The column_selection_type must be SELECTED.
  *   `dataExecutionStatus` (*type:* `GoogleApi.Sheets.V4.Model.DataExecutionStatus.t`, *default:* `nil`) - Output only. The data execution status.
  *   `dataSourceId` (*type:* `String.t`, *default:* `nil`) - The ID of the data source the data source table is associated with.
  *   `filterSpecs` (*type:* `list(GoogleApi.Sheets.V4.Model.FilterSpec.t)`, *default:* `nil`) - Filter specifications in the data source table.
  *   `rowLimit` (*type:* `integer()`, *default:* `nil`) - The limit of rows to return. If not set, a default limit is applied. Please refer to the Sheets editor for the default and max limit.
  *   `sortSpecs` (*type:* `list(GoogleApi.Sheets.V4.Model.SortSpec.t)`, *default:* `nil`) - Sort specifications in the data source table. The result of the data source table is sorted based on the sort specifications in order.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :columnSelectionType => String.t() | nil,
          :columns => list(GoogleApi.Sheets.V4.Model.DataSourceColumnReference.t()) | nil,
          :dataExecutionStatus => GoogleApi.Sheets.V4.Model.DataExecutionStatus.t() | nil,
          :dataSourceId => String.t() | nil,
          :filterSpecs => list(GoogleApi.Sheets.V4.Model.FilterSpec.t()) | nil,
          :rowLimit => integer() | nil,
          :sortSpecs => list(GoogleApi.Sheets.V4.Model.SortSpec.t()) | nil
        }

  field(:columnSelectionType)
  field(:columns, as: GoogleApi.Sheets.V4.Model.DataSourceColumnReference, type: :list)
  field(:dataExecutionStatus, as: GoogleApi.Sheets.V4.Model.DataExecutionStatus)
  field(:dataSourceId)
  field(:filterSpecs, as: GoogleApi.Sheets.V4.Model.FilterSpec, type: :list)
  field(:rowLimit)
  field(:sortSpecs, as: GoogleApi.Sheets.V4.Model.SortSpec, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.Sheets.V4.Model.DataSourceTable do
  def decode(value, options) do
    GoogleApi.Sheets.V4.Model.DataSourceTable.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Sheets.V4.Model.DataSourceTable do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
