# 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.CloudTrace.V1.Model.Trace do
  @moduledoc """
  A trace describes how long it takes for an application to perform an operation. It consists of a set of spans, each of which represent a single timed event within the operation.

  ## Attributes

  *   `projectId` (*type:* `String.t`, *default:* `nil`) - Project ID of the Cloud project where the trace data is stored.
  *   `spans` (*type:* `list(GoogleApi.CloudTrace.V1.Model.TraceSpan.t)`, *default:* `nil`) - Collection of spans in the trace.
  *   `traceId` (*type:* `String.t`, *default:* `nil`) - Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string. For example, `382d4f4c6b7bb2f4a972559d9085001d`. The numeric value should not be zero.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :projectId => String.t() | nil,
          :spans => list(GoogleApi.CloudTrace.V1.Model.TraceSpan.t()) | nil,
          :traceId => String.t() | nil
        }

  field(:projectId)
  field(:spans, as: GoogleApi.CloudTrace.V1.Model.TraceSpan, type: :list)
  field(:traceId)
end

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

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