# 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.Chat.V1.Model.DeprecatedEvent do
  @moduledoc """
  A Google Chat app interaction event that represents and contains data about a user's interaction with a Chat app. To configure your Chat app to receive interaction events, see [Receive and respond to user interactions](https://developers.google.com/workspace/chat/receive-respond-interactions). In addition to receiving events from user interactions, Chat apps can receive events about changes to spaces, such as when a new member is added to a space. To learn about space events, see [Work with events from Google Chat](https://developers.google.com/workspace/chat/events-overview).

  ## Attributes

  *   `action` (*type:* `GoogleApi.Chat.V1.Model.FormAction.t`, *default:* `nil`) - For `CARD_CLICKED` interaction events, the form action data associated when a user clicks a card or dialog. To learn more, see [Read form data input by users on cards](https://developers.google.com/workspace/chat/read-form-data).
  *   `appCommandMetadata` (*type:* `GoogleApi.Chat.V1.Model.AppCommandMetadata.t`, *default:* `nil`) - Metadata about a Chat app command.
  *   `common` (*type:* `GoogleApi.Chat.V1.Model.CommonEventObject.t`, *default:* `nil`) - Represents information about the user's client, such as locale, host app, and platform. For Chat apps, `CommonEventObject` includes information submitted by users interacting with [dialogs](https://developers.google.com/workspace/chat/dialogs), like data entered on a card.
  *   `configCompleteRedirectUrl` (*type:* `String.t`, *default:* `nil`) - This URL is populated for `MESSAGE`, `ADDED_TO_SPACE`, and `APP_COMMAND` interaction events. After completing an authorization or configuration flow outside of Google Chat, users must be redirected to this URL to signal to Google Chat that the authorization or configuration flow was successful. For more information, see [Connect a Chat app with other services and tools](https://developers.google.com/workspace/chat/connect-web-services-tools).
  *   `dialogEventType` (*type:* `String.t`, *default:* `nil`) - The type of [dialog](https://developers.google.com/workspace/chat/dialogs) interaction event received.
  *   `eventTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp indicating when the interaction event occurred.
  *   `isDialogEvent` (*type:* `boolean()`, *default:* `nil`) - For `CARD_CLICKED` and `MESSAGE` interaction events, whether the user is interacting with or about to interact with a [dialog](https://developers.google.com/workspace/chat/dialogs).
  *   `message` (*type:* `GoogleApi.Chat.V1.Model.Message.t`, *default:* `nil`) - For `ADDED_TO_SPACE`, `CARD_CLICKED`, and `MESSAGE` interaction events, the message that triggered the interaction event, if applicable.
  *   `space` (*type:* `GoogleApi.Chat.V1.Model.Space.t`, *default:* `nil`) - The space in which the user interacted with the Chat app.
  *   `thread` (*type:* `GoogleApi.Chat.V1.Model.Thread.t`, *default:* `nil`) - The thread in which the user interacted with the Chat app. This could be in a new thread created by a newly sent message. This field is populated if the interaction event is associated with a specific message or thread.
  *   `threadKey` (*type:* `String.t`, *default:* `nil`) - The Chat app-defined key for the thread related to the interaction event. See [`spaces.messages.thread.threadKey`](/chat/api/reference/rest/v1/spaces.messages#Thread.FIELDS.thread_key) for more information.
  *   `token` (*type:* `String.t`, *default:* `nil`) - A secret value that legacy Chat apps can use to verify if a request is from Google. Google randomly generates the token, and its value remains static. You can obtain, revoke, or regenerate the token from the [Chat API configuration page](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat) in the Google Cloud Console. Modern Chat apps don't use this field. It is absent from API responses and the [Chat API configuration page](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat).
  *   `type` (*type:* `String.t`, *default:* `nil`) - The [type](/workspace/chat/api/reference/rest/v1/EventType) of user interaction with the Chat app, such as `MESSAGE` or `ADDED_TO_SPACE`.
  *   `user` (*type:* `GoogleApi.Chat.V1.Model.User.t`, *default:* `nil`) - The user that interacted with the Chat app.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :action => GoogleApi.Chat.V1.Model.FormAction.t() | nil,
          :appCommandMetadata => GoogleApi.Chat.V1.Model.AppCommandMetadata.t() | nil,
          :common => GoogleApi.Chat.V1.Model.CommonEventObject.t() | nil,
          :configCompleteRedirectUrl => String.t() | nil,
          :dialogEventType => String.t() | nil,
          :eventTime => DateTime.t() | nil,
          :isDialogEvent => boolean() | nil,
          :message => GoogleApi.Chat.V1.Model.Message.t() | nil,
          :space => GoogleApi.Chat.V1.Model.Space.t() | nil,
          :thread => GoogleApi.Chat.V1.Model.Thread.t() | nil,
          :threadKey => String.t() | nil,
          :token => String.t() | nil,
          :type => String.t() | nil,
          :user => GoogleApi.Chat.V1.Model.User.t() | nil
        }

  field(:action, as: GoogleApi.Chat.V1.Model.FormAction)
  field(:appCommandMetadata, as: GoogleApi.Chat.V1.Model.AppCommandMetadata)
  field(:common, as: GoogleApi.Chat.V1.Model.CommonEventObject)
  field(:configCompleteRedirectUrl)
  field(:dialogEventType)
  field(:eventTime, as: DateTime)
  field(:isDialogEvent)
  field(:message, as: GoogleApi.Chat.V1.Model.Message)
  field(:space, as: GoogleApi.Chat.V1.Model.Space)
  field(:thread, as: GoogleApi.Chat.V1.Model.Thread)
  field(:threadKey)
  field(:token)
  field(:type)
  field(:user, as: GoogleApi.Chat.V1.Model.User)
end

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

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