# 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.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionDetails do
  @moduledoc """
  Contains the details of the execution info of this event: this includes the tasks execution details plus the event execution statistics. Next available id: 11

  ## Attributes

  *   `eventAttemptStats` (*type:* `list(GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmEventbusProtoEventExecutionDetailsEventAttemptStats.t)`, *default:* `nil`) - 
  *   `eventExecutionSnapshot` (*type:* `list(GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionSnapshot.t)`, *default:* `nil`) - After snapshot migration, this field will no longer be populated, but old execution snapshots will still be accessible.
  *   `eventExecutionSnapshotsSize` (*type:* `String.t`, *default:* `nil`) - Total size of all event_execution_snapshots for an execution
  *   `eventExecutionState` (*type:* `String.t`, *default:* `nil`) - The execution state of this event.
  *   `eventRetriesFromBeginningCount` (*type:* `integer()`, *default:* `nil`) - Indicates the number of times the execution has restarted from the beginning.
  *   `logFilePath` (*type:* `String.t`, *default:* `nil`) - The log file path (aka. cns address) for this event.
  *   `networkAddress` (*type:* `String.t`, *default:* `nil`) - The network address (aka. bns address) that indicates where the event executor is running.
  *   `nextExecutionTime` (*type:* `String.t`, *default:* `nil`) - Next scheduled execution time in case the execution status was RETRY_ON_HOLD.
  *   `ryeLockUnheldCount` (*type:* `integer()`, *default:* `nil`) - Used internally and shouldn't be exposed to users. A counter for the cron job to record how many times this event is in in_process state but don't have a lock consecutively/
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :eventAttemptStats =>
            list(
              GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmEventbusProtoEventExecutionDetailsEventAttemptStats.t()
            )
            | nil,
          :eventExecutionSnapshot =>
            list(
              GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionSnapshot.t()
            )
            | nil,
          :eventExecutionSnapshotsSize => String.t() | nil,
          :eventExecutionState => String.t() | nil,
          :eventRetriesFromBeginningCount => integer() | nil,
          :logFilePath => String.t() | nil,
          :networkAddress => String.t() | nil,
          :nextExecutionTime => String.t() | nil,
          :ryeLockUnheldCount => integer() | nil
        }

  field(:eventAttemptStats,
    as:
      GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmEventbusProtoEventExecutionDetailsEventAttemptStats,
    type: :list
  )

  field(:eventExecutionSnapshot,
    as:
      GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionSnapshot,
    type: :list
  )

  field(:eventExecutionSnapshotsSize)
  field(:eventExecutionState)
  field(:eventRetriesFromBeginningCount)
  field(:logFilePath)
  field(:networkAddress)
  field(:nextExecutionTime)
  field(:ryeLockUnheldCount)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionDetails do
  def decode(value, options) do
    GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionDetails.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoEventExecutionDetails do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
