# 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.Context do
  @moduledoc """
  Context is typically something that a Comment is referencing or replying to (such as an article, or previous comment). Note: Populate only ONE OF the following fields. The oneof syntax cannot be used because that would require nesting entries inside another message and breaking backwards compatibility. The server will return an error if more than one of the following fields is present.

  ## Attributes

  *   `articleAndParentComment` (*type:* `GoogleApi.CommentAnalyzer.V1alpha1.Model.ArticleAndParentComment.t`, *default:* `nil`) - Information about the source for which the original comment was made, and any parent comment info.
  *   `entries` (*type:* `list(GoogleApi.CommentAnalyzer.V1alpha1.Model.TextEntry.t)`, *default:* `nil`) - A list of messages. For example, a linear comments section or forum thread.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :articleAndParentComment =>
            GoogleApi.CommentAnalyzer.V1alpha1.Model.ArticleAndParentComment.t(),
          :entries => list(GoogleApi.CommentAnalyzer.V1alpha1.Model.TextEntry.t())
        }

  field(:articleAndParentComment,
    as: GoogleApi.CommentAnalyzer.V1alpha1.Model.ArticleAndParentComment
  )

  field(:entries, as: GoogleApi.CommentAnalyzer.V1alpha1.Model.TextEntry, type: :list)
end

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

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