# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
# 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 &quot;AS IS&quot; 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 class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.

defmodule GoogleApi.Sheets.V4.Model.PivotGroupSortValueBucket do
  @moduledoc """
  Information about which values in a pivot group should be used for sorting.

  ## Attributes

  - buckets (List[ExtendedValue]): Determines the bucket from which values are chosen to sort.  For example, in a pivot table with one row group &amp; two column groups, the row group can list up to two values. The first value corresponds to a value within the first column group, and the second value corresponds to a value in the second column group.  If no values are listed, this would indicate that the row should be sorted according to the \&quot;Grand Total\&quot; over the column groups. If a single value is listed, this would correspond to using the \&quot;Total\&quot; of that bucket. Defaults to: `null`.
  - valuesIndex (Integer): The offset in the PivotTable.values list which the values in this grouping should be sorted by. Defaults to: `null`.
  """

  defstruct [
    :"buckets",
    :"valuesIndex"
  ]
end

defimpl Poison.Decoder, for: GoogleApi.Sheets.V4.Model.PivotGroupSortValueBucket do
  import GoogleApi.Sheets.V4.Deserializer
  def decode(value, options) do
    value
    |> deserialize(:"buckets", :list, GoogleApi.Sheets.V4.Model.ExtendedValue, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Sheets.V4.Model.PivotGroupSortValueBucket do
  def encode(value, options) do
    GoogleApi.Sheets.V4.Deserializer.serialize_non_nil(value, options)
  end
end

