# 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.KeyValue do
  @moduledoc """
  A UI element contains a key (label) and a value (content). This element can also contain some actions such as `onclick` button.

  ## Attributes

  *   `bottomLabel` (*type:* `String.t`, *default:* `nil`) - The text of the bottom label. Formatted text supported. 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).
  *   `button` (*type:* `GoogleApi.Chat.V1.Model.Button.t`, *default:* `nil`) - A button that can be clicked to trigger an action.
  *   `content` (*type:* `String.t`, *default:* `nil`) - The text of the content. Formatted text supported and always required. 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).
  *   `contentMultiline` (*type:* `boolean()`, *default:* `nil`) - If the content should be multiline.
  *   `icon` (*type:* `String.t`, *default:* `nil`) - An enum value that's replaced by the Chat API with the corresponding icon image.
  *   `iconUrl` (*type:* `String.t`, *default:* `nil`) - The icon specified by a URL.
  *   `onClick` (*type:* `GoogleApi.Chat.V1.Model.OnClick.t`, *default:* `nil`) - The `onclick` action. Only the top label, bottom label, and content region are clickable.
  *   `topLabel` (*type:* `String.t`, *default:* `nil`) - The text of the top label. Formatted text supported. 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).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :bottomLabel => String.t() | nil,
          :button => GoogleApi.Chat.V1.Model.Button.t() | nil,
          :content => String.t() | nil,
          :contentMultiline => boolean() | nil,
          :icon => String.t() | nil,
          :iconUrl => String.t() | nil,
          :onClick => GoogleApi.Chat.V1.Model.OnClick.t() | nil,
          :topLabel => String.t() | nil
        }

  field(:bottomLabel)
  field(:button, as: GoogleApi.Chat.V1.Model.Button)
  field(:content)
  field(:contentMultiline)
  field(:icon)
  field(:iconUrl)
  field(:onClick, as: GoogleApi.Chat.V1.Model.OnClick)
  field(:topLabel)
end

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

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