# 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.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildbotCommandDurations do
  @moduledoc """
  CommandDuration contains the various duration metrics tracked when a bot performs a command.

  ## Attributes

  *   `casRelease` (*type:* `String.t`, *default:* `nil`) - The time spent to release the CAS blobs used by the task.
  *   `cmWaitForAssignment` (*type:* `String.t`, *default:* `nil`) - The time spent waiting for Container Manager to assign an asynchronous container for execution.
  *   `dockerPrep` (*type:* `String.t`, *default:* `nil`) - The time spent preparing the command to be run in a Docker container (includes pulling the Docker image, if necessary).
  *   `dockerPrepStartTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp when docker preparation begins.
  *   `download` (*type:* `String.t`, *default:* `nil`) - The time spent downloading the input files and constructing the working directory.
  *   `downloadStartTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp when downloading the input files begins.
  *   `execStartTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp when execution begins.
  *   `execution` (*type:* `String.t`, *default:* `nil`) - The time spent executing the command (i.e., doing useful work).
  *   `isoPrepDone` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp when preparation is done and bot starts downloading files.
  *   `overall` (*type:* `String.t`, *default:* `nil`) - The time spent completing the command, in total.
  *   `stdout` (*type:* `String.t`, *default:* `nil`) - The time spent uploading the stdout logs.
  *   `upload` (*type:* `String.t`, *default:* `nil`) - The time spent uploading the output files.
  *   `uploadStartTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp when uploading the output files begins.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :casRelease => String.t() | nil,
          :cmWaitForAssignment => String.t() | nil,
          :dockerPrep => String.t() | nil,
          :dockerPrepStartTime => DateTime.t() | nil,
          :download => String.t() | nil,
          :downloadStartTime => DateTime.t() | nil,
          :execStartTime => DateTime.t() | nil,
          :execution => String.t() | nil,
          :isoPrepDone => DateTime.t() | nil,
          :overall => String.t() | nil,
          :stdout => String.t() | nil,
          :upload => String.t() | nil,
          :uploadStartTime => DateTime.t() | nil
        }

  field(:casRelease)
  field(:cmWaitForAssignment)
  field(:dockerPrep)
  field(:dockerPrepStartTime, as: DateTime)
  field(:download)
  field(:downloadStartTime, as: DateTime)
  field(:execStartTime, as: DateTime)
  field(:execution)
  field(:isoPrepDone, as: DateTime)
  field(:overall)
  field(:stdout)
  field(:upload)
  field(:uploadStartTime, as: DateTime)
end

defimpl Poison.Decoder,
  for: GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildbotCommandDurations do
  def decode(value, options) do
    GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildbotCommandDurations.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildbotCommandDurations do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
