# 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.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup do
  @moduledoc """
  Fields for an individual `ClaimReview` element. Except for sub-messages that group fields together, each of these fields correspond those in https://schema.org/ClaimReview. We list the precise mapping for each field.

  ## Attributes

  *   `claimAppearances` (*type:* `list(String.t)`, *default:* `nil`) - A list of links to works in which this claim appears, aside from the one specified in `claim_first_appearance`. Corresponds to `ClaimReview.itemReviewed[@type=Claim].appearance.url`.
  *   `claimAuthor` (*type:* `GoogleApi.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor.t`, *default:* `nil`) - Info about the author of this claim.
  *   `claimDate` (*type:* `String.t`, *default:* `nil`) - The date when the claim was made or entered public discourse. Corresponds to `ClaimReview.itemReviewed.datePublished`.
  *   `claimFirstAppearance` (*type:* `String.t`, *default:* `nil`) - A link to a work in which this claim first appears. Corresponds to `ClaimReview.itemReviewed[@type=Claim].firstAppearance.url`.
  *   `claimLocation` (*type:* `String.t`, *default:* `nil`) - The location where this claim was made. Corresponds to `ClaimReview.itemReviewed.name`.
  *   `claimReviewed` (*type:* `String.t`, *default:* `nil`) - A short summary of the claim being evaluated. Corresponds to `ClaimReview.claimReviewed`.
  *   `rating` (*type:* `GoogleApi.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating.t`, *default:* `nil`) - Info about the rating of this claim review.
  *   `url` (*type:* `String.t`, *default:* `nil`) - This field is optional, and will default to the page URL. We provide this field to allow you the override the default value, but the only permitted override is the page URL plus an optional anchor link ("page jump"). Corresponds to `ClaimReview.url`
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :claimAppearances => list(String.t()) | nil,
          :claimAuthor =>
            GoogleApi.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor.t()
            | nil,
          :claimDate => String.t() | nil,
          :claimFirstAppearance => String.t() | nil,
          :claimLocation => String.t() | nil,
          :claimReviewed => String.t() | nil,
          :rating =>
            GoogleApi.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating.t()
            | nil,
          :url => String.t() | nil
        }

  field(:claimAppearances, type: :list)

  field(:claimAuthor,
    as:
      GoogleApi.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor
  )

  field(:claimDate)
  field(:claimFirstAppearance)
  field(:claimLocation)
  field(:claimReviewed)

  field(:rating,
    as:
      GoogleApi.FactCheckTools.V1alpha1.Model.GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating
  )

  field(:url)
end

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

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