# 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.ManualRule do
  @moduledoc """
  Allows you to manually organize the values in a source data column into buckets with names of your choosing. For example, a pivot table that aggregates population by state: +-------+-------------------+ | State | SUM of Population | +-------+-------------------+ | AK | 0.7 | | AL | 4.8 | | AR | 2.9 | ... +-------+-------------------+ could be turned into a pivot table that aggregates population by time zone by providing a list of groups (for example, groupName = 'Central', items = ['AL', 'AR', 'IA', ...]) to a manual group rule. Note that a similar effect could be achieved by adding a time zone column to the source data and adjusting the pivot table. +-----------+-------------------+ | Time Zone | SUM of Population | +-----------+-------------------+ | Central | 106.3 | | Eastern | 151.9 | | Mountain | 17.4 | ... +-----------+-------------------+

  ## Attributes

  *   `groups` (*type:* `list(GoogleApi.Sheets.V4.Model.ManualRuleGroup.t)`, *default:* `nil`) - The list of group names and the corresponding items from the source data that map to each group name.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :groups => list(GoogleApi.Sheets.V4.Model.ManualRuleGroup.t()) | nil
        }

  field(:groups, as: GoogleApi.Sheets.V4.Model.ManualRuleGroup, type: :list)
end

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

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