# 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.Job do
  @moduledoc """
  The Cloud Batch Job description.

  ## Attributes

  *   `allocationPolicy` (*type:* `GoogleApi.Batch.V1.Model.AllocationPolicy.t`, *default:* `nil`) - Compute resource allocation for all TaskGroups in the Job.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. When the Job was created.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Custom labels to apply to the job and any Cloud Logging [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) that it generates. Use labels to group and describe the resources they are applied to. Batch automatically applies predefined labels and supports multiple `labels` fields for each job, which each let you apply custom labels to various resources. Label names that start with "goog-" or "google-" are reserved for predefined labels. For more information about labels with Batch, see [Organize resources using labels](https://cloud.google.com/batch/docs/organize-resources-using-labels).
  *   `logsPolicy` (*type:* `GoogleApi.Batch.V1.Model.LogsPolicy.t`, *default:* `nil`) - Log preservation policy for the Job.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Job name. For example: "projects/123456/locations/us-central1/jobs/job01".
  *   `notifications` (*type:* `list(GoogleApi.Batch.V1.Model.JobNotification.t)`, *default:* `nil`) - Notification configurations.
  *   `priority` (*type:* `String.t`, *default:* `nil`) - Priority of the Job. The valid value range is [0, 100). Default value is 0. Higher value indicates higher priority. A job with higher priority value is more likely to run earlier if all other requirements are satisfied.
  *   `status` (*type:* `GoogleApi.Batch.V1.Model.JobStatus.t`, *default:* `nil`) - Output only. Job status. It is read only for users.
  *   `taskGroups` (*type:* `list(GoogleApi.Batch.V1.Model.TaskGroup.t)`, *default:* `nil`) - Required. TaskGroups in the Job. Only one TaskGroup is supported now.
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. A system generated unique ID for the Job.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The last time the Job was updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allocationPolicy => GoogleApi.Batch.V1.Model.AllocationPolicy.t() | nil,
          :createTime => DateTime.t() | nil,
          :labels => map() | nil,
          :logsPolicy => GoogleApi.Batch.V1.Model.LogsPolicy.t() | nil,
          :name => String.t() | nil,
          :notifications => list(GoogleApi.Batch.V1.Model.JobNotification.t()) | nil,
          :priority => String.t() | nil,
          :status => GoogleApi.Batch.V1.Model.JobStatus.t() | nil,
          :taskGroups => list(GoogleApi.Batch.V1.Model.TaskGroup.t()) | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:allocationPolicy, as: GoogleApi.Batch.V1.Model.AllocationPolicy)
  field(:createTime, as: DateTime)
  field(:labels, type: :map)
  field(:logsPolicy, as: GoogleApi.Batch.V1.Model.LogsPolicy)
  field(:name)
  field(:notifications, as: GoogleApi.Batch.V1.Model.JobNotification, type: :list)
  field(:priority)
  field(:status, as: GoogleApi.Batch.V1.Model.JobStatus)
  field(:taskGroups, as: GoogleApi.Batch.V1.Model.TaskGroup, type: :list)
  field(:uid)
  field(:updateTime, as: DateTime)
end

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

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