# 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.BuildBazelRemoteExecutionV2ExecutedActionMetadata do
  @moduledoc """
  ExecutedActionMetadata contains details about a completed execution.

  ## Attributes

  *   `auxiliaryMetadata` (*type:* `list(map())`, *default:* `nil`) - Details that are specific to the kind of worker used. For example, on POSIX-like systems this could contain a message with getrusage(2) statistics.
  *   `executionCompletedTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker completed executing the action command.
  *   `executionStartTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker started executing the action command.
  *   `inputFetchCompletedTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker finished fetching action inputs.
  *   `inputFetchStartTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker started fetching action inputs.
  *   `outputUploadCompletedTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker finished uploading action outputs.
  *   `outputUploadStartTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker started uploading action outputs.
  *   `queuedTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When was the action added to the queue.
  *   `worker` (*type:* `String.t`, *default:* `nil`) - The name of the worker which ran the execution.
  *   `workerCompletedTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker completed the action, including all stages.
  *   `workerStartTimestamp` (*type:* `DateTime.t`, *default:* `nil`) - When the worker received the action.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :auxiliaryMetadata => list(map()) | nil,
          :executionCompletedTimestamp => DateTime.t() | nil,
          :executionStartTimestamp => DateTime.t() | nil,
          :inputFetchCompletedTimestamp => DateTime.t() | nil,
          :inputFetchStartTimestamp => DateTime.t() | nil,
          :outputUploadCompletedTimestamp => DateTime.t() | nil,
          :outputUploadStartTimestamp => DateTime.t() | nil,
          :queuedTimestamp => DateTime.t() | nil,
          :worker => String.t() | nil,
          :workerCompletedTimestamp => DateTime.t() | nil,
          :workerStartTimestamp => DateTime.t() | nil
        }

  field(:auxiliaryMetadata, type: :list)
  field(:executionCompletedTimestamp, as: DateTime)
  field(:executionStartTimestamp, as: DateTime)
  field(:inputFetchCompletedTimestamp, as: DateTime)
  field(:inputFetchStartTimestamp, as: DateTime)
  field(:outputUploadCompletedTimestamp, as: DateTime)
  field(:outputUploadStartTimestamp, as: DateTime)
  field(:queuedTimestamp, as: DateTime)
  field(:worker)
  field(:workerCompletedTimestamp, as: DateTime)
  field(:workerStartTimestamp, as: DateTime)
end

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

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