# 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.V5.Model.PagespeedApiPagespeedResponseV5 do
  @moduledoc """
  The Pagespeed API response object.

  ## Attributes

  *   `analysisUTCTimestamp` (*type:* `String.t`, *default:* `nil`) - The UTC timestamp of this analysis.
  *   `captchaResult` (*type:* `String.t`, *default:* `nil`) - The captcha verify result
  *   `id` (*type:* `String.t`, *default:* `nil`) - Canonicalized and final URL for the document, after following page redirects (if any).
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Kind of result.
  *   `lighthouseResult` (*type:* `GoogleApi.PageSpeedOnline.V5.Model.LighthouseResultV5.t`, *default:* `nil`) - Lighthouse response for the audit url as an object.
  *   `loadingExperience` (*type:* `GoogleApi.PageSpeedOnline.V5.Model.PagespeedApiLoadingExperienceV5.t`, *default:* `nil`) - Metrics of end users' page loading experience.
  *   `originLoadingExperience` (*type:* `GoogleApi.PageSpeedOnline.V5.Model.PagespeedApiLoadingExperienceV5.t`, *default:* `nil`) - Metrics of the aggregated page loading experience of the origin
  *   `version` (*type:* `GoogleApi.PageSpeedOnline.V5.Model.PagespeedVersion.t`, *default:* `nil`) - The version of PageSpeed used to generate these results.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :analysisUTCTimestamp => String.t() | nil,
          :captchaResult => String.t() | nil,
          :id => String.t() | nil,
          :kind => String.t() | nil,
          :lighthouseResult => GoogleApi.PageSpeedOnline.V5.Model.LighthouseResultV5.t() | nil,
          :loadingExperience =>
            GoogleApi.PageSpeedOnline.V5.Model.PagespeedApiLoadingExperienceV5.t() | nil,
          :originLoadingExperience =>
            GoogleApi.PageSpeedOnline.V5.Model.PagespeedApiLoadingExperienceV5.t() | nil,
          :version => GoogleApi.PageSpeedOnline.V5.Model.PagespeedVersion.t() | nil
        }

  field(:analysisUTCTimestamp)
  field(:captchaResult)
  field(:id)
  field(:kind)
  field(:lighthouseResult, as: GoogleApi.PageSpeedOnline.V5.Model.LighthouseResultV5)

  field(:loadingExperience, as: GoogleApi.PageSpeedOnline.V5.Model.PagespeedApiLoadingExperienceV5)

  field(:originLoadingExperience,
    as: GoogleApi.PageSpeedOnline.V5.Model.PagespeedApiLoadingExperienceV5
  )

  field(:version, as: GoogleApi.PageSpeedOnline.V5.Model.PagespeedVersion)
end

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

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