# 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.GoogleAppsCardV1DecoratedText do
  @moduledoc """
  A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget, or a button after the text. For an example in Google Chat apps, see [Display text with decorative text](https://developers.google.com/workspace/chat/add-text-image-card-dialog#display_text_with_decorative_elements). [Google Workspace add-ons and Chat apps](https://developers.google.com/workspace/extend):

  ## Attributes

  *   `bottomLabel` (*type:* `String.t`, *default:* `nil`) - The text that appears below `text`. Always wraps.
  *   `button` (*type:* `GoogleApi.Chat.V1.Model.GoogleAppsCardV1Button.t`, *default:* `nil`) - A button that a user can click to trigger an action.
  *   `endIcon` (*type:* `GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon.t`, *default:* `nil`) - An icon displayed after the text. Supports [built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons) and [custom](https://developers.google.com/workspace/chat/format-messages#customicons) icons.
  *   `icon` (*type:* `GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon.t`, *default:* `nil`) - Deprecated in favor of `startIcon`.
  *   `onClick` (*type:* `GoogleApi.Chat.V1.Model.GoogleAppsCardV1OnClick.t`, *default:* `nil`) - This action is triggered when users click `topLabel` or `bottomLabel`.
  *   `startIcon` (*type:* `GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon.t`, *default:* `nil`) - The icon displayed in front of the text.
  *   `switchControl` (*type:* `GoogleApi.Chat.V1.Model.GoogleAppsCardV1SwitchControl.t`, *default:* `nil`) - A switch widget that a user can click to change its state and trigger an action.
  *   `text` (*type:* `String.t`, *default:* `nil`) - Required. The primary text. Supports simple formatting. For more information about formatting text, see [Formatting text in Google Chat apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) and [Formatting text in Google Workspace add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
  *   `topLabel` (*type:* `String.t`, *default:* `nil`) - The text that appears above `text`. Always truncates.
  *   `wrapText` (*type:* `boolean()`, *default:* `nil`) - The wrap text setting. If `true`, the text wraps and displays on multiple lines. Otherwise, the text is truncated. Only applies to `text`, not `topLabel` and `bottomLabel`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :bottomLabel => String.t() | nil,
          :button => GoogleApi.Chat.V1.Model.GoogleAppsCardV1Button.t() | nil,
          :endIcon => GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon.t() | nil,
          :icon => GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon.t() | nil,
          :onClick => GoogleApi.Chat.V1.Model.GoogleAppsCardV1OnClick.t() | nil,
          :startIcon => GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon.t() | nil,
          :switchControl => GoogleApi.Chat.V1.Model.GoogleAppsCardV1SwitchControl.t() | nil,
          :text => String.t() | nil,
          :topLabel => String.t() | nil,
          :wrapText => boolean() | nil
        }

  field(:bottomLabel)
  field(:button, as: GoogleApi.Chat.V1.Model.GoogleAppsCardV1Button)
  field(:endIcon, as: GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon)
  field(:icon, as: GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon)
  field(:onClick, as: GoogleApi.Chat.V1.Model.GoogleAppsCardV1OnClick)
  field(:startIcon, as: GoogleApi.Chat.V1.Model.GoogleAppsCardV1Icon)
  field(:switchControl, as: GoogleApi.Chat.V1.Model.GoogleAppsCardV1SwitchControl)
  field(:text)
  field(:topLabel)
  field(:wrapText)
end

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

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