# 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.MyBusinessQAndA.V1.Model.Question do
  @moduledoc """
  Represents a single question and some of its answers.

  ## Attributes

  *   `author` (*type:* `GoogleApi.MyBusinessQAndA.V1.Model.Author.t`, *default:* `nil`) - Output only. The author of the question.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp for when the question was written.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. The unique name for the question. locations/*/questions/* This field will be ignored if set during question creation.
  *   `text` (*type:* `String.t`, *default:* `nil`) - Required. The text of the question. It should contain at least three words and the total length should be greater than or equal to 10 characters. The maximum length is 4096 characters.
  *   `topAnswers` (*type:* `list(GoogleApi.MyBusinessQAndA.V1.Model.Answer.t)`, *default:* `nil`) - Output only. A list of answers to the question, sorted by upvotes. This may not be a complete list of answers depending on the request parameters (answers_per_question)
  *   `totalAnswerCount` (*type:* `integer()`, *default:* `nil`) - Output only. The total number of answers posted for this question.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp for when the question was last modified.
  *   `upvoteCount` (*type:* `integer()`, *default:* `nil`) - Output only. The number of upvotes for the question.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :author => GoogleApi.MyBusinessQAndA.V1.Model.Author.t() | nil,
          :createTime => DateTime.t() | nil,
          :name => String.t() | nil,
          :text => String.t() | nil,
          :topAnswers => list(GoogleApi.MyBusinessQAndA.V1.Model.Answer.t()) | nil,
          :totalAnswerCount => integer() | nil,
          :updateTime => DateTime.t() | nil,
          :upvoteCount => integer() | nil
        }

  field(:author, as: GoogleApi.MyBusinessQAndA.V1.Model.Author)
  field(:createTime, as: DateTime)
  field(:name)
  field(:text)
  field(:topAnswers, as: GoogleApi.MyBusinessQAndA.V1.Model.Answer, type: :list)
  field(:totalAnswerCount)
  field(:updateTime, as: DateTime)
  field(:upvoteCount)
end

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

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