# 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.AnalyticsReporting.V4.Model.Pivot do
  @moduledoc """
  The Pivot describes the pivot section in the request. The Pivot helps rearrange the information in the table for certain reports by pivoting your data on a second dimension.

  ## Attributes

  *   `dimensionFilterClauses` (*type:* `list(GoogleApi.AnalyticsReporting.V4.Model.DimensionFilterClause.t)`, *default:* `nil`) - DimensionFilterClauses are logically combined with an `AND` operator: only data that is included by all these DimensionFilterClauses contributes to the values in this pivot region. Dimension filters can be used to restrict the columns shown in the pivot region. For example if you have `ga:browser` as the requested dimension in the pivot region, and you specify key filters to restrict `ga:browser` to only "IE" or "Firefox", then only those two browsers would show up as columns.
  *   `dimensions` (*type:* `list(GoogleApi.AnalyticsReporting.V4.Model.Dimension.t)`, *default:* `nil`) - A list of dimensions to show as pivot columns. A Pivot can have a maximum of 4 dimensions. Pivot dimensions are part of the restriction on the total number of dimensions allowed in the request.
  *   `maxGroupCount` (*type:* `integer()`, *default:* `nil`) - Specifies the maximum number of groups to return. The default value is 10, also the maximum value is 1,000.
  *   `metrics` (*type:* `list(GoogleApi.AnalyticsReporting.V4.Model.Metric.t)`, *default:* `nil`) - The pivot metrics. Pivot metrics are part of the restriction on total number of metrics allowed in the request.
  *   `startGroup` (*type:* `integer()`, *default:* `nil`) - If k metrics were requested, then the response will contain some data-dependent multiple of k columns in the report. E.g., if you pivoted on the dimension `ga:browser` then you'd get k columns for "Firefox", k columns for "IE", k columns for "Chrome", etc. The ordering of the groups of columns is determined by descending order of "total" for the first of the k values. Ties are broken by lexicographic ordering of the first pivot dimension, then lexicographic ordering of the second pivot dimension, and so on. E.g., if the totals for the first value for Firefox, IE, and Chrome were 8, 2, 8, respectively, the order of columns would be Chrome, Firefox, IE. The following let you choose which of the groups of k columns are included in the response.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dimensionFilterClauses =>
            list(GoogleApi.AnalyticsReporting.V4.Model.DimensionFilterClause.t()) | nil,
          :dimensions => list(GoogleApi.AnalyticsReporting.V4.Model.Dimension.t()) | nil,
          :maxGroupCount => integer() | nil,
          :metrics => list(GoogleApi.AnalyticsReporting.V4.Model.Metric.t()) | nil,
          :startGroup => integer() | nil
        }

  field(:dimensionFilterClauses,
    as: GoogleApi.AnalyticsReporting.V4.Model.DimensionFilterClause,
    type: :list
  )

  field(:dimensions, as: GoogleApi.AnalyticsReporting.V4.Model.Dimension, type: :list)
  field(:maxGroupCount)
  field(:metrics, as: GoogleApi.AnalyticsReporting.V4.Model.Metric, type: :list)
  field(:startGroup)
end

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

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