# 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.Batch.V1.Model.AgentTask do
  @moduledoc """
  TODO(b/182501497) The message needs to be redefined when the Agent API server updates data in storage per the backend design.

  ## Attributes

  *   `agentTaskSpec` (*type:* `GoogleApi.Batch.V1.Model.AgentTaskSpec.t`, *default:* `nil`) - AgentTaskSpec is the taskSpec representation between Agent and CLH communication. This field will replace the TaskSpec field above in future to have a better separation between user-facaing API and internal API.
  *   `intendedState` (*type:* `String.t`, *default:* `nil`) - The intended state of the task.
  *   `reachedBarrier` (*type:* `String.t`, *default:* `nil`) - The highest barrier reached by all tasks in the task's TaskGroup.
  *   `spec` (*type:* `GoogleApi.Batch.V1.Model.TaskSpec.t`, *default:* `nil`) - Task Spec. This field will be replaced by agent_task_spec below in future.
  *   `status` (*type:* `GoogleApi.Batch.V1.Model.TaskStatus.t`, *default:* `nil`) - Task status.
  *   `task` (*type:* `String.t`, *default:* `nil`) - Task name.
  *   `taskSource` (*type:* `String.t`, *default:* `nil`) - TaskSource represents the source of the task.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :agentTaskSpec => GoogleApi.Batch.V1.Model.AgentTaskSpec.t() | nil,
          :intendedState => String.t() | nil,
          :reachedBarrier => String.t() | nil,
          :spec => GoogleApi.Batch.V1.Model.TaskSpec.t() | nil,
          :status => GoogleApi.Batch.V1.Model.TaskStatus.t() | nil,
          :task => String.t() | nil,
          :taskSource => String.t() | nil
        }

  field(:agentTaskSpec, as: GoogleApi.Batch.V1.Model.AgentTaskSpec)
  field(:intendedState)
  field(:reachedBarrier)
  field(:spec, as: GoogleApi.Batch.V1.Model.TaskSpec)
  field(:status, as: GoogleApi.Batch.V1.Model.TaskStatus)
  field(:task)
  field(:taskSource)
end

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

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