# 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.VolumeUserInfo do
  @moduledoc """
  User specific information related to this volume. (e.g. page this user last read or whether they purchased this book)

  ## Attributes

  *   `acquiredTime` (*type:* `String.t`, *default:* `nil`) - Timestamp when this volume was acquired by the user. (RFC 3339 UTC date-time format) Acquiring includes purchase, user upload, receiving family sharing, etc.
  *   `acquisitionType` (*type:* `integer()`, *default:* `nil`) - How this volume was acquired.
  *   `copy` (*type:* `GoogleApi.Books.V1.Model.VolumeUserInfoCopy.t`, *default:* `nil`) - Copy/Paste accounting information.
  *   `entitlementType` (*type:* `integer()`, *default:* `nil`) - Whether this volume is purchased, sample, pd download etc.
  *   `familySharing` (*type:* `GoogleApi.Books.V1.Model.VolumeUserInfoFamilySharing.t`, *default:* `nil`) - Information on the ability to share with the family.
  *   `isFamilySharedFromUser` (*type:* `boolean()`, *default:* `nil`) - Whether or not the user shared this volume with the family.
  *   `isFamilySharedToUser` (*type:* `boolean()`, *default:* `nil`) - Whether or not the user received this volume through family sharing.
  *   `isFamilySharingAllowed` (*type:* `boolean()`, *default:* `nil`) - Deprecated: Replaced by familySharing.
  *   `isFamilySharingDisabledByFop` (*type:* `boolean()`, *default:* `nil`) - Deprecated: Replaced by familySharing.
  *   `isInMyBooks` (*type:* `boolean()`, *default:* `nil`) - Whether or not this volume is currently in "my books."
  *   `isPreordered` (*type:* `boolean()`, *default:* `nil`) - Whether or not this volume was pre-ordered by the authenticated user making the request. (In LITE projection.)
  *   `isPurchased` (*type:* `boolean()`, *default:* `nil`) - Whether or not this volume was purchased by the authenticated user making the request. (In LITE projection.)
  *   `isUploaded` (*type:* `boolean()`, *default:* `nil`) - Whether or not this volume was user uploaded.
  *   `readingPosition` (*type:* `GoogleApi.Books.V1.Model.ReadingPosition.t`, *default:* `nil`) - The user's current reading position in the volume, if one is available. (In LITE projection.)
  *   `rentalPeriod` (*type:* `GoogleApi.Books.V1.Model.VolumeUserInfoRentalPeriod.t`, *default:* `nil`) - Period during this book is/was a valid rental.
  *   `rentalState` (*type:* `String.t`, *default:* `nil`) - Whether this book is an active or an expired rental.
  *   `review` (*type:* `GoogleApi.Books.V1.Model.Review.t`, *default:* `nil`) - This user's review of this volume, if one exists.
  *   `updated` (*type:* `String.t`, *default:* `nil`) - Timestamp when this volume was last modified by a user action, such as a reading position update, volume purchase or writing a review. (RFC 3339 UTC date-time format).
  *   `userUploadedVolumeInfo` (*type:* `GoogleApi.Books.V1.Model.VolumeUserInfoUserUploadedVolumeInfo.t`, *default:* `nil`) - 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :acquiredTime => String.t() | nil,
          :acquisitionType => integer() | nil,
          :copy => GoogleApi.Books.V1.Model.VolumeUserInfoCopy.t() | nil,
          :entitlementType => integer() | nil,
          :familySharing => GoogleApi.Books.V1.Model.VolumeUserInfoFamilySharing.t() | nil,
          :isFamilySharedFromUser => boolean() | nil,
          :isFamilySharedToUser => boolean() | nil,
          :isFamilySharingAllowed => boolean() | nil,
          :isFamilySharingDisabledByFop => boolean() | nil,
          :isInMyBooks => boolean() | nil,
          :isPreordered => boolean() | nil,
          :isPurchased => boolean() | nil,
          :isUploaded => boolean() | nil,
          :readingPosition => GoogleApi.Books.V1.Model.ReadingPosition.t() | nil,
          :rentalPeriod => GoogleApi.Books.V1.Model.VolumeUserInfoRentalPeriod.t() | nil,
          :rentalState => String.t() | nil,
          :review => GoogleApi.Books.V1.Model.Review.t() | nil,
          :updated => String.t() | nil,
          :userUploadedVolumeInfo =>
            GoogleApi.Books.V1.Model.VolumeUserInfoUserUploadedVolumeInfo.t() | nil
        }

  field(:acquiredTime)
  field(:acquisitionType)
  field(:copy, as: GoogleApi.Books.V1.Model.VolumeUserInfoCopy)
  field(:entitlementType)
  field(:familySharing, as: GoogleApi.Books.V1.Model.VolumeUserInfoFamilySharing)
  field(:isFamilySharedFromUser)
  field(:isFamilySharedToUser)
  field(:isFamilySharingAllowed)
  field(:isFamilySharingDisabledByFop)
  field(:isInMyBooks)
  field(:isPreordered)
  field(:isPurchased)
  field(:isUploaded)
  field(:readingPosition, as: GoogleApi.Books.V1.Model.ReadingPosition)
  field(:rentalPeriod, as: GoogleApi.Books.V1.Model.VolumeUserInfoRentalPeriod)
  field(:rentalState)
  field(:review, as: GoogleApi.Books.V1.Model.Review)
  field(:updated)

  field(:userUploadedVolumeInfo, as: GoogleApi.Books.V1.Model.VolumeUserInfoUserUploadedVolumeInfo)
end

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

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