# 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.Fitness.V1.Model.Value do
  @moduledoc """
  Holder object for the value of a single field in a data point. A field value has a particular format and is only ever set to one of an integer or a floating point value.

  ## Attributes

  *   `fpVal` (*type:* `float()`, *default:* `nil`) - Floating point value. When this is set, other values must not be set.
  *   `intVal` (*type:* `integer()`, *default:* `nil`) - Integer value. When this is set, other values must not be set.
  *   `mapVal` (*type:* `list(GoogleApi.Fitness.V1.Model.ValueMapValEntry.t)`, *default:* `nil`) - Map value. The valid key space and units for the corresponding value of each entry should be documented as part of the data type definition. Keys should be kept small whenever possible. Data streams with large keys and high data frequency may be down sampled.
  *   `stringVal` (*type:* `String.t`, *default:* `nil`) - String value. When this is set, other values must not be set. Strings should be kept small whenever possible. Data streams with large string values and high data frequency may be down sampled.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :fpVal => float() | nil,
          :intVal => integer() | nil,
          :mapVal => list(GoogleApi.Fitness.V1.Model.ValueMapValEntry.t()) | nil,
          :stringVal => String.t() | nil
        }

  field(:fpVal)
  field(:intVal)
  field(:mapVal, as: GoogleApi.Fitness.V1.Model.ValueMapValEntry, type: :list)
  field(:stringVal)
end

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

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