# 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.Books.V1.Model.VolumeAccessInfo do
  @moduledoc """
  Any information about a volume related to reading or obtaining that volume text. This information can depend on country (books may be public domain in one country but not in another, e.g.).

  ## Attributes

  *   `accessViewStatus` (*type:* `String.t`, *default:* `nil`) - Combines the access and viewability of this volume into a single status field for this user. Values can be FULL_PURCHASED, FULL_PUBLIC_DOMAIN, SAMPLE or NONE. (In LITE projection.)
  *   `country` (*type:* `String.t`, *default:* `nil`) - The two-letter ISO_3166-1 country code for which this access information is valid. (In LITE projection.)
  *   `downloadAccess` (*type:* `GoogleApi.Books.V1.Model.DownloadAccessRestriction.t`, *default:* `nil`) - Information about a volume's download license access restrictions.
  *   `driveImportedContentLink` (*type:* `String.t`, *default:* `nil`) - URL to the Google Drive viewer if this volume is uploaded by the user by selecting the file from Google Drive.
  *   `embeddable` (*type:* `boolean()`, *default:* `nil`) - Whether this volume can be embedded in a viewport using the Embedded Viewer API.
  *   `epub` (*type:* `GoogleApi.Books.V1.Model.VolumeAccessInfoEpub.t`, *default:* `nil`) - Information about epub content. (In LITE projection.)
  *   `explicitOfflineLicenseManagement` (*type:* `boolean()`, *default:* `nil`) - Whether this volume requires that the client explicitly request offline download license rather than have it done automatically when loading the content, if the client supports it.
  *   `pdf` (*type:* `GoogleApi.Books.V1.Model.VolumeAccessInfoPdf.t`, *default:* `nil`) - Information about pdf content. (In LITE projection.)
  *   `publicDomain` (*type:* `boolean()`, *default:* `nil`) - Whether or not this book is public domain in the country listed above.
  *   `quoteSharingAllowed` (*type:* `boolean()`, *default:* `nil`) - Whether quote sharing is allowed for this volume.
  *   `textToSpeechPermission` (*type:* `String.t`, *default:* `nil`) - Whether text-to-speech is permitted for this volume. Values can be ALLOWED, ALLOWED_FOR_ACCESSIBILITY, or NOT_ALLOWED.
  *   `viewOrderUrl` (*type:* `String.t`, *default:* `nil`) - For ordered but not yet processed orders, we give a URL that can be used to go to the appropriate Google Wallet page.
  *   `viewability` (*type:* `String.t`, *default:* `nil`) - The read access of a volume. Possible values are PARTIAL, ALL_PAGES, NO_PAGES or UNKNOWN. This value depends on the country listed above. A value of PARTIAL means that the publisher has allowed some portion of the volume to be viewed publicly, without purchase. This can apply to eBooks as well as non-eBooks. Public domain books will always have a value of ALL_PAGES.
  *   `webReaderLink` (*type:* `String.t`, *default:* `nil`) - URL to read this volume on the Google Books site. Link will not allow users to read non-viewable volumes.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accessViewStatus => String.t() | nil,
          :country => String.t() | nil,
          :downloadAccess => GoogleApi.Books.V1.Model.DownloadAccessRestriction.t() | nil,
          :driveImportedContentLink => String.t() | nil,
          :embeddable => boolean() | nil,
          :epub => GoogleApi.Books.V1.Model.VolumeAccessInfoEpub.t() | nil,
          :explicitOfflineLicenseManagement => boolean() | nil,
          :pdf => GoogleApi.Books.V1.Model.VolumeAccessInfoPdf.t() | nil,
          :publicDomain => boolean() | nil,
          :quoteSharingAllowed => boolean() | nil,
          :textToSpeechPermission => String.t() | nil,
          :viewOrderUrl => String.t() | nil,
          :viewability => String.t() | nil,
          :webReaderLink => String.t() | nil
        }

  field(:accessViewStatus)
  field(:country)
  field(:downloadAccess, as: GoogleApi.Books.V1.Model.DownloadAccessRestriction)
  field(:driveImportedContentLink)
  field(:embeddable)
  field(:epub, as: GoogleApi.Books.V1.Model.VolumeAccessInfoEpub)
  field(:explicitOfflineLicenseManagement)
  field(:pdf, as: GoogleApi.Books.V1.Model.VolumeAccessInfoPdf)
  field(:publicDomain)
  field(:quoteSharingAllowed)
  field(:textToSpeechPermission)
  field(:viewOrderUrl)
  field(:viewability)
  field(:webReaderLink)
end

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

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