# 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.ScorecardChartSpec do
  @moduledoc """
  A scorecard chart. Scorecard charts are used to highlight key performance indicators, known as KPIs, on the spreadsheet. A scorecard chart can represent things like total sales, average cost, or a top selling item. You can specify a single data value, or aggregate over a range of data. Percentage or absolute difference from a baseline value can be highlighted, like changes over time.

  ## Attributes

  *   `aggregateType` (*type:* `String.t`, *default:* `nil`) - The aggregation type for key and baseline chart data in scorecard chart. This field is not supported for data source charts. Use the ChartData.aggregateType field of the key_value_data or baseline_value_data instead for data source charts. This field is optional.
  *   `baselineValueData` (*type:* `GoogleApi.Sheets.V4.Model.ChartData.t`, *default:* `nil`) - The data for scorecard baseline value. This field is optional.
  *   `baselineValueFormat` (*type:* `GoogleApi.Sheets.V4.Model.BaselineValueFormat.t`, *default:* `nil`) - Formatting options for baseline value. This field is needed only if baseline_value_data is specified.
  *   `customFormatOptions` (*type:* `GoogleApi.Sheets.V4.Model.ChartCustomNumberFormatOptions.t`, *default:* `nil`) - Custom formatting options for numeric key/baseline values in scorecard chart. This field is used only when number_format_source is set to CUSTOM. This field is optional.
  *   `keyValueData` (*type:* `GoogleApi.Sheets.V4.Model.ChartData.t`, *default:* `nil`) - The data for scorecard key value.
  *   `keyValueFormat` (*type:* `GoogleApi.Sheets.V4.Model.KeyValueFormat.t`, *default:* `nil`) - Formatting options for key value.
  *   `numberFormatSource` (*type:* `String.t`, *default:* `nil`) - The number format source used in the scorecard chart. This field is optional.
  *   `scaleFactor` (*type:* `float()`, *default:* `nil`) - Value to scale scorecard key and baseline value. For example, a factor of 10 can be used to divide all values in the chart by 10. This field is optional.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :aggregateType => String.t() | nil,
          :baselineValueData => GoogleApi.Sheets.V4.Model.ChartData.t() | nil,
          :baselineValueFormat => GoogleApi.Sheets.V4.Model.BaselineValueFormat.t() | nil,
          :customFormatOptions =>
            GoogleApi.Sheets.V4.Model.ChartCustomNumberFormatOptions.t() | nil,
          :keyValueData => GoogleApi.Sheets.V4.Model.ChartData.t() | nil,
          :keyValueFormat => GoogleApi.Sheets.V4.Model.KeyValueFormat.t() | nil,
          :numberFormatSource => String.t() | nil,
          :scaleFactor => float() | nil
        }

  field(:aggregateType)
  field(:baselineValueData, as: GoogleApi.Sheets.V4.Model.ChartData)
  field(:baselineValueFormat, as: GoogleApi.Sheets.V4.Model.BaselineValueFormat)
  field(:customFormatOptions, as: GoogleApi.Sheets.V4.Model.ChartCustomNumberFormatOptions)
  field(:keyValueData, as: GoogleApi.Sheets.V4.Model.ChartData)
  field(:keyValueFormat, as: GoogleApi.Sheets.V4.Model.KeyValueFormat)
  field(:numberFormatSource)
  field(:scaleFactor)
end

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

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