# 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.Classroom.V1.Model.GradeCategory do
  @moduledoc """
  Details for a grade category in a course. Coursework may have zero or one grade category, and the category may be used in computing the overall grade. See the [help center article](https://support.google.com/edu/classroom/answer/9184995) for details.

  ## Attributes

  *   `defaultGradeDenominator` (*type:* `integer()`, *default:* `nil`) - Default value of denominator. Only applicable when grade calculation type is TOTAL_POINTS.
  *   `id` (*type:* `String.t`, *default:* `nil`) - ID of the grade category.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Name of the grade category.
  *   `weight` (*type:* `integer()`, *default:* `nil`) - The weight of the category average as part of overall average. A weight of 12.34% is represented as 123400 (100% is 1,000,000). The last two digits should always be zero since we use two decimal precision. Only applicable when grade calculation type is WEIGHTED_CATEGORIES.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :defaultGradeDenominator => integer() | nil,
          :id => String.t() | nil,
          :name => String.t() | nil,
          :weight => integer() | nil
        }

  field(:defaultGradeDenominator)
  field(:id)
  field(:name)
  field(:weight)
end

defimpl Poison.Decoder, for: GoogleApi.Classroom.V1.Model.GradeCategory do
  def decode(value, options) do
    GoogleApi.Classroom.V1.Model.GradeCategory.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Classroom.V1.Model.GradeCategory do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
