# 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.PageSpeedOnline.V2.Model.Result do
  @moduledoc """


  ## Attributes

  *   `captchaResult` (*type:* `String.t`, *default:* `nil`) - The captcha verify result
  *   `formattedResults` (*type:* `GoogleApi.PageSpeedOnline.V2.Model.ResultFormattedResults.t`, *default:* `nil`) - Localized PageSpeed results. Contains a ruleResults entry for each PageSpeed rule instantiated and run by the server.
  *   `id` (*type:* `String.t`, *default:* `nil`) - Canonicalized and final URL for the document, after following page redirects (if any).
  *   `invalidRules` (*type:* `list(String.t)`, *default:* `nil`) - List of rules that were specified in the request, but which the server did not know how to instantiate.
  *   `kind` (*type:* `String.t`, *default:* `pagespeedonline#result`) - Kind of result.
  *   `pageStats` (*type:* `GoogleApi.PageSpeedOnline.V2.Model.ResultPageStats.t`, *default:* `nil`) - Summary statistics for the page, such as number of JavaScript bytes, number of HTML bytes, etc.
  *   `responseCode` (*type:* `integer()`, *default:* `nil`) - Response code for the document. 200 indicates a normal page load. 4xx/5xx indicates an error.
  *   `ruleGroups` (*type:* `map()`, *default:* `nil`) - A map with one entry for each rule group in these results.
  *   `screenshot` (*type:* `GoogleApi.PageSpeedOnline.V2.Model.PagespeedApiImageV2.t`, *default:* `nil`) - Base64-encoded screenshot of the page that was analyzed.
  *   `title` (*type:* `String.t`, *default:* `nil`) - Title of the page, as displayed in the browser's title bar.
  *   `version` (*type:* `GoogleApi.PageSpeedOnline.V2.Model.ResultVersion.t`, *default:* `nil`) - The version of PageSpeed used to generate these results.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :captchaResult => String.t(),
          :formattedResults => GoogleApi.PageSpeedOnline.V2.Model.ResultFormattedResults.t(),
          :id => String.t(),
          :invalidRules => list(String.t()),
          :kind => String.t(),
          :pageStats => GoogleApi.PageSpeedOnline.V2.Model.ResultPageStats.t(),
          :responseCode => integer(),
          :ruleGroups => map(),
          :screenshot => GoogleApi.PageSpeedOnline.V2.Model.PagespeedApiImageV2.t(),
          :title => String.t(),
          :version => GoogleApi.PageSpeedOnline.V2.Model.ResultVersion.t()
        }

  field(:captchaResult)
  field(:formattedResults, as: GoogleApi.PageSpeedOnline.V2.Model.ResultFormattedResults)
  field(:id)
  field(:invalidRules, type: :list)
  field(:kind)
  field(:pageStats, as: GoogleApi.PageSpeedOnline.V2.Model.ResultPageStats)
  field(:responseCode)
  field(:ruleGroups, type: :map)
  field(:screenshot, as: GoogleApi.PageSpeedOnline.V2.Model.PagespeedApiImageV2)
  field(:title)
  field(:version, as: GoogleApi.PageSpeedOnline.V2.Model.ResultVersion)
end

defimpl Poison.Decoder, for: GoogleApi.PageSpeedOnline.V2.Model.Result do
  def decode(value, options) do
    GoogleApi.PageSpeedOnline.V2.Model.Result.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PageSpeedOnline.V2.Model.Result do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
