# 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.Sheets.V4.Model.DataExecutionStatus do
  @moduledoc """
  The data execution status. A data execution is created to sync a data source object with the latest data from a DataSource. It is usually scheduled to run at background, you can check its state to tell if an execution completes There are several scenarios where a data execution is triggered to run: * Adding a data source creates an associated data source sheet as well as a data execution to sync the data from the data source to the sheet. * Updating a data source creates a data execution to refresh the associated data source sheet similarly. * You can send refresh request to explicitly refresh one or multiple data source objects.

  ## Attributes

  *   `errorCode` (*type:* `String.t`, *default:* `nil`) - The error code.
  *   `errorMessage` (*type:* `String.t`, *default:* `nil`) - The error message, which may be empty.
  *   `lastRefreshTime` (*type:* `DateTime.t`, *default:* `nil`) - Gets the time the data last successfully refreshed.
  *   `state` (*type:* `String.t`, *default:* `nil`) - The state of the data execution.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :errorCode => String.t() | nil,
          :errorMessage => String.t() | nil,
          :lastRefreshTime => DateTime.t() | nil,
          :state => String.t() | nil
        }

  field(:errorCode)
  field(:errorMessage)
  field(:lastRefreshTime, as: DateTime)
  field(:state)
end

defimpl Poison.Decoder, for: GoogleApi.Sheets.V4.Model.DataExecutionStatus do
  def decode(value, options) do
    GoogleApi.Sheets.V4.Model.DataExecutionStatus.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Sheets.V4.Model.DataExecutionStatus do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
