# 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.CommentAnalyzer.V1alpha1.Model.AnalyzeCommentResponse do
  @moduledoc """
  The comment analysis response message.

  ## Attributes

  *   `attributeScores` (*type:* `%{optional(String.t) => GoogleApi.CommentAnalyzer.V1alpha1.Model.AttributeScores.t}`, *default:* `nil`) - Scores for the requested attributes. The map keys are attribute names (same as the requested_attribute field in AnalyzeCommentRequest, for example "ATTACK_ON_AUTHOR", "INFLAMMATORY", etc).
  *   `clientToken` (*type:* `String.t`, *default:* `nil`) - Same token from the original AnalyzeCommentRequest.
  *   `detectedLanguages` (*type:* `list(String.t)`, *default:* `nil`) - Contains the languages detected from the text content, sorted in order of likelihood.
  *   `languages` (*type:* `list(String.t)`, *default:* `nil`) - The language(s) used by CommentAnalyzer service to choose which Model to use when analyzing the comment. Might better be called "effective_languages". The logic used to make the choice is as follows: if !Request.languages.empty() effective_languages = Request.languages else effective_languages = detected_languages[0]
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :attributeScores => %{
            optional(String.t()) => GoogleApi.CommentAnalyzer.V1alpha1.Model.AttributeScores.t()
          },
          :clientToken => String.t(),
          :detectedLanguages => list(String.t()),
          :languages => list(String.t())
        }

  field(:attributeScores, as: GoogleApi.CommentAnalyzer.V1alpha1.Model.AttributeScores, type: :map)

  field(:clientToken)
  field(:detectedLanguages, type: :list)
  field(:languages, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.CommentAnalyzer.V1alpha1.Model.AnalyzeCommentResponse do
  def decode(value, options) do
    GoogleApi.CommentAnalyzer.V1alpha1.Model.AnalyzeCommentResponse.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CommentAnalyzer.V1alpha1.Model.AnalyzeCommentResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
