{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE NoImplicitPrelude  #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}

{-# OPTIONS_GHC -fno-warn-unused-binds   #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}

-- |
-- Module      : Network.Google.Games.Types.Product
-- Copyright   : (c) 2015-2016 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.Google.Games.Types.Product where

import           Network.Google.Games.Types.Sum
import           Network.Google.Prelude

-- | This is a JSON template for a join room request.
--
-- /See:/ 'roomJoinRequest' smart constructor.
data RoomJoinRequest = RoomJoinRequest'
    { _rjrNetworkDiagnostics :: !(Maybe NetworkDiagnostics)
    , _rjrKind               :: !Text
    , _rjrClientAddress      :: !(Maybe RoomClientAddress)
    , _rjrCapabilities       :: !(Maybe [Text])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RoomJoinRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rjrNetworkDiagnostics'
--
-- * 'rjrKind'
--
-- * 'rjrClientAddress'
--
-- * 'rjrCapabilities'
roomJoinRequest
    :: RoomJoinRequest
roomJoinRequest =
    RoomJoinRequest'
    { _rjrNetworkDiagnostics = Nothing
    , _rjrKind = "games#roomJoinRequest"
    , _rjrClientAddress = Nothing
    , _rjrCapabilities = Nothing
    }

-- | Network diagnostics for the client joining the room.
rjrNetworkDiagnostics :: Lens' RoomJoinRequest (Maybe NetworkDiagnostics)
rjrNetworkDiagnostics
  = lens _rjrNetworkDiagnostics
      (\ s a -> s{_rjrNetworkDiagnostics = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#roomJoinRequest.
rjrKind :: Lens' RoomJoinRequest Text
rjrKind = lens _rjrKind (\ s a -> s{_rjrKind = a})

-- | Client address for the player joining the room.
rjrClientAddress :: Lens' RoomJoinRequest (Maybe RoomClientAddress)
rjrClientAddress
  = lens _rjrClientAddress
      (\ s a -> s{_rjrClientAddress = a})

-- | The capabilities that this client supports for realtime communication.
rjrCapabilities :: Lens' RoomJoinRequest [Text]
rjrCapabilities
  = lens _rjrCapabilities
      (\ s a -> s{_rjrCapabilities = a})
      . _Default
      . _Coerce

instance FromJSON RoomJoinRequest where
        parseJSON
          = withObject "RoomJoinRequest"
              (\ o ->
                 RoomJoinRequest' <$>
                   (o .:? "networkDiagnostics") <*>
                     (o .:? "kind" .!= "games#roomJoinRequest")
                     <*> (o .:? "clientAddress")
                     <*> (o .:? "capabilities" .!= mempty))

instance ToJSON RoomJoinRequest where
        toJSON RoomJoinRequest'{..}
          = object
              (catMaybes
                 [("networkDiagnostics" .=) <$>
                    _rjrNetworkDiagnostics,
                  Just ("kind" .= _rjrKind),
                  ("clientAddress" .=) <$> _rjrClientAddress,
                  ("capabilities" .=) <$> _rjrCapabilities])

-- | An object representation of the individual components of the player\'s
-- name. For some players, these fields may not be present.
--
-- /See:/ 'playerName' smart constructor.
data PlayerName = PlayerName'
    { _pnGivenName  :: !(Maybe Text)
    , _pnFamilyName :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerName' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pnGivenName'
--
-- * 'pnFamilyName'
playerName
    :: PlayerName
playerName =
    PlayerName'
    { _pnGivenName = Nothing
    , _pnFamilyName = Nothing
    }

-- | The given name of this player. In some places, this is known as the
-- first name.
pnGivenName :: Lens' PlayerName (Maybe Text)
pnGivenName
  = lens _pnGivenName (\ s a -> s{_pnGivenName = a})

-- | The family name of this player. In some places, this is known as the
-- last name.
pnFamilyName :: Lens' PlayerName (Maybe Text)
pnFamilyName
  = lens _pnFamilyName (\ s a -> s{_pnFamilyName = a})

instance FromJSON PlayerName where
        parseJSON
          = withObject "PlayerName"
              (\ o ->
                 PlayerName' <$>
                   (o .:? "givenName") <*> (o .:? "familyName"))

instance ToJSON PlayerName where
        toJSON PlayerName'{..}
          = object
              (catMaybes
                 [("givenName" .=) <$> _pnGivenName,
                  ("familyName" .=) <$> _pnFamilyName])

-- | This is a JSON template for an snapshot object.
--
-- /See:/ 'snapshot' smart constructor.
data Snapshot = Snapshot'
    { _sLastModifiedMillis :: !(Maybe (Textual Int64))
    , _sKind               :: !Text
    , _sProgressValue      :: !(Maybe (Textual Int64))
    , _sUniqueName         :: !(Maybe Text)
    , _sCoverImage         :: !(Maybe SnapshotImage)
    , _sId                 :: !(Maybe Text)
    , _sDurationMillis     :: !(Maybe (Textual Int64))
    , _sTitle              :: !(Maybe Text)
    , _sType               :: !(Maybe Text)
    , _sDescription        :: !(Maybe Text)
    , _sDriveId            :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Snapshot' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sLastModifiedMillis'
--
-- * 'sKind'
--
-- * 'sProgressValue'
--
-- * 'sUniqueName'
--
-- * 'sCoverImage'
--
-- * 'sId'
--
-- * 'sDurationMillis'
--
-- * 'sTitle'
--
-- * 'sType'
--
-- * 'sDescription'
--
-- * 'sDriveId'
snapshot
    :: Snapshot
snapshot =
    Snapshot'
    { _sLastModifiedMillis = Nothing
    , _sKind = "games#snapshot"
    , _sProgressValue = Nothing
    , _sUniqueName = Nothing
    , _sCoverImage = Nothing
    , _sId = Nothing
    , _sDurationMillis = Nothing
    , _sTitle = Nothing
    , _sType = Nothing
    , _sDescription = Nothing
    , _sDriveId = Nothing
    }

-- | The timestamp (in millis since Unix epoch) of the last modification to
-- this snapshot.
sLastModifiedMillis :: Lens' Snapshot (Maybe Int64)
sLastModifiedMillis
  = lens _sLastModifiedMillis
      (\ s a -> s{_sLastModifiedMillis = a})
      . mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#snapshot.
sKind :: Lens' Snapshot Text
sKind = lens _sKind (\ s a -> s{_sKind = a})

-- | The progress value (64-bit integer set by developer) associated with
-- this snapshot.
sProgressValue :: Lens' Snapshot (Maybe Int64)
sProgressValue
  = lens _sProgressValue
      (\ s a -> s{_sProgressValue = a})
      . mapping _Coerce

-- | The unique name provided when the snapshot was created.
sUniqueName :: Lens' Snapshot (Maybe Text)
sUniqueName
  = lens _sUniqueName (\ s a -> s{_sUniqueName = a})

-- | The cover image of this snapshot. May be absent if there is no image.
sCoverImage :: Lens' Snapshot (Maybe SnapshotImage)
sCoverImage
  = lens _sCoverImage (\ s a -> s{_sCoverImage = a})

-- | The ID of the snapshot.
sId :: Lens' Snapshot (Maybe Text)
sId = lens _sId (\ s a -> s{_sId = a})

-- | The duration associated with this snapshot, in millis.
sDurationMillis :: Lens' Snapshot (Maybe Int64)
sDurationMillis
  = lens _sDurationMillis
      (\ s a -> s{_sDurationMillis = a})
      . mapping _Coerce

-- | The title of this snapshot.
sTitle :: Lens' Snapshot (Maybe Text)
sTitle = lens _sTitle (\ s a -> s{_sTitle = a})

-- | The type of this snapshot. Possible values are: - \"SAVE_GAME\" - A
-- snapshot representing a save game.
sType :: Lens' Snapshot (Maybe Text)
sType = lens _sType (\ s a -> s{_sType = a})

-- | The description of this snapshot.
sDescription :: Lens' Snapshot (Maybe Text)
sDescription
  = lens _sDescription (\ s a -> s{_sDescription = a})

-- | The ID of the file underlying this snapshot in the Drive API. Only
-- present if the snapshot is a view on a Drive file and the file is owned
-- by the caller.
sDriveId :: Lens' Snapshot (Maybe Text)
sDriveId = lens _sDriveId (\ s a -> s{_sDriveId = a})

instance FromJSON Snapshot where
        parseJSON
          = withObject "Snapshot"
              (\ o ->
                 Snapshot' <$>
                   (o .:? "lastModifiedMillis") <*>
                     (o .:? "kind" .!= "games#snapshot")
                     <*> (o .:? "progressValue")
                     <*> (o .:? "uniqueName")
                     <*> (o .:? "coverImage")
                     <*> (o .:? "id")
                     <*> (o .:? "durationMillis")
                     <*> (o .:? "title")
                     <*> (o .:? "type")
                     <*> (o .:? "description")
                     <*> (o .:? "driveId"))

instance ToJSON Snapshot where
        toJSON Snapshot'{..}
          = object
              (catMaybes
                 [("lastModifiedMillis" .=) <$> _sLastModifiedMillis,
                  Just ("kind" .= _sKind),
                  ("progressValue" .=) <$> _sProgressValue,
                  ("uniqueName" .=) <$> _sUniqueName,
                  ("coverImage" .=) <$> _sCoverImage,
                  ("id" .=) <$> _sId,
                  ("durationMillis" .=) <$> _sDurationMillis,
                  ("title" .=) <$> _sTitle, ("type" .=) <$> _sType,
                  ("description" .=) <$> _sDescription,
                  ("driveId" .=) <$> _sDriveId])

-- | This is a JSON template for a room resource object.
--
-- /See:/ 'room' smart constructor.
data Room = Room'
    { _rStatus               :: !(Maybe Text)
    , _rVariant              :: !(Maybe (Textual Int32))
    , _rKind                 :: !Text
    , _rAutoMatchingStatus   :: !(Maybe RoomAutoMatchStatus)
    , _rCreationDetails      :: !(Maybe RoomModification)
    , _rInviterId            :: !(Maybe Text)
    , _rLastUpdateDetails    :: !(Maybe RoomModification)
    , _rRoomStatusVersion    :: !(Maybe (Textual Int32))
    , _rParticipants         :: !(Maybe [RoomParticipant])
    , _rApplicationId        :: !(Maybe Text)
    , _rAutoMatchingCriteria :: !(Maybe RoomAutoMatchingCriteria)
    , _rRoomId               :: !(Maybe Text)
    , _rDescription          :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Room' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rStatus'
--
-- * 'rVariant'
--
-- * 'rKind'
--
-- * 'rAutoMatchingStatus'
--
-- * 'rCreationDetails'
--
-- * 'rInviterId'
--
-- * 'rLastUpdateDetails'
--
-- * 'rRoomStatusVersion'
--
-- * 'rParticipants'
--
-- * 'rApplicationId'
--
-- * 'rAutoMatchingCriteria'
--
-- * 'rRoomId'
--
-- * 'rDescription'
room
    :: Room
room =
    Room'
    { _rStatus = Nothing
    , _rVariant = Nothing
    , _rKind = "games#room"
    , _rAutoMatchingStatus = Nothing
    , _rCreationDetails = Nothing
    , _rInviterId = Nothing
    , _rLastUpdateDetails = Nothing
    , _rRoomStatusVersion = Nothing
    , _rParticipants = Nothing
    , _rApplicationId = Nothing
    , _rAutoMatchingCriteria = Nothing
    , _rRoomId = Nothing
    , _rDescription = Nothing
    }

-- | The status of the room. Possible values are: - \"ROOM_INVITING\" - One
-- or more players have been invited and not responded. -
-- \"ROOM_AUTO_MATCHING\" - One or more slots need to be filled by
-- auto-matching. - \"ROOM_CONNECTING\" - Players have joined and are
-- connecting to each other (either before or after auto-matching). -
-- \"ROOM_ACTIVE\" - All players have joined and connected to each other. -
-- \"ROOM_DELETED\" - The room should no longer be shown on the client.
-- Returned in sync calls when a player joins a room (as a tombstone), or
-- for rooms where all joined participants have left.
rStatus :: Lens' Room (Maybe Text)
rStatus = lens _rStatus (\ s a -> s{_rStatus = a})

-- | The variant \/ mode of the application being played; can be any integer
-- value, or left blank.
rVariant :: Lens' Room (Maybe Int32)
rVariant
  = lens _rVariant (\ s a -> s{_rVariant = a}) .
      mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#room.
rKind :: Lens' Room Text
rKind = lens _rKind (\ s a -> s{_rKind = a})

-- | Auto-matching status for this room. Not set if the room is not currently
-- in the auto-matching queue.
rAutoMatchingStatus :: Lens' Room (Maybe RoomAutoMatchStatus)
rAutoMatchingStatus
  = lens _rAutoMatchingStatus
      (\ s a -> s{_rAutoMatchingStatus = a})

-- | Details about the room creation.
rCreationDetails :: Lens' Room (Maybe RoomModification)
rCreationDetails
  = lens _rCreationDetails
      (\ s a -> s{_rCreationDetails = a})

-- | The ID of the participant that invited the user to the room. Not set if
-- the user was not invited to the room.
rInviterId :: Lens' Room (Maybe Text)
rInviterId
  = lens _rInviterId (\ s a -> s{_rInviterId = a})

-- | Details about the last update to the room.
rLastUpdateDetails :: Lens' Room (Maybe RoomModification)
rLastUpdateDetails
  = lens _rLastUpdateDetails
      (\ s a -> s{_rLastUpdateDetails = a})

-- | The version of the room status: an increasing counter, used by the
-- client to ignore out-of-order updates to room status.
rRoomStatusVersion :: Lens' Room (Maybe Int32)
rRoomStatusVersion
  = lens _rRoomStatusVersion
      (\ s a -> s{_rRoomStatusVersion = a})
      . mapping _Coerce

-- | The participants involved in the room, along with their statuses.
-- Includes participants who have left or declined invitations.
rParticipants :: Lens' Room [RoomParticipant]
rParticipants
  = lens _rParticipants
      (\ s a -> s{_rParticipants = a})
      . _Default
      . _Coerce

-- | The ID of the application being played.
rApplicationId :: Lens' Room (Maybe Text)
rApplicationId
  = lens _rApplicationId
      (\ s a -> s{_rApplicationId = a})

-- | Criteria for auto-matching players into this room.
rAutoMatchingCriteria :: Lens' Room (Maybe RoomAutoMatchingCriteria)
rAutoMatchingCriteria
  = lens _rAutoMatchingCriteria
      (\ s a -> s{_rAutoMatchingCriteria = a})

-- | Globally unique ID for a room.
rRoomId :: Lens' Room (Maybe Text)
rRoomId = lens _rRoomId (\ s a -> s{_rRoomId = a})

-- | This short description is generated by our servers and worded relative
-- to the player requesting the room. It is intended to be displayed when
-- the room is shown in a list (that is, an invitation to a room.)
rDescription :: Lens' Room (Maybe Text)
rDescription
  = lens _rDescription (\ s a -> s{_rDescription = a})

instance FromJSON Room where
        parseJSON
          = withObject "Room"
              (\ o ->
                 Room' <$>
                   (o .:? "status") <*> (o .:? "variant") <*>
                     (o .:? "kind" .!= "games#room")
                     <*> (o .:? "autoMatchingStatus")
                     <*> (o .:? "creationDetails")
                     <*> (o .:? "inviterId")
                     <*> (o .:? "lastUpdateDetails")
                     <*> (o .:? "roomStatusVersion")
                     <*> (o .:? "participants" .!= mempty)
                     <*> (o .:? "applicationId")
                     <*> (o .:? "autoMatchingCriteria")
                     <*> (o .:? "roomId")
                     <*> (o .:? "description"))

instance ToJSON Room where
        toJSON Room'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _rStatus,
                  ("variant" .=) <$> _rVariant,
                  Just ("kind" .= _rKind),
                  ("autoMatchingStatus" .=) <$> _rAutoMatchingStatus,
                  ("creationDetails" .=) <$> _rCreationDetails,
                  ("inviterId" .=) <$> _rInviterId,
                  ("lastUpdateDetails" .=) <$> _rLastUpdateDetails,
                  ("roomStatusVersion" .=) <$> _rRoomStatusVersion,
                  ("participants" .=) <$> _rParticipants,
                  ("applicationId" .=) <$> _rApplicationId,
                  ("autoMatchingCriteria" .=) <$>
                    _rAutoMatchingCriteria,
                  ("roomId" .=) <$> _rRoomId,
                  ("description" .=) <$> _rDescription])

-- | This is a JSON template for a list of quest objects.
--
-- /See:/ 'questListResponse' smart constructor.
data QuestListResponse = QuestListResponse'
    { _qlrNextPageToken :: !(Maybe Text)
    , _qlrKind          :: !Text
    , _qlrItems         :: !(Maybe [Quest])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QuestListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qlrNextPageToken'
--
-- * 'qlrKind'
--
-- * 'qlrItems'
questListResponse
    :: QuestListResponse
questListResponse =
    QuestListResponse'
    { _qlrNextPageToken = Nothing
    , _qlrKind = "games#questListResponse"
    , _qlrItems = Nothing
    }

-- | Token corresponding to the next page of results.
qlrNextPageToken :: Lens' QuestListResponse (Maybe Text)
qlrNextPageToken
  = lens _qlrNextPageToken
      (\ s a -> s{_qlrNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#questListResponse.
qlrKind :: Lens' QuestListResponse Text
qlrKind = lens _qlrKind (\ s a -> s{_qlrKind = a})

-- | The quests.
qlrItems :: Lens' QuestListResponse [Quest]
qlrItems
  = lens _qlrItems (\ s a -> s{_qlrItems = a}) .
      _Default
      . _Coerce

instance FromJSON QuestListResponse where
        parseJSON
          = withObject "QuestListResponse"
              (\ o ->
                 QuestListResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "games#questListResponse")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON QuestListResponse where
        toJSON QuestListResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _qlrNextPageToken,
                  Just ("kind" .= _qlrKind),
                  ("items" .=) <$> _qlrItems])

-- | This is a JSON template for a turn-based match resource object.
--
-- /See:/ 'turnBasedMatch' smart constructor.
data TurnBasedMatch = TurnBasedMatch'
    { _tbmStatus               :: !(Maybe Text)
    , _tbmVariant              :: !(Maybe (Textual Int32))
    , _tbmResults              :: !(Maybe [ParticipantResult])
    , _tbmMatchNumber          :: !(Maybe (Textual Int32))
    , _tbmKind                 :: !Text
    , _tbmData                 :: !(Maybe TurnBasedMatchData)
    , _tbmWithParticipantId    :: !(Maybe Text)
    , _tbmCreationDetails      :: !(Maybe TurnBasedMatchModification)
    , _tbmInviterId            :: !(Maybe Text)
    , _tbmLastUpdateDetails    :: !(Maybe TurnBasedMatchModification)
    , _tbmParticipants         :: !(Maybe [TurnBasedMatchParticipant])
    , _tbmApplicationId        :: !(Maybe Text)
    , _tbmAutoMatchingCriteria :: !(Maybe TurnBasedAutoMatchingCriteria)
    , _tbmPreviousMatchData    :: !(Maybe TurnBasedMatchData)
    , _tbmPendingParticipantId :: !(Maybe Text)
    , _tbmUserMatchStatus      :: !(Maybe Text)
    , _tbmMatchId              :: !(Maybe Text)
    , _tbmDescription          :: !(Maybe Text)
    , _tbmRematchId            :: !(Maybe Text)
    , _tbmMatchVersion         :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TurnBasedMatch' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tbmStatus'
--
-- * 'tbmVariant'
--
-- * 'tbmResults'
--
-- * 'tbmMatchNumber'
--
-- * 'tbmKind'
--
-- * 'tbmData'
--
-- * 'tbmWithParticipantId'
--
-- * 'tbmCreationDetails'
--
-- * 'tbmInviterId'
--
-- * 'tbmLastUpdateDetails'
--
-- * 'tbmParticipants'
--
-- * 'tbmApplicationId'
--
-- * 'tbmAutoMatchingCriteria'
--
-- * 'tbmPreviousMatchData'
--
-- * 'tbmPendingParticipantId'
--
-- * 'tbmUserMatchStatus'
--
-- * 'tbmMatchId'
--
-- * 'tbmDescription'
--
-- * 'tbmRematchId'
--
-- * 'tbmMatchVersion'
turnBasedMatch
    :: TurnBasedMatch
turnBasedMatch =
    TurnBasedMatch'
    { _tbmStatus = Nothing
    , _tbmVariant = Nothing
    , _tbmResults = Nothing
    , _tbmMatchNumber = Nothing
    , _tbmKind = "games#turnBasedMatch"
    , _tbmData = Nothing
    , _tbmWithParticipantId = Nothing
    , _tbmCreationDetails = Nothing
    , _tbmInviterId = Nothing
    , _tbmLastUpdateDetails = Nothing
    , _tbmParticipants = Nothing
    , _tbmApplicationId = Nothing
    , _tbmAutoMatchingCriteria = Nothing
    , _tbmPreviousMatchData = Nothing
    , _tbmPendingParticipantId = Nothing
    , _tbmUserMatchStatus = Nothing
    , _tbmMatchId = Nothing
    , _tbmDescription = Nothing
    , _tbmRematchId = Nothing
    , _tbmMatchVersion = Nothing
    }

-- | The status of the match. Possible values are: - \"MATCH_AUTO_MATCHING\"
-- - One or more slots need to be filled by auto-matching; the match cannot
-- be established until they are filled. - \"MATCH_ACTIVE\" - The match has
-- started. - \"MATCH_COMPLETE\" - The match has finished. -
-- \"MATCH_CANCELED\" - The match was canceled. - \"MATCH_EXPIRED\" - The
-- match expired due to inactivity. - \"MATCH_DELETED\" - The match should
-- no longer be shown on the client. Returned only for tombstones for
-- matches when sync is called.
tbmStatus :: Lens' TurnBasedMatch (Maybe Text)
tbmStatus
  = lens _tbmStatus (\ s a -> s{_tbmStatus = a})

-- | The variant \/ mode of the application being played; can be any integer
-- value, or left blank.
tbmVariant :: Lens' TurnBasedMatch (Maybe Int32)
tbmVariant
  = lens _tbmVariant (\ s a -> s{_tbmVariant = a}) .
      mapping _Coerce

-- | The results reported for this match.
tbmResults :: Lens' TurnBasedMatch [ParticipantResult]
tbmResults
  = lens _tbmResults (\ s a -> s{_tbmResults = a}) .
      _Default
      . _Coerce

-- | The number of the match in a chain of rematches. Will be set to 1 for
-- the first match and incremented by 1 for each rematch.
tbmMatchNumber :: Lens' TurnBasedMatch (Maybe Int32)
tbmMatchNumber
  = lens _tbmMatchNumber
      (\ s a -> s{_tbmMatchNumber = a})
      . mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#turnBasedMatch.
tbmKind :: Lens' TurnBasedMatch Text
tbmKind = lens _tbmKind (\ s a -> s{_tbmKind = a})

-- | The data \/ game state for this match.
tbmData :: Lens' TurnBasedMatch (Maybe TurnBasedMatchData)
tbmData = lens _tbmData (\ s a -> s{_tbmData = a})

-- | The ID of another participant in the match that can be used when
-- describing the participants the user is playing with.
tbmWithParticipantId :: Lens' TurnBasedMatch (Maybe Text)
tbmWithParticipantId
  = lens _tbmWithParticipantId
      (\ s a -> s{_tbmWithParticipantId = a})

-- | Details about the match creation.
tbmCreationDetails :: Lens' TurnBasedMatch (Maybe TurnBasedMatchModification)
tbmCreationDetails
  = lens _tbmCreationDetails
      (\ s a -> s{_tbmCreationDetails = a})

-- | The ID of the participant that invited the user to the match. Not set if
-- the user was not invited to the match.
tbmInviterId :: Lens' TurnBasedMatch (Maybe Text)
tbmInviterId
  = lens _tbmInviterId (\ s a -> s{_tbmInviterId = a})

-- | Details about the last update to the match.
tbmLastUpdateDetails :: Lens' TurnBasedMatch (Maybe TurnBasedMatchModification)
tbmLastUpdateDetails
  = lens _tbmLastUpdateDetails
      (\ s a -> s{_tbmLastUpdateDetails = a})

-- | The participants involved in the match, along with their statuses.
-- Includes participants who have left or declined invitations.
tbmParticipants :: Lens' TurnBasedMatch [TurnBasedMatchParticipant]
tbmParticipants
  = lens _tbmParticipants
      (\ s a -> s{_tbmParticipants = a})
      . _Default
      . _Coerce

-- | The ID of the application being played.
tbmApplicationId :: Lens' TurnBasedMatch (Maybe Text)
tbmApplicationId
  = lens _tbmApplicationId
      (\ s a -> s{_tbmApplicationId = a})

-- | Criteria for auto-matching players into this match.
tbmAutoMatchingCriteria :: Lens' TurnBasedMatch (Maybe TurnBasedAutoMatchingCriteria)
tbmAutoMatchingCriteria
  = lens _tbmAutoMatchingCriteria
      (\ s a -> s{_tbmAutoMatchingCriteria = a})

-- | The data \/ game state for the previous match; set for the first turn of
-- rematches only.
tbmPreviousMatchData :: Lens' TurnBasedMatch (Maybe TurnBasedMatchData)
tbmPreviousMatchData
  = lens _tbmPreviousMatchData
      (\ s a -> s{_tbmPreviousMatchData = a})

-- | The ID of the participant that is taking a turn.
tbmPendingParticipantId :: Lens' TurnBasedMatch (Maybe Text)
tbmPendingParticipantId
  = lens _tbmPendingParticipantId
      (\ s a -> s{_tbmPendingParticipantId = a})

-- | The status of the current user in the match. Derived from the match
-- type, match status, the user\'s participant status, and the pending
-- participant for the match. Possible values are: - \"USER_INVITED\" - The
-- user has been invited to join the match and has not responded yet. -
-- \"USER_AWAITING_TURN\" - The user is waiting for their turn. -
-- \"USER_TURN\" - The user has an action to take in the match. -
-- \"USER_MATCH_COMPLETED\" - The match has ended (it is completed,
-- canceled, or expired.)
tbmUserMatchStatus :: Lens' TurnBasedMatch (Maybe Text)
tbmUserMatchStatus
  = lens _tbmUserMatchStatus
      (\ s a -> s{_tbmUserMatchStatus = a})

-- | Globally unique ID for a turn-based match.
tbmMatchId :: Lens' TurnBasedMatch (Maybe Text)
tbmMatchId
  = lens _tbmMatchId (\ s a -> s{_tbmMatchId = a})

-- | This short description is generated by our servers based on turn state
-- and is localized and worded relative to the player requesting the match.
-- It is intended to be displayed when the match is shown in a list.
tbmDescription :: Lens' TurnBasedMatch (Maybe Text)
tbmDescription
  = lens _tbmDescription
      (\ s a -> s{_tbmDescription = a})

-- | The ID of a rematch of this match. Only set for completed matches that
-- have been rematched.
tbmRematchId :: Lens' TurnBasedMatch (Maybe Text)
tbmRematchId
  = lens _tbmRematchId (\ s a -> s{_tbmRematchId = a})

-- | The version of this match: an increasing counter, used to avoid
-- out-of-date updates to the match.
tbmMatchVersion :: Lens' TurnBasedMatch (Maybe Int32)
tbmMatchVersion
  = lens _tbmMatchVersion
      (\ s a -> s{_tbmMatchVersion = a})
      . mapping _Coerce

instance FromJSON TurnBasedMatch where
        parseJSON
          = withObject "TurnBasedMatch"
              (\ o ->
                 TurnBasedMatch' <$>
                   (o .:? "status") <*> (o .:? "variant") <*>
                     (o .:? "results" .!= mempty)
                     <*> (o .:? "matchNumber")
                     <*> (o .:? "kind" .!= "games#turnBasedMatch")
                     <*> (o .:? "data")
                     <*> (o .:? "withParticipantId")
                     <*> (o .:? "creationDetails")
                     <*> (o .:? "inviterId")
                     <*> (o .:? "lastUpdateDetails")
                     <*> (o .:? "participants" .!= mempty)
                     <*> (o .:? "applicationId")
                     <*> (o .:? "autoMatchingCriteria")
                     <*> (o .:? "previousMatchData")
                     <*> (o .:? "pendingParticipantId")
                     <*> (o .:? "userMatchStatus")
                     <*> (o .:? "matchId")
                     <*> (o .:? "description")
                     <*> (o .:? "rematchId")
                     <*> (o .:? "matchVersion"))

instance ToJSON TurnBasedMatch where
        toJSON TurnBasedMatch'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _tbmStatus,
                  ("variant" .=) <$> _tbmVariant,
                  ("results" .=) <$> _tbmResults,
                  ("matchNumber" .=) <$> _tbmMatchNumber,
                  Just ("kind" .= _tbmKind), ("data" .=) <$> _tbmData,
                  ("withParticipantId" .=) <$> _tbmWithParticipantId,
                  ("creationDetails" .=) <$> _tbmCreationDetails,
                  ("inviterId" .=) <$> _tbmInviterId,
                  ("lastUpdateDetails" .=) <$> _tbmLastUpdateDetails,
                  ("participants" .=) <$> _tbmParticipants,
                  ("applicationId" .=) <$> _tbmApplicationId,
                  ("autoMatchingCriteria" .=) <$>
                    _tbmAutoMatchingCriteria,
                  ("previousMatchData" .=) <$> _tbmPreviousMatchData,
                  ("pendingParticipantId" .=) <$>
                    _tbmPendingParticipantId,
                  ("userMatchStatus" .=) <$> _tbmUserMatchStatus,
                  ("matchId" .=) <$> _tbmMatchId,
                  ("description" .=) <$> _tbmDescription,
                  ("rematchId" .=) <$> _tbmRematchId,
                  ("matchVersion" .=) <$> _tbmMatchVersion])

-- | This is a JSON template for a turn-based match data object.
--
-- /See:/ 'turnBasedMatchData' smart constructor.
data TurnBasedMatchData = TurnBasedMatchData'
    { _tbmdKind          :: !Text
    , _tbmdData          :: !(Maybe Bytes)
    , _tbmdDataAvailable :: !(Maybe Bool)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TurnBasedMatchData' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tbmdKind'
--
-- * 'tbmdData'
--
-- * 'tbmdDataAvailable'
turnBasedMatchData
    :: TurnBasedMatchData
turnBasedMatchData =
    TurnBasedMatchData'
    { _tbmdKind = "games#turnBasedMatchData"
    , _tbmdData = Nothing
    , _tbmdDataAvailable = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#turnBasedMatchData.
tbmdKind :: Lens' TurnBasedMatchData Text
tbmdKind = lens _tbmdKind (\ s a -> s{_tbmdKind = a})

-- | The byte representation of the data (limited to 128 kB), as a
-- Base64-encoded string with the URL_SAFE encoding option.
tbmdData :: Lens' TurnBasedMatchData (Maybe ByteString)
tbmdData
  = lens _tbmdData (\ s a -> s{_tbmdData = a}) .
      mapping _Bytes

-- | True if this match has data available but it wasn\'t returned in a list
-- response; fetching the match individually will retrieve this data.
tbmdDataAvailable :: Lens' TurnBasedMatchData (Maybe Bool)
tbmdDataAvailable
  = lens _tbmdDataAvailable
      (\ s a -> s{_tbmdDataAvailable = a})

instance FromJSON TurnBasedMatchData where
        parseJSON
          = withObject "TurnBasedMatchData"
              (\ o ->
                 TurnBasedMatchData' <$>
                   (o .:? "kind" .!= "games#turnBasedMatchData") <*>
                     (o .:? "data")
                     <*> (o .:? "dataAvailable"))

instance ToJSON TurnBasedMatchData where
        toJSON TurnBasedMatchData'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _tbmdKind),
                  ("data" .=) <$> _tbmdData,
                  ("dataAvailable" .=) <$> _tbmdDataAvailable])

-- | This is a JSON template for an event status resource.
--
-- /See:/ 'playerEvent' smart constructor.
data PlayerEvent = PlayerEvent'
    { _peKind               :: !Text
    , _peNumEvents          :: !(Maybe (Textual Int64))
    , _peFormattedNumEvents :: !(Maybe Text)
    , _peDefinitionId       :: !(Maybe Text)
    , _pePlayerId           :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerEvent' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'peKind'
--
-- * 'peNumEvents'
--
-- * 'peFormattedNumEvents'
--
-- * 'peDefinitionId'
--
-- * 'pePlayerId'
playerEvent
    :: PlayerEvent
playerEvent =
    PlayerEvent'
    { _peKind = "games#playerEvent"
    , _peNumEvents = Nothing
    , _peFormattedNumEvents = Nothing
    , _peDefinitionId = Nothing
    , _pePlayerId = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerEvent.
peKind :: Lens' PlayerEvent Text
peKind = lens _peKind (\ s a -> s{_peKind = a})

-- | The current number of times this event has occurred.
peNumEvents :: Lens' PlayerEvent (Maybe Int64)
peNumEvents
  = lens _peNumEvents (\ s a -> s{_peNumEvents = a}) .
      mapping _Coerce

-- | The current number of times this event has occurred, as a string. The
-- formatting of this string depends on the configuration of your event in
-- the Play Games Developer Console.
peFormattedNumEvents :: Lens' PlayerEvent (Maybe Text)
peFormattedNumEvents
  = lens _peFormattedNumEvents
      (\ s a -> s{_peFormattedNumEvents = a})

-- | The ID of the event definition.
peDefinitionId :: Lens' PlayerEvent (Maybe Text)
peDefinitionId
  = lens _peDefinitionId
      (\ s a -> s{_peDefinitionId = a})

-- | The ID of the player.
pePlayerId :: Lens' PlayerEvent (Maybe Text)
pePlayerId
  = lens _pePlayerId (\ s a -> s{_pePlayerId = a})

instance FromJSON PlayerEvent where
        parseJSON
          = withObject "PlayerEvent"
              (\ o ->
                 PlayerEvent' <$>
                   (o .:? "kind" .!= "games#playerEvent") <*>
                     (o .:? "numEvents")
                     <*> (o .:? "formattedNumEvents")
                     <*> (o .:? "definitionId")
                     <*> (o .:? "playerId"))

instance ToJSON PlayerEvent where
        toJSON PlayerEvent'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _peKind),
                  ("numEvents" .=) <$> _peNumEvents,
                  ("formattedNumEvents" .=) <$> _peFormattedNumEvents,
                  ("definitionId" .=) <$> _peDefinitionId,
                  ("playerId" .=) <$> _pePlayerId])

-- | This is a JSON template for a player leaderboard score object.
--
-- /See:/ 'playerLeaderboardScore' smart constructor.
data PlayerLeaderboardScore = PlayerLeaderboardScore'
    { _plsScoreTag       :: !(Maybe Text)
    , _plsScoreString    :: !(Maybe Text)
    , _plsKind           :: !Text
    , _plsScoreValue     :: !(Maybe (Textual Int64))
    , _plsTimeSpan       :: !(Maybe Text)
    , _plsPublicRank     :: !(Maybe LeaderboardScoreRank)
    , _plsSocialRank     :: !(Maybe LeaderboardScoreRank)
    , _plsLeaderboardId  :: !(Maybe Text)
    , _plsWriteTimestamp :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerLeaderboardScore' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plsScoreTag'
--
-- * 'plsScoreString'
--
-- * 'plsKind'
--
-- * 'plsScoreValue'
--
-- * 'plsTimeSpan'
--
-- * 'plsPublicRank'
--
-- * 'plsSocialRank'
--
-- * 'plsLeaderboardId'
--
-- * 'plsWriteTimestamp'
playerLeaderboardScore
    :: PlayerLeaderboardScore
playerLeaderboardScore =
    PlayerLeaderboardScore'
    { _plsScoreTag = Nothing
    , _plsScoreString = Nothing
    , _plsKind = "games#playerLeaderboardScore"
    , _plsScoreValue = Nothing
    , _plsTimeSpan = Nothing
    , _plsPublicRank = Nothing
    , _plsSocialRank = Nothing
    , _plsLeaderboardId = Nothing
    , _plsWriteTimestamp = Nothing
    }

-- | Additional information about the score. Values must contain no more than
-- 64 URI-safe characters as defined by section 2.3 of RFC 3986.
plsScoreTag :: Lens' PlayerLeaderboardScore (Maybe Text)
plsScoreTag
  = lens _plsScoreTag (\ s a -> s{_plsScoreTag = a})

-- | The formatted value of this score.
plsScoreString :: Lens' PlayerLeaderboardScore (Maybe Text)
plsScoreString
  = lens _plsScoreString
      (\ s a -> s{_plsScoreString = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerLeaderboardScore.
plsKind :: Lens' PlayerLeaderboardScore Text
plsKind = lens _plsKind (\ s a -> s{_plsKind = a})

-- | The numerical value of this score.
plsScoreValue :: Lens' PlayerLeaderboardScore (Maybe Int64)
plsScoreValue
  = lens _plsScoreValue
      (\ s a -> s{_plsScoreValue = a})
      . mapping _Coerce

-- | The time span of this score. Possible values are: - \"ALL_TIME\" - The
-- score is an all-time score. - \"WEEKLY\" - The score is a weekly score.
-- - \"DAILY\" - The score is a daily score.
plsTimeSpan :: Lens' PlayerLeaderboardScore (Maybe Text)
plsTimeSpan
  = lens _plsTimeSpan (\ s a -> s{_plsTimeSpan = a})

-- | The public rank of the score in this leaderboard. This object will not
-- be present if the user is not sharing their scores publicly.
plsPublicRank :: Lens' PlayerLeaderboardScore (Maybe LeaderboardScoreRank)
plsPublicRank
  = lens _plsPublicRank
      (\ s a -> s{_plsPublicRank = a})

-- | The social rank of the score in this leaderboard.
plsSocialRank :: Lens' PlayerLeaderboardScore (Maybe LeaderboardScoreRank)
plsSocialRank
  = lens _plsSocialRank
      (\ s a -> s{_plsSocialRank = a})

-- | The ID of the leaderboard this score is in.
plsLeaderboardId :: Lens' PlayerLeaderboardScore (Maybe Text)
plsLeaderboardId
  = lens _plsLeaderboardId
      (\ s a -> s{_plsLeaderboardId = a})

-- | The timestamp at which this score was recorded, in milliseconds since
-- the epoch in UTC.
plsWriteTimestamp :: Lens' PlayerLeaderboardScore (Maybe Int64)
plsWriteTimestamp
  = lens _plsWriteTimestamp
      (\ s a -> s{_plsWriteTimestamp = a})
      . mapping _Coerce

instance FromJSON PlayerLeaderboardScore where
        parseJSON
          = withObject "PlayerLeaderboardScore"
              (\ o ->
                 PlayerLeaderboardScore' <$>
                   (o .:? "scoreTag") <*> (o .:? "scoreString") <*>
                     (o .:? "kind" .!= "games#playerLeaderboardScore")
                     <*> (o .:? "scoreValue")
                     <*> (o .:? "timeSpan")
                     <*> (o .:? "publicRank")
                     <*> (o .:? "socialRank")
                     <*> (o .:? "leaderboard_id")
                     <*> (o .:? "writeTimestamp"))

instance ToJSON PlayerLeaderboardScore where
        toJSON PlayerLeaderboardScore'{..}
          = object
              (catMaybes
                 [("scoreTag" .=) <$> _plsScoreTag,
                  ("scoreString" .=) <$> _plsScoreString,
                  Just ("kind" .= _plsKind),
                  ("scoreValue" .=) <$> _plsScoreValue,
                  ("timeSpan" .=) <$> _plsTimeSpan,
                  ("publicRank" .=) <$> _plsPublicRank,
                  ("socialRank" .=) <$> _plsSocialRank,
                  ("leaderboard_id" .=) <$> _plsLeaderboardId,
                  ("writeTimestamp" .=) <$> _plsWriteTimestamp])

-- | This is a JSON template for the Application resource.
--
-- /See:/ 'application' smart constructor.
data Application = Application'
    { _aThemeColor           :: !(Maybe Text)
    , _aLeaderboardCount     :: !(Maybe (Textual Int32))
    , _aKind                 :: !Text
    , _aCategory             :: !(Maybe ApplicationCategory)
    , _aName                 :: !(Maybe Text)
    , _aEnabledFeatures      :: !(Maybe [Text])
    , _aInstances            :: !(Maybe [Instance])
    , _aAuthor               :: !(Maybe Text)
    , _aId                   :: !(Maybe Text)
    , _aAchievementCount     :: !(Maybe (Textual Int32))
    , _aAssets               :: !(Maybe [ImageAsset])
    , _aDescription          :: !(Maybe Text)
    , _aLastUpdatedTimestamp :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Application' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aThemeColor'
--
-- * 'aLeaderboardCount'
--
-- * 'aKind'
--
-- * 'aCategory'
--
-- * 'aName'
--
-- * 'aEnabledFeatures'
--
-- * 'aInstances'
--
-- * 'aAuthor'
--
-- * 'aId'
--
-- * 'aAchievementCount'
--
-- * 'aAssets'
--
-- * 'aDescription'
--
-- * 'aLastUpdatedTimestamp'
application
    :: Application
application =
    Application'
    { _aThemeColor = Nothing
    , _aLeaderboardCount = Nothing
    , _aKind = "games#application"
    , _aCategory = Nothing
    , _aName = Nothing
    , _aEnabledFeatures = Nothing
    , _aInstances = Nothing
    , _aAuthor = Nothing
    , _aId = Nothing
    , _aAchievementCount = Nothing
    , _aAssets = Nothing
    , _aDescription = Nothing
    , _aLastUpdatedTimestamp = Nothing
    }

-- | A hint to the client UI for what color to use as an app-themed color.
-- The color is given as an RGB triplet (e.g. \"E0E0E0\").
aThemeColor :: Lens' Application (Maybe Text)
aThemeColor
  = lens _aThemeColor (\ s a -> s{_aThemeColor = a})

-- | The number of leaderboards visible to the currently authenticated
-- player.
aLeaderboardCount :: Lens' Application (Maybe Int32)
aLeaderboardCount
  = lens _aLeaderboardCount
      (\ s a -> s{_aLeaderboardCount = a})
      . mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#application.
aKind :: Lens' Application Text
aKind = lens _aKind (\ s a -> s{_aKind = a})

-- | The category of the application.
aCategory :: Lens' Application (Maybe ApplicationCategory)
aCategory
  = lens _aCategory (\ s a -> s{_aCategory = a})

-- | The name of the application.
aName :: Lens' Application (Maybe Text)
aName = lens _aName (\ s a -> s{_aName = a})

-- | A list of features that have been enabled for the application. Possible
-- values are: - \"SNAPSHOTS\" - Snapshots has been enabled
aEnabledFeatures :: Lens' Application [Text]
aEnabledFeatures
  = lens _aEnabledFeatures
      (\ s a -> s{_aEnabledFeatures = a})
      . _Default
      . _Coerce

-- | The instances of the application.
aInstances :: Lens' Application [Instance]
aInstances
  = lens _aInstances (\ s a -> s{_aInstances = a}) .
      _Default
      . _Coerce

-- | The author of the application.
aAuthor :: Lens' Application (Maybe Text)
aAuthor = lens _aAuthor (\ s a -> s{_aAuthor = a})

-- | The ID of the application.
aId :: Lens' Application (Maybe Text)
aId = lens _aId (\ s a -> s{_aId = a})

-- | The number of achievements visible to the currently authenticated
-- player.
aAchievementCount :: Lens' Application (Maybe Int32)
aAchievementCount
  = lens _aAchievementCount
      (\ s a -> s{_aAchievementCount = a})
      . mapping _Coerce

-- | The assets of the application.
aAssets :: Lens' Application [ImageAsset]
aAssets
  = lens _aAssets (\ s a -> s{_aAssets = a}) . _Default
      . _Coerce

-- | The description of the application.
aDescription :: Lens' Application (Maybe Text)
aDescription
  = lens _aDescription (\ s a -> s{_aDescription = a})

-- | The last updated timestamp of the application.
aLastUpdatedTimestamp :: Lens' Application (Maybe Int64)
aLastUpdatedTimestamp
  = lens _aLastUpdatedTimestamp
      (\ s a -> s{_aLastUpdatedTimestamp = a})
      . mapping _Coerce

instance FromJSON Application where
        parseJSON
          = withObject "Application"
              (\ o ->
                 Application' <$>
                   (o .:? "themeColor") <*> (o .:? "leaderboard_count")
                     <*> (o .:? "kind" .!= "games#application")
                     <*> (o .:? "category")
                     <*> (o .:? "name")
                     <*> (o .:? "enabledFeatures" .!= mempty)
                     <*> (o .:? "instances" .!= mempty)
                     <*> (o .:? "author")
                     <*> (o .:? "id")
                     <*> (o .:? "achievement_count")
                     <*> (o .:? "assets" .!= mempty)
                     <*> (o .:? "description")
                     <*> (o .:? "lastUpdatedTimestamp"))

instance ToJSON Application where
        toJSON Application'{..}
          = object
              (catMaybes
                 [("themeColor" .=) <$> _aThemeColor,
                  ("leaderboard_count" .=) <$> _aLeaderboardCount,
                  Just ("kind" .= _aKind),
                  ("category" .=) <$> _aCategory,
                  ("name" .=) <$> _aName,
                  ("enabledFeatures" .=) <$> _aEnabledFeatures,
                  ("instances" .=) <$> _aInstances,
                  ("author" .=) <$> _aAuthor, ("id" .=) <$> _aId,
                  ("achievement_count" .=) <$> _aAchievementCount,
                  ("assets" .=) <$> _aAssets,
                  ("description" .=) <$> _aDescription,
                  ("lastUpdatedTimestamp" .=) <$>
                    _aLastUpdatedTimestamp])

-- | This is a JSON template for an application category object.
--
-- /See:/ 'applicationCategory' smart constructor.
data ApplicationCategory = ApplicationCategory'
    { _acSecondary :: !(Maybe Text)
    , _acKind      :: !Text
    , _acPrimary   :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ApplicationCategory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'acSecondary'
--
-- * 'acKind'
--
-- * 'acPrimary'
applicationCategory
    :: ApplicationCategory
applicationCategory =
    ApplicationCategory'
    { _acSecondary = Nothing
    , _acKind = "games#applicationCategory"
    , _acPrimary = Nothing
    }

-- | The secondary category.
acSecondary :: Lens' ApplicationCategory (Maybe Text)
acSecondary
  = lens _acSecondary (\ s a -> s{_acSecondary = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#applicationCategory.
acKind :: Lens' ApplicationCategory Text
acKind = lens _acKind (\ s a -> s{_acKind = a})

-- | The primary category.
acPrimary :: Lens' ApplicationCategory (Maybe Text)
acPrimary
  = lens _acPrimary (\ s a -> s{_acPrimary = a})

instance FromJSON ApplicationCategory where
        parseJSON
          = withObject "ApplicationCategory"
              (\ o ->
                 ApplicationCategory' <$>
                   (o .:? "secondary") <*>
                     (o .:? "kind" .!= "games#applicationCategory")
                     <*> (o .:? "primary"))

instance ToJSON ApplicationCategory where
        toJSON ApplicationCategory'{..}
          = object
              (catMaybes
                 [("secondary" .=) <$> _acSecondary,
                  Just ("kind" .= _acKind),
                  ("primary" .=) <$> _acPrimary])

-- | This is a JSON template for a list of score submission statuses.
--
-- /See:/ 'playerScoreListResponse' smart constructor.
data PlayerScoreListResponse = PlayerScoreListResponse'
    { _pslrSubmittedScores :: !(Maybe [PlayerScoreResponse])
    , _pslrKind            :: !Text
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerScoreListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pslrSubmittedScores'
--
-- * 'pslrKind'
playerScoreListResponse
    :: PlayerScoreListResponse
playerScoreListResponse =
    PlayerScoreListResponse'
    { _pslrSubmittedScores = Nothing
    , _pslrKind = "games#playerScoreListResponse"
    }

-- | The score submissions statuses.
pslrSubmittedScores :: Lens' PlayerScoreListResponse [PlayerScoreResponse]
pslrSubmittedScores
  = lens _pslrSubmittedScores
      (\ s a -> s{_pslrSubmittedScores = a})
      . _Default
      . _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerScoreListResponse.
pslrKind :: Lens' PlayerScoreListResponse Text
pslrKind = lens _pslrKind (\ s a -> s{_pslrKind = a})

instance FromJSON PlayerScoreListResponse where
        parseJSON
          = withObject "PlayerScoreListResponse"
              (\ o ->
                 PlayerScoreListResponse' <$>
                   (o .:? "submittedScores" .!= mempty) <*>
                     (o .:? "kind" .!= "games#playerScoreListResponse"))

instance ToJSON PlayerScoreListResponse where
        toJSON PlayerScoreListResponse'{..}
          = object
              (catMaybes
                 [("submittedScores" .=) <$> _pslrSubmittedScores,
                  Just ("kind" .= _pslrKind)])

-- | This is a JSON template for network diagnostics reported for a client.
--
-- /See:/ 'networkDiagnostics' smart constructor.
data NetworkDiagnostics = NetworkDiagnostics'
    { _ndAndroidNetworkType        :: !(Maybe (Textual Int32))
    , _ndKind                      :: !Text
    , _ndNetworkOperatorCode       :: !(Maybe Text)
    , _ndNetworkOperatorName       :: !(Maybe Text)
    , _ndRegistrationLatencyMillis :: !(Maybe (Textual Int32))
    , _ndIosNetworkType            :: !(Maybe (Textual Int32))
    , _ndAndroidNetworkSubtype     :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'NetworkDiagnostics' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ndAndroidNetworkType'
--
-- * 'ndKind'
--
-- * 'ndNetworkOperatorCode'
--
-- * 'ndNetworkOperatorName'
--
-- * 'ndRegistrationLatencyMillis'
--
-- * 'ndIosNetworkType'
--
-- * 'ndAndroidNetworkSubtype'
networkDiagnostics
    :: NetworkDiagnostics
networkDiagnostics =
    NetworkDiagnostics'
    { _ndAndroidNetworkType = Nothing
    , _ndKind = "games#networkDiagnostics"
    , _ndNetworkOperatorCode = Nothing
    , _ndNetworkOperatorName = Nothing
    , _ndRegistrationLatencyMillis = Nothing
    , _ndIosNetworkType = Nothing
    , _ndAndroidNetworkSubtype = Nothing
    }

-- | The Android network type.
ndAndroidNetworkType :: Lens' NetworkDiagnostics (Maybe Int32)
ndAndroidNetworkType
  = lens _ndAndroidNetworkType
      (\ s a -> s{_ndAndroidNetworkType = a})
      . mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#networkDiagnostics.
ndKind :: Lens' NetworkDiagnostics Text
ndKind = lens _ndKind (\ s a -> s{_ndKind = a})

-- | The MCC+MNC code for the client\'s network connection. On Android:
-- http:\/\/developer.android.com\/reference\/android\/telephony\/TelephonyManager.html#getNetworkOperator()
-- On iOS, see:
-- https:\/\/developer.apple.com\/library\/ios\/documentation\/NetworkingInternet\/Reference\/CTCarrier\/Reference\/Reference.html
ndNetworkOperatorCode :: Lens' NetworkDiagnostics (Maybe Text)
ndNetworkOperatorCode
  = lens _ndNetworkOperatorCode
      (\ s a -> s{_ndNetworkOperatorCode = a})

-- | The name of the carrier of the client\'s network connection. On Android:
-- http:\/\/developer.android.com\/reference\/android\/telephony\/TelephonyManager.html#getNetworkOperatorName()
-- On iOS:
-- https:\/\/developer.apple.com\/library\/ios\/documentation\/NetworkingInternet\/Reference\/CTCarrier\/Reference\/Reference.html#\/\/apple_ref\/occ\/instp\/CTCarrier\/carrierName
ndNetworkOperatorName :: Lens' NetworkDiagnostics (Maybe Text)
ndNetworkOperatorName
  = lens _ndNetworkOperatorName
      (\ s a -> s{_ndNetworkOperatorName = a})

-- | The amount of time in milliseconds it took for the client to establish a
-- connection with the XMPP server.
ndRegistrationLatencyMillis :: Lens' NetworkDiagnostics (Maybe Int32)
ndRegistrationLatencyMillis
  = lens _ndRegistrationLatencyMillis
      (\ s a -> s{_ndRegistrationLatencyMillis = a})
      . mapping _Coerce

-- | iOS network type as defined in Reachability.h.
ndIosNetworkType :: Lens' NetworkDiagnostics (Maybe Int32)
ndIosNetworkType
  = lens _ndIosNetworkType
      (\ s a -> s{_ndIosNetworkType = a})
      . mapping _Coerce

-- | The Android network subtype.
ndAndroidNetworkSubtype :: Lens' NetworkDiagnostics (Maybe Int32)
ndAndroidNetworkSubtype
  = lens _ndAndroidNetworkSubtype
      (\ s a -> s{_ndAndroidNetworkSubtype = a})
      . mapping _Coerce

instance FromJSON NetworkDiagnostics where
        parseJSON
          = withObject "NetworkDiagnostics"
              (\ o ->
                 NetworkDiagnostics' <$>
                   (o .:? "androidNetworkType") <*>
                     (o .:? "kind" .!= "games#networkDiagnostics")
                     <*> (o .:? "networkOperatorCode")
                     <*> (o .:? "networkOperatorName")
                     <*> (o .:? "registrationLatencyMillis")
                     <*> (o .:? "iosNetworkType")
                     <*> (o .:? "androidNetworkSubtype"))

instance ToJSON NetworkDiagnostics where
        toJSON NetworkDiagnostics'{..}
          = object
              (catMaybes
                 [("androidNetworkType" .=) <$> _ndAndroidNetworkType,
                  Just ("kind" .= _ndKind),
                  ("networkOperatorCode" .=) <$>
                    _ndNetworkOperatorCode,
                  ("networkOperatorName" .=) <$>
                    _ndNetworkOperatorName,
                  ("registrationLatencyMillis" .=) <$>
                    _ndRegistrationLatencyMillis,
                  ("iosNetworkType" .=) <$> _ndIosNetworkType,
                  ("androidNetworkSubtype" .=) <$>
                    _ndAndroidNetworkSubtype])

-- | This is a JSON template for the object representing a turn.
--
-- /See:/ 'turnBasedMatchTurn' smart constructor.
data TurnBasedMatchTurn = TurnBasedMatchTurn'
    { _tbmtResults              :: !(Maybe [ParticipantResult])
    , _tbmtKind                 :: !Text
    , _tbmtData                 :: !(Maybe TurnBasedMatchDataRequest)
    , _tbmtPendingParticipantId :: !(Maybe Text)
    , _tbmtMatchVersion         :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TurnBasedMatchTurn' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tbmtResults'
--
-- * 'tbmtKind'
--
-- * 'tbmtData'
--
-- * 'tbmtPendingParticipantId'
--
-- * 'tbmtMatchVersion'
turnBasedMatchTurn
    :: TurnBasedMatchTurn
turnBasedMatchTurn =
    TurnBasedMatchTurn'
    { _tbmtResults = Nothing
    , _tbmtKind = "games#turnBasedMatchTurn"
    , _tbmtData = Nothing
    , _tbmtPendingParticipantId = Nothing
    , _tbmtMatchVersion = Nothing
    }

-- | The match results for the participants in the match.
tbmtResults :: Lens' TurnBasedMatchTurn [ParticipantResult]
tbmtResults
  = lens _tbmtResults (\ s a -> s{_tbmtResults = a}) .
      _Default
      . _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#turnBasedMatchTurn.
tbmtKind :: Lens' TurnBasedMatchTurn Text
tbmtKind = lens _tbmtKind (\ s a -> s{_tbmtKind = a})

-- | The shared game state data after the turn is over.
tbmtData :: Lens' TurnBasedMatchTurn (Maybe TurnBasedMatchDataRequest)
tbmtData = lens _tbmtData (\ s a -> s{_tbmtData = a})

-- | The ID of the participant who should take their turn next. May be set to
-- the current player\'s participant ID to update match state without
-- changing the turn. If not set, the match will wait for other player(s)
-- to join via automatching; this is only valid if automatch criteria is
-- set on the match with remaining slots for automatched players.
tbmtPendingParticipantId :: Lens' TurnBasedMatchTurn (Maybe Text)
tbmtPendingParticipantId
  = lens _tbmtPendingParticipantId
      (\ s a -> s{_tbmtPendingParticipantId = a})

-- | The version of this match: an increasing counter, used to avoid
-- out-of-date updates to the match.
tbmtMatchVersion :: Lens' TurnBasedMatchTurn (Maybe Int32)
tbmtMatchVersion
  = lens _tbmtMatchVersion
      (\ s a -> s{_tbmtMatchVersion = a})
      . mapping _Coerce

instance FromJSON TurnBasedMatchTurn where
        parseJSON
          = withObject "TurnBasedMatchTurn"
              (\ o ->
                 TurnBasedMatchTurn' <$>
                   (o .:? "results" .!= mempty) <*>
                     (o .:? "kind" .!= "games#turnBasedMatchTurn")
                     <*> (o .:? "data")
                     <*> (o .:? "pendingParticipantId")
                     <*> (o .:? "matchVersion"))

instance ToJSON TurnBasedMatchTurn where
        toJSON TurnBasedMatchTurn'{..}
          = object
              (catMaybes
                 [("results" .=) <$> _tbmtResults,
                  Just ("kind" .= _tbmtKind),
                  ("data" .=) <$> _tbmtData,
                  ("pendingParticipantId" .=) <$>
                    _tbmtPendingParticipantId,
                  ("matchVersion" .=) <$> _tbmtMatchVersion])

-- | This is a JSON template for a Quest Criterion resource.
--
-- /See:/ 'questCriterion' smart constructor.
data QuestCriterion = QuestCriterion'
    { _qcCurrentContribution    :: !(Maybe QuestContribution)
    , _qcCompletionContribution :: !(Maybe QuestContribution)
    , _qcKind                   :: !Text
    , _qcInitialPlayerProgress  :: !(Maybe QuestContribution)
    , _qcEventId                :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QuestCriterion' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qcCurrentContribution'
--
-- * 'qcCompletionContribution'
--
-- * 'qcKind'
--
-- * 'qcInitialPlayerProgress'
--
-- * 'qcEventId'
questCriterion
    :: QuestCriterion
questCriterion =
    QuestCriterion'
    { _qcCurrentContribution = Nothing
    , _qcCompletionContribution = Nothing
    , _qcKind = "games#questCriterion"
    , _qcInitialPlayerProgress = Nothing
    , _qcEventId = Nothing
    }

-- | The number of increments the player has made toward the completion count
-- event increments required to complete the quest. This value will not
-- exceed the completion contribution. There will be no currentContribution
-- until the player has accepted the quest.
qcCurrentContribution :: Lens' QuestCriterion (Maybe QuestContribution)
qcCurrentContribution
  = lens _qcCurrentContribution
      (\ s a -> s{_qcCurrentContribution = a})

-- | The total number of times the associated event must be incremented for
-- the player to complete this quest.
qcCompletionContribution :: Lens' QuestCriterion (Maybe QuestContribution)
qcCompletionContribution
  = lens _qcCompletionContribution
      (\ s a -> s{_qcCompletionContribution = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#questCriterion.
qcKind :: Lens' QuestCriterion Text
qcKind = lens _qcKind (\ s a -> s{_qcKind = a})

-- | The value of the event associated with this quest at the time that the
-- quest was accepted. This value may change if event increments that took
-- place before the start of quest are uploaded after the quest starts.
-- There will be no initialPlayerProgress until the player has accepted the
-- quest.
qcInitialPlayerProgress :: Lens' QuestCriterion (Maybe QuestContribution)
qcInitialPlayerProgress
  = lens _qcInitialPlayerProgress
      (\ s a -> s{_qcInitialPlayerProgress = a})

-- | The ID of the event the criterion corresponds to.
qcEventId :: Lens' QuestCriterion (Maybe Text)
qcEventId
  = lens _qcEventId (\ s a -> s{_qcEventId = a})

instance FromJSON QuestCriterion where
        parseJSON
          = withObject "QuestCriterion"
              (\ o ->
                 QuestCriterion' <$>
                   (o .:? "currentContribution") <*>
                     (o .:? "completionContribution")
                     <*> (o .:? "kind" .!= "games#questCriterion")
                     <*> (o .:? "initialPlayerProgress")
                     <*> (o .:? "eventId"))

instance ToJSON QuestCriterion where
        toJSON QuestCriterion'{..}
          = object
              (catMaybes
                 [("currentContribution" .=) <$>
                    _qcCurrentContribution,
                  ("completionContribution" .=) <$>
                    _qcCompletionContribution,
                  Just ("kind" .= _qcKind),
                  ("initialPlayerProgress" .=) <$>
                    _qcInitialPlayerProgress,
                  ("eventId" .=) <$> _qcEventId])

-- | This is a JSON template for a list of turn-based matches.
--
-- /See:/ 'turnBasedMatchList' smart constructor.
data TurnBasedMatchList = TurnBasedMatchList'
    { _tbmlNextPageToken :: !(Maybe Text)
    , _tbmlKind          :: !Text
    , _tbmlItems         :: !(Maybe [TurnBasedMatch])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TurnBasedMatchList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tbmlNextPageToken'
--
-- * 'tbmlKind'
--
-- * 'tbmlItems'
turnBasedMatchList
    :: TurnBasedMatchList
turnBasedMatchList =
    TurnBasedMatchList'
    { _tbmlNextPageToken = Nothing
    , _tbmlKind = "games#turnBasedMatchList"
    , _tbmlItems = Nothing
    }

-- | The pagination token for the next page of results.
tbmlNextPageToken :: Lens' TurnBasedMatchList (Maybe Text)
tbmlNextPageToken
  = lens _tbmlNextPageToken
      (\ s a -> s{_tbmlNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#turnBasedMatchList.
tbmlKind :: Lens' TurnBasedMatchList Text
tbmlKind = lens _tbmlKind (\ s a -> s{_tbmlKind = a})

-- | The matches.
tbmlItems :: Lens' TurnBasedMatchList [TurnBasedMatch]
tbmlItems
  = lens _tbmlItems (\ s a -> s{_tbmlItems = a}) .
      _Default
      . _Coerce

instance FromJSON TurnBasedMatchList where
        parseJSON
          = withObject "TurnBasedMatchList"
              (\ o ->
                 TurnBasedMatchList' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "games#turnBasedMatchList")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON TurnBasedMatchList where
        toJSON TurnBasedMatchList'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _tbmlNextPageToken,
                  Just ("kind" .= _tbmlKind),
                  ("items" .=) <$> _tbmlItems])

-- | This is a JSON template for peer channel diagnostics.
--
-- /See:/ 'peerChannelDiagnostics' smart constructor.
data PeerChannelDiagnostics = PeerChannelDiagnostics'
    { _pcdNumMessagesLost        :: !(Maybe (Textual Int32))
    , _pcdBytesSent              :: !(Maybe AggregateStats)
    , _pcdKind                   :: !Text
    , _pcdRoundtripLatencyMillis :: !(Maybe AggregateStats)
    , _pcdBytesReceived          :: !(Maybe AggregateStats)
    , _pcdNumMessagesReceived    :: !(Maybe (Textual Int32))
    , _pcdNumSendFailures        :: !(Maybe (Textual Int32))
    , _pcdNumMessagesSent        :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PeerChannelDiagnostics' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pcdNumMessagesLost'
--
-- * 'pcdBytesSent'
--
-- * 'pcdKind'
--
-- * 'pcdRoundtripLatencyMillis'
--
-- * 'pcdBytesReceived'
--
-- * 'pcdNumMessagesReceived'
--
-- * 'pcdNumSendFailures'
--
-- * 'pcdNumMessagesSent'
peerChannelDiagnostics
    :: PeerChannelDiagnostics
peerChannelDiagnostics =
    PeerChannelDiagnostics'
    { _pcdNumMessagesLost = Nothing
    , _pcdBytesSent = Nothing
    , _pcdKind = "games#peerChannelDiagnostics"
    , _pcdRoundtripLatencyMillis = Nothing
    , _pcdBytesReceived = Nothing
    , _pcdNumMessagesReceived = Nothing
    , _pcdNumSendFailures = Nothing
    , _pcdNumMessagesSent = Nothing
    }

-- | Number of messages lost.
pcdNumMessagesLost :: Lens' PeerChannelDiagnostics (Maybe Int32)
pcdNumMessagesLost
  = lens _pcdNumMessagesLost
      (\ s a -> s{_pcdNumMessagesLost = a})
      . mapping _Coerce

-- | Number of bytes sent.
pcdBytesSent :: Lens' PeerChannelDiagnostics (Maybe AggregateStats)
pcdBytesSent
  = lens _pcdBytesSent (\ s a -> s{_pcdBytesSent = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#peerChannelDiagnostics.
pcdKind :: Lens' PeerChannelDiagnostics Text
pcdKind = lens _pcdKind (\ s a -> s{_pcdKind = a})

-- | Roundtrip latency stats in milliseconds.
pcdRoundtripLatencyMillis :: Lens' PeerChannelDiagnostics (Maybe AggregateStats)
pcdRoundtripLatencyMillis
  = lens _pcdRoundtripLatencyMillis
      (\ s a -> s{_pcdRoundtripLatencyMillis = a})

-- | Number of bytes received.
pcdBytesReceived :: Lens' PeerChannelDiagnostics (Maybe AggregateStats)
pcdBytesReceived
  = lens _pcdBytesReceived
      (\ s a -> s{_pcdBytesReceived = a})

-- | Number of messages received.
pcdNumMessagesReceived :: Lens' PeerChannelDiagnostics (Maybe Int32)
pcdNumMessagesReceived
  = lens _pcdNumMessagesReceived
      (\ s a -> s{_pcdNumMessagesReceived = a})
      . mapping _Coerce

-- | Number of send failures.
pcdNumSendFailures :: Lens' PeerChannelDiagnostics (Maybe Int32)
pcdNumSendFailures
  = lens _pcdNumSendFailures
      (\ s a -> s{_pcdNumSendFailures = a})
      . mapping _Coerce

-- | Number of messages sent.
pcdNumMessagesSent :: Lens' PeerChannelDiagnostics (Maybe Int32)
pcdNumMessagesSent
  = lens _pcdNumMessagesSent
      (\ s a -> s{_pcdNumMessagesSent = a})
      . mapping _Coerce

instance FromJSON PeerChannelDiagnostics where
        parseJSON
          = withObject "PeerChannelDiagnostics"
              (\ o ->
                 PeerChannelDiagnostics' <$>
                   (o .:? "numMessagesLost") <*> (o .:? "bytesSent") <*>
                     (o .:? "kind" .!= "games#peerChannelDiagnostics")
                     <*> (o .:? "roundtripLatencyMillis")
                     <*> (o .:? "bytesReceived")
                     <*> (o .:? "numMessagesReceived")
                     <*> (o .:? "numSendFailures")
                     <*> (o .:? "numMessagesSent"))

instance ToJSON PeerChannelDiagnostics where
        toJSON PeerChannelDiagnostics'{..}
          = object
              (catMaybes
                 [("numMessagesLost" .=) <$> _pcdNumMessagesLost,
                  ("bytesSent" .=) <$> _pcdBytesSent,
                  Just ("kind" .= _pcdKind),
                  ("roundtripLatencyMillis" .=) <$>
                    _pcdRoundtripLatencyMillis,
                  ("bytesReceived" .=) <$> _pcdBytesReceived,
                  ("numMessagesReceived" .=) <$>
                    _pcdNumMessagesReceived,
                  ("numSendFailures" .=) <$> _pcdNumSendFailures,
                  ("numMessagesSent" .=) <$> _pcdNumMessagesSent])

-- | This is a JSON template for a list of rooms.
--
-- /See:/ 'roomList' smart constructor.
data RoomList = RoomList'
    { _rlNextPageToken :: !(Maybe Text)
    , _rlKind          :: !Text
    , _rlItems         :: !(Maybe [Room])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RoomList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rlNextPageToken'
--
-- * 'rlKind'
--
-- * 'rlItems'
roomList
    :: RoomList
roomList =
    RoomList'
    { _rlNextPageToken = Nothing
    , _rlKind = "games#roomList"
    , _rlItems = Nothing
    }

-- | The pagination token for the next page of results.
rlNextPageToken :: Lens' RoomList (Maybe Text)
rlNextPageToken
  = lens _rlNextPageToken
      (\ s a -> s{_rlNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#roomList.
rlKind :: Lens' RoomList Text
rlKind = lens _rlKind (\ s a -> s{_rlKind = a})

-- | The rooms.
rlItems :: Lens' RoomList [Room]
rlItems
  = lens _rlItems (\ s a -> s{_rlItems = a}) . _Default
      . _Coerce

instance FromJSON RoomList where
        parseJSON
          = withObject "RoomList"
              (\ o ->
                 RoomList' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "games#roomList")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON RoomList where
        toJSON RoomList'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _rlNextPageToken,
                  Just ("kind" .= _rlKind), ("items" .=) <$> _rlItems])

-- | This is a JSON template for a push token resource.
--
-- /See:/ 'pushToken' smart constructor.
data PushToken = PushToken'
    { _ptClientRevision :: !(Maybe Text)
    , _ptKind           :: !Text
    , _ptLanguage       :: !(Maybe Text)
    , _ptId             :: !(Maybe PushTokenId)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PushToken' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptClientRevision'
--
-- * 'ptKind'
--
-- * 'ptLanguage'
--
-- * 'ptId'
pushToken
    :: PushToken
pushToken =
    PushToken'
    { _ptClientRevision = Nothing
    , _ptKind = "games#pushToken"
    , _ptLanguage = Nothing
    , _ptId = Nothing
    }

-- | The revision of the client SDK used by your application, in the same
-- format that\'s used by revisions.check. Used to send backward compatible
-- messages. Format: [PLATFORM_TYPE]:[VERSION_NUMBER]. Possible values of
-- PLATFORM_TYPE are: - IOS - Push token is for iOS
ptClientRevision :: Lens' PushToken (Maybe Text)
ptClientRevision
  = lens _ptClientRevision
      (\ s a -> s{_ptClientRevision = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#pushToken.
ptKind :: Lens' PushToken Text
ptKind = lens _ptKind (\ s a -> s{_ptKind = a})

-- | The preferred language for notifications that are sent using this token.
ptLanguage :: Lens' PushToken (Maybe Text)
ptLanguage
  = lens _ptLanguage (\ s a -> s{_ptLanguage = a})

-- | Unique identifier for this push token.
ptId :: Lens' PushToken (Maybe PushTokenId)
ptId = lens _ptId (\ s a -> s{_ptId = a})

instance FromJSON PushToken where
        parseJSON
          = withObject "PushToken"
              (\ o ->
                 PushToken' <$>
                   (o .:? "clientRevision") <*>
                     (o .:? "kind" .!= "games#pushToken")
                     <*> (o .:? "language")
                     <*> (o .:? "id"))

instance ToJSON PushToken where
        toJSON PushToken'{..}
          = object
              (catMaybes
                 [("clientRevision" .=) <$> _ptClientRevision,
                  Just ("kind" .= _ptKind),
                  ("language" .=) <$> _ptLanguage,
                  ("id" .=) <$> _ptId])

-- | This is a JSON template for an achievement update response.
--
-- /See:/ 'achievementUpdateResponse' smart constructor.
data AchievementUpdateResponse = AchievementUpdateResponse'
    { _aurUpdateOccurred :: !(Maybe Bool)
    , _aurAchievementId  :: !(Maybe Text)
    , _aurKind           :: !Text
    , _aurCurrentState   :: !(Maybe Text)
    , _aurNewlyUnlocked  :: !(Maybe Bool)
    , _aurCurrentSteps   :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'AchievementUpdateResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aurUpdateOccurred'
--
-- * 'aurAchievementId'
--
-- * 'aurKind'
--
-- * 'aurCurrentState'
--
-- * 'aurNewlyUnlocked'
--
-- * 'aurCurrentSteps'
achievementUpdateResponse
    :: AchievementUpdateResponse
achievementUpdateResponse =
    AchievementUpdateResponse'
    { _aurUpdateOccurred = Nothing
    , _aurAchievementId = Nothing
    , _aurKind = "games#achievementUpdateResponse"
    , _aurCurrentState = Nothing
    , _aurNewlyUnlocked = Nothing
    , _aurCurrentSteps = Nothing
    }

-- | Whether the requested updates actually affected the achievement.
aurUpdateOccurred :: Lens' AchievementUpdateResponse (Maybe Bool)
aurUpdateOccurred
  = lens _aurUpdateOccurred
      (\ s a -> s{_aurUpdateOccurred = a})

-- | The achievement this update is was applied to.
aurAchievementId :: Lens' AchievementUpdateResponse (Maybe Text)
aurAchievementId
  = lens _aurAchievementId
      (\ s a -> s{_aurAchievementId = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#achievementUpdateResponse.
aurKind :: Lens' AchievementUpdateResponse Text
aurKind = lens _aurKind (\ s a -> s{_aurKind = a})

-- | The current state of the achievement. Possible values are: - \"HIDDEN\"
-- - Achievement is hidden. - \"REVEALED\" - Achievement is revealed. -
-- \"UNLOCKED\" - Achievement is unlocked.
aurCurrentState :: Lens' AchievementUpdateResponse (Maybe Text)
aurCurrentState
  = lens _aurCurrentState
      (\ s a -> s{_aurCurrentState = a})

-- | Whether this achievement was newly unlocked (that is, whether the unlock
-- request for the achievement was the first for the player).
aurNewlyUnlocked :: Lens' AchievementUpdateResponse (Maybe Bool)
aurNewlyUnlocked
  = lens _aurNewlyUnlocked
      (\ s a -> s{_aurNewlyUnlocked = a})

-- | The current steps recorded for this achievement if it is incremental.
aurCurrentSteps :: Lens' AchievementUpdateResponse (Maybe Int32)
aurCurrentSteps
  = lens _aurCurrentSteps
      (\ s a -> s{_aurCurrentSteps = a})
      . mapping _Coerce

instance FromJSON AchievementUpdateResponse where
        parseJSON
          = withObject "AchievementUpdateResponse"
              (\ o ->
                 AchievementUpdateResponse' <$>
                   (o .:? "updateOccurred") <*> (o .:? "achievementId")
                     <*>
                     (o .:? "kind" .!= "games#achievementUpdateResponse")
                     <*> (o .:? "currentState")
                     <*> (o .:? "newlyUnlocked")
                     <*> (o .:? "currentSteps"))

instance ToJSON AchievementUpdateResponse where
        toJSON AchievementUpdateResponse'{..}
          = object
              (catMaybes
                 [("updateOccurred" .=) <$> _aurUpdateOccurred,
                  ("achievementId" .=) <$> _aurAchievementId,
                  Just ("kind" .= _aurKind),
                  ("currentState" .=) <$> _aurCurrentState,
                  ("newlyUnlocked" .=) <$> _aurNewlyUnlocked,
                  ("currentSteps" .=) <$> _aurCurrentSteps])

-- | This is a JSON template for the Leaderboard Entry resource.
--
-- /See:/ 'leaderboardEntry' smart constructor.
data LeaderboardEntry = LeaderboardEntry'
    { _leScoreTag             :: !(Maybe Text)
    , _leWriteTimestampMillis :: !(Maybe (Textual Int64))
    , _leKind                 :: !Text
    , _leScoreValue           :: !(Maybe (Textual Int64))
    , _leFormattedScore       :: !(Maybe Text)
    , _leTimeSpan             :: !(Maybe Text)
    , _leFormattedScoreRank   :: !(Maybe Text)
    , _lePlayer               :: !(Maybe Player)
    , _leScoreRank            :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'LeaderboardEntry' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'leScoreTag'
--
-- * 'leWriteTimestampMillis'
--
-- * 'leKind'
--
-- * 'leScoreValue'
--
-- * 'leFormattedScore'
--
-- * 'leTimeSpan'
--
-- * 'leFormattedScoreRank'
--
-- * 'lePlayer'
--
-- * 'leScoreRank'
leaderboardEntry
    :: LeaderboardEntry
leaderboardEntry =
    LeaderboardEntry'
    { _leScoreTag = Nothing
    , _leWriteTimestampMillis = Nothing
    , _leKind = "games#leaderboardEntry"
    , _leScoreValue = Nothing
    , _leFormattedScore = Nothing
    , _leTimeSpan = Nothing
    , _leFormattedScoreRank = Nothing
    , _lePlayer = Nothing
    , _leScoreRank = Nothing
    }

-- | Additional information about the score. Values must contain no more than
-- 64 URI-safe characters as defined by section 2.3 of RFC 3986.
leScoreTag :: Lens' LeaderboardEntry (Maybe Text)
leScoreTag
  = lens _leScoreTag (\ s a -> s{_leScoreTag = a})

-- | The timestamp at which this score was recorded, in milliseconds since
-- the epoch in UTC.
leWriteTimestampMillis :: Lens' LeaderboardEntry (Maybe Int64)
leWriteTimestampMillis
  = lens _leWriteTimestampMillis
      (\ s a -> s{_leWriteTimestampMillis = a})
      . mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#leaderboardEntry.
leKind :: Lens' LeaderboardEntry Text
leKind = lens _leKind (\ s a -> s{_leKind = a})

-- | The numerical value of this score.
leScoreValue :: Lens' LeaderboardEntry (Maybe Int64)
leScoreValue
  = lens _leScoreValue (\ s a -> s{_leScoreValue = a})
      . mapping _Coerce

-- | The localized string for the numerical value of this score.
leFormattedScore :: Lens' LeaderboardEntry (Maybe Text)
leFormattedScore
  = lens _leFormattedScore
      (\ s a -> s{_leFormattedScore = a})

-- | The time span of this high score. Possible values are: - \"ALL_TIME\" -
-- The score is an all-time high score. - \"WEEKLY\" - The score is a
-- weekly high score. - \"DAILY\" - The score is a daily high score.
leTimeSpan :: Lens' LeaderboardEntry (Maybe Text)
leTimeSpan
  = lens _leTimeSpan (\ s a -> s{_leTimeSpan = a})

-- | The localized string for the rank of this score for this leaderboard.
leFormattedScoreRank :: Lens' LeaderboardEntry (Maybe Text)
leFormattedScoreRank
  = lens _leFormattedScoreRank
      (\ s a -> s{_leFormattedScoreRank = a})

-- | The player who holds this score.
lePlayer :: Lens' LeaderboardEntry (Maybe Player)
lePlayer = lens _lePlayer (\ s a -> s{_lePlayer = a})

-- | The rank of this score for this leaderboard.
leScoreRank :: Lens' LeaderboardEntry (Maybe Int64)
leScoreRank
  = lens _leScoreRank (\ s a -> s{_leScoreRank = a}) .
      mapping _Coerce

instance FromJSON LeaderboardEntry where
        parseJSON
          = withObject "LeaderboardEntry"
              (\ o ->
                 LeaderboardEntry' <$>
                   (o .:? "scoreTag") <*> (o .:? "writeTimestampMillis")
                     <*> (o .:? "kind" .!= "games#leaderboardEntry")
                     <*> (o .:? "scoreValue")
                     <*> (o .:? "formattedScore")
                     <*> (o .:? "timeSpan")
                     <*> (o .:? "formattedScoreRank")
                     <*> (o .:? "player")
                     <*> (o .:? "scoreRank"))

instance ToJSON LeaderboardEntry where
        toJSON LeaderboardEntry'{..}
          = object
              (catMaybes
                 [("scoreTag" .=) <$> _leScoreTag,
                  ("writeTimestampMillis" .=) <$>
                    _leWriteTimestampMillis,
                  Just ("kind" .= _leKind),
                  ("scoreValue" .=) <$> _leScoreValue,
                  ("formattedScore" .=) <$> _leFormattedScore,
                  ("timeSpan" .=) <$> _leTimeSpan,
                  ("formattedScoreRank" .=) <$> _leFormattedScoreRank,
                  ("player" .=) <$> _lePlayer,
                  ("scoreRank" .=) <$> _leScoreRank])

-- | This is a JSON template for a list of snapshot objects.
--
-- /See:/ 'snapshotListResponse' smart constructor.
data SnapshotListResponse = SnapshotListResponse'
    { _slrNextPageToken :: !(Maybe Text)
    , _slrKind          :: !Text
    , _slrItems         :: !(Maybe [Snapshot])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'SnapshotListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'slrNextPageToken'
--
-- * 'slrKind'
--
-- * 'slrItems'
snapshotListResponse
    :: SnapshotListResponse
snapshotListResponse =
    SnapshotListResponse'
    { _slrNextPageToken = Nothing
    , _slrKind = "games#snapshotListResponse"
    , _slrItems = Nothing
    }

-- | Token corresponding to the next page of results. If there are no more
-- results, the token is omitted.
slrNextPageToken :: Lens' SnapshotListResponse (Maybe Text)
slrNextPageToken
  = lens _slrNextPageToken
      (\ s a -> s{_slrNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#snapshotListResponse.
slrKind :: Lens' SnapshotListResponse Text
slrKind = lens _slrKind (\ s a -> s{_slrKind = a})

-- | The snapshots.
slrItems :: Lens' SnapshotListResponse [Snapshot]
slrItems
  = lens _slrItems (\ s a -> s{_slrItems = a}) .
      _Default
      . _Coerce

instance FromJSON SnapshotListResponse where
        parseJSON
          = withObject "SnapshotListResponse"
              (\ o ->
                 SnapshotListResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "games#snapshotListResponse")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON SnapshotListResponse where
        toJSON SnapshotListResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _slrNextPageToken,
                  Just ("kind" .= _slrKind),
                  ("items" .=) <$> _slrItems])

-- | This is a JSON template for 1P\/3P metadata about a user\'s level.
--
-- /See:/ 'playerLevel' smart constructor.
data PlayerLevel = PlayerLevel'
    { _plMaxExperiencePoints :: !(Maybe (Textual Int64))
    , _plKind                :: !Text
    , _plMinExperiencePoints :: !(Maybe (Textual Int64))
    , _plLevel               :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerLevel' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plMaxExperiencePoints'
--
-- * 'plKind'
--
-- * 'plMinExperiencePoints'
--
-- * 'plLevel'
playerLevel
    :: PlayerLevel
playerLevel =
    PlayerLevel'
    { _plMaxExperiencePoints = Nothing
    , _plKind = "games#playerLevel"
    , _plMinExperiencePoints = Nothing
    , _plLevel = Nothing
    }

-- | The maximum experience points for this level.
plMaxExperiencePoints :: Lens' PlayerLevel (Maybe Int64)
plMaxExperiencePoints
  = lens _plMaxExperiencePoints
      (\ s a -> s{_plMaxExperiencePoints = a})
      . mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerLevel.
plKind :: Lens' PlayerLevel Text
plKind = lens _plKind (\ s a -> s{_plKind = a})

-- | The minimum experience points for this level.
plMinExperiencePoints :: Lens' PlayerLevel (Maybe Int64)
plMinExperiencePoints
  = lens _plMinExperiencePoints
      (\ s a -> s{_plMinExperiencePoints = a})
      . mapping _Coerce

-- | The level for the user.
plLevel :: Lens' PlayerLevel (Maybe Int32)
plLevel
  = lens _plLevel (\ s a -> s{_plLevel = a}) .
      mapping _Coerce

instance FromJSON PlayerLevel where
        parseJSON
          = withObject "PlayerLevel"
              (\ o ->
                 PlayerLevel' <$>
                   (o .:? "maxExperiencePoints") <*>
                     (o .:? "kind" .!= "games#playerLevel")
                     <*> (o .:? "minExperiencePoints")
                     <*> (o .:? "level"))

instance ToJSON PlayerLevel where
        toJSON PlayerLevel'{..}
          = object
              (catMaybes
                 [("maxExperiencePoints" .=) <$>
                    _plMaxExperiencePoints,
                  Just ("kind" .= _plKind),
                  ("minExperiencePoints" .=) <$>
                    _plMinExperiencePoints,
                  ("level" .=) <$> _plLevel])

-- | This is a JSON template for an achievement unlock response.
--
-- /See:/ 'achievementUpdateMultipleResponse' smart constructor.
data AchievementUpdateMultipleResponse = AchievementUpdateMultipleResponse'
    { _aumrKind                :: !Text
    , _aumrUpdatedAchievements :: !(Maybe [AchievementUpdateResponse])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'AchievementUpdateMultipleResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aumrKind'
--
-- * 'aumrUpdatedAchievements'
achievementUpdateMultipleResponse
    :: AchievementUpdateMultipleResponse
achievementUpdateMultipleResponse =
    AchievementUpdateMultipleResponse'
    { _aumrKind = "games#achievementUpdateMultipleResponse"
    , _aumrUpdatedAchievements = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#achievementUpdateListResponse.
aumrKind :: Lens' AchievementUpdateMultipleResponse Text
aumrKind = lens _aumrKind (\ s a -> s{_aumrKind = a})

-- | The updated state of the achievements.
aumrUpdatedAchievements :: Lens' AchievementUpdateMultipleResponse [AchievementUpdateResponse]
aumrUpdatedAchievements
  = lens _aumrUpdatedAchievements
      (\ s a -> s{_aumrUpdatedAchievements = a})
      . _Default
      . _Coerce

instance FromJSON AchievementUpdateMultipleResponse
         where
        parseJSON
          = withObject "AchievementUpdateMultipleResponse"
              (\ o ->
                 AchievementUpdateMultipleResponse' <$>
                   (o .:? "kind" .!=
                      "games#achievementUpdateMultipleResponse")
                     <*> (o .:? "updatedAchievements" .!= mempty))

instance ToJSON AchievementUpdateMultipleResponse
         where
        toJSON AchievementUpdateMultipleResponse'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _aumrKind),
                  ("updatedAchievements" .=) <$>
                    _aumrUpdatedAchievements])

-- | This is a JSON template for a participant in a room.
--
-- /See:/ 'roomParticipant' smart constructor.
data RoomParticipant = RoomParticipant'
    { _rpStatus            :: !(Maybe Text)
    , _rpConnected         :: !(Maybe Bool)
    , _rpLeaveReason       :: !(Maybe Text)
    , _rpKind              :: !Text
    , _rpClientAddress     :: !(Maybe RoomClientAddress)
    , _rpId                :: !(Maybe Text)
    , _rpAutoMatched       :: !(Maybe Bool)
    , _rpPlayer            :: !(Maybe Player)
    , _rpCapabilities      :: !(Maybe [Text])
    , _rpAutoMatchedPlayer :: !(Maybe AnonymousPlayer)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RoomParticipant' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rpStatus'
--
-- * 'rpConnected'
--
-- * 'rpLeaveReason'
--
-- * 'rpKind'
--
-- * 'rpClientAddress'
--
-- * 'rpId'
--
-- * 'rpAutoMatched'
--
-- * 'rpPlayer'
--
-- * 'rpCapabilities'
--
-- * 'rpAutoMatchedPlayer'
roomParticipant
    :: RoomParticipant
roomParticipant =
    RoomParticipant'
    { _rpStatus = Nothing
    , _rpConnected = Nothing
    , _rpLeaveReason = Nothing
    , _rpKind = "games#roomParticipant"
    , _rpClientAddress = Nothing
    , _rpId = Nothing
    , _rpAutoMatched = Nothing
    , _rpPlayer = Nothing
    , _rpCapabilities = Nothing
    , _rpAutoMatchedPlayer = Nothing
    }

-- | The status of the participant with respect to the room. Possible values
-- are: - \"PARTICIPANT_INVITED\" - The participant has been invited to
-- join the room, but has not yet responded. - \"PARTICIPANT_JOINED\" - The
-- participant has joined the room (either after creating it or accepting
-- an invitation.) - \"PARTICIPANT_DECLINED\" - The participant declined an
-- invitation to join the room. - \"PARTICIPANT_LEFT\" - The participant
-- joined the room and then left it.
rpStatus :: Lens' RoomParticipant (Maybe Text)
rpStatus = lens _rpStatus (\ s a -> s{_rpStatus = a})

-- | True if this participant is in the fully connected set of peers in the
-- room.
rpConnected :: Lens' RoomParticipant (Maybe Bool)
rpConnected
  = lens _rpConnected (\ s a -> s{_rpConnected = a})

-- | The reason the participant left the room; populated if the participant
-- status is PARTICIPANT_LEFT. Possible values are: - \"PLAYER_LEFT\" - The
-- player explicitly chose to leave the room. - \"GAME_LEFT\" - The game
-- chose to remove the player from the room. - \"ABANDONED\" - The player
-- switched to another application and abandoned the room. -
-- \"PEER_CONNECTION_FAILURE\" - The client was unable to establish or
-- maintain a connection to other peer(s) in the room. - \"SERVER_ERROR\" -
-- The client received an error response when it tried to communicate with
-- the server. - \"TIMEOUT\" - The client timed out while waiting for
-- players to join and connect. - \"PRESENCE_FAILURE\" - The client\'s XMPP
-- connection ended abruptly.
rpLeaveReason :: Lens' RoomParticipant (Maybe Text)
rpLeaveReason
  = lens _rpLeaveReason
      (\ s a -> s{_rpLeaveReason = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#roomParticipant.
rpKind :: Lens' RoomParticipant Text
rpKind = lens _rpKind (\ s a -> s{_rpKind = a})

-- | Client address for the participant.
rpClientAddress :: Lens' RoomParticipant (Maybe RoomClientAddress)
rpClientAddress
  = lens _rpClientAddress
      (\ s a -> s{_rpClientAddress = a})

-- | An identifier for the participant in the scope of the room. Cannot be
-- used to identify a player across rooms or in other contexts.
rpId :: Lens' RoomParticipant (Maybe Text)
rpId = lens _rpId (\ s a -> s{_rpId = a})

-- | True if this participant was auto-matched with the requesting player.
rpAutoMatched :: Lens' RoomParticipant (Maybe Bool)
rpAutoMatched
  = lens _rpAutoMatched
      (\ s a -> s{_rpAutoMatched = a})

-- | Information about the player. Not populated if this player was
-- anonymously auto-matched against the requesting player. (Either player
-- or autoMatchedPlayer will be set.)
rpPlayer :: Lens' RoomParticipant (Maybe Player)
rpPlayer = lens _rpPlayer (\ s a -> s{_rpPlayer = a})

-- | The capabilities which can be used when communicating with this
-- participant.
rpCapabilities :: Lens' RoomParticipant [Text]
rpCapabilities
  = lens _rpCapabilities
      (\ s a -> s{_rpCapabilities = a})
      . _Default
      . _Coerce

-- | Information about a player that has been anonymously auto-matched
-- against the requesting player. (Either player or autoMatchedPlayer will
-- be set.)
rpAutoMatchedPlayer :: Lens' RoomParticipant (Maybe AnonymousPlayer)
rpAutoMatchedPlayer
  = lens _rpAutoMatchedPlayer
      (\ s a -> s{_rpAutoMatchedPlayer = a})

instance FromJSON RoomParticipant where
        parseJSON
          = withObject "RoomParticipant"
              (\ o ->
                 RoomParticipant' <$>
                   (o .:? "status") <*> (o .:? "connected") <*>
                     (o .:? "leaveReason")
                     <*> (o .:? "kind" .!= "games#roomParticipant")
                     <*> (o .:? "clientAddress")
                     <*> (o .:? "id")
                     <*> (o .:? "autoMatched")
                     <*> (o .:? "player")
                     <*> (o .:? "capabilities" .!= mempty)
                     <*> (o .:? "autoMatchedPlayer"))

instance ToJSON RoomParticipant where
        toJSON RoomParticipant'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _rpStatus,
                  ("connected" .=) <$> _rpConnected,
                  ("leaveReason" .=) <$> _rpLeaveReason,
                  Just ("kind" .= _rpKind),
                  ("clientAddress" .=) <$> _rpClientAddress,
                  ("id" .=) <$> _rpId,
                  ("autoMatched" .=) <$> _rpAutoMatched,
                  ("player" .=) <$> _rpPlayer,
                  ("capabilities" .=) <$> _rpCapabilities,
                  ("autoMatchedPlayer" .=) <$> _rpAutoMatchedPlayer])

-- | This is a JSON template for a ListDefinitions response.
--
-- /See:/ 'eventDefinitionListResponse' smart constructor.
data EventDefinitionListResponse = EventDefinitionListResponse'
    { _edlrNextPageToken :: !(Maybe Text)
    , _edlrKind          :: !Text
    , _edlrItems         :: !(Maybe [EventDefinition])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'EventDefinitionListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'edlrNextPageToken'
--
-- * 'edlrKind'
--
-- * 'edlrItems'
eventDefinitionListResponse
    :: EventDefinitionListResponse
eventDefinitionListResponse =
    EventDefinitionListResponse'
    { _edlrNextPageToken = Nothing
    , _edlrKind = "games#eventDefinitionListResponse"
    , _edlrItems = Nothing
    }

-- | The pagination token for the next page of results.
edlrNextPageToken :: Lens' EventDefinitionListResponse (Maybe Text)
edlrNextPageToken
  = lens _edlrNextPageToken
      (\ s a -> s{_edlrNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#eventDefinitionListResponse.
edlrKind :: Lens' EventDefinitionListResponse Text
edlrKind = lens _edlrKind (\ s a -> s{_edlrKind = a})

-- | The event definitions.
edlrItems :: Lens' EventDefinitionListResponse [EventDefinition]
edlrItems
  = lens _edlrItems (\ s a -> s{_edlrItems = a}) .
      _Default
      . _Coerce

instance FromJSON EventDefinitionListResponse where
        parseJSON
          = withObject "EventDefinitionListResponse"
              (\ o ->
                 EventDefinitionListResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!=
                        "games#eventDefinitionListResponse")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON EventDefinitionListResponse where
        toJSON EventDefinitionListResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _edlrNextPageToken,
                  Just ("kind" .= _edlrKind),
                  ("items" .=) <$> _edlrItems])

-- | This is a JSON template for data related to individual game categories.
--
-- /See:/ 'category' smart constructor.
data Category = Category'
    { _cKind             :: !Text
    , _cCategory         :: !(Maybe Text)
    , _cExperiencePoints :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Category' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cKind'
--
-- * 'cCategory'
--
-- * 'cExperiencePoints'
category
    :: Category
category =
    Category'
    { _cKind = "games#category"
    , _cCategory = Nothing
    , _cExperiencePoints = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#category.
cKind :: Lens' Category Text
cKind = lens _cKind (\ s a -> s{_cKind = a})

-- | The category name.
cCategory :: Lens' Category (Maybe Text)
cCategory
  = lens _cCategory (\ s a -> s{_cCategory = a})

-- | Experience points earned in this category.
cExperiencePoints :: Lens' Category (Maybe Int64)
cExperiencePoints
  = lens _cExperiencePoints
      (\ s a -> s{_cExperiencePoints = a})
      . mapping _Coerce

instance FromJSON Category where
        parseJSON
          = withObject "Category"
              (\ o ->
                 Category' <$>
                   (o .:? "kind" .!= "games#category") <*>
                     (o .:? "category")
                     <*> (o .:? "experiencePoints"))

instance ToJSON Category where
        toJSON Category'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _cKind),
                  ("category" .=) <$> _cCategory,
                  ("experiencePoints" .=) <$> _cExperiencePoints])

-- | This is a JSON template for the Android instance details resource.
--
-- /See:/ 'instanceAndroidDetails' smart constructor.
data InstanceAndroidDetails = InstanceAndroidDetails'
    { _iadPackageName       :: !(Maybe Text)
    , _iadPreferred         :: !(Maybe Bool)
    , _iadKind              :: !Text
    , _iadEnablePiracyCheck :: !(Maybe Bool)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'InstanceAndroidDetails' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'iadPackageName'
--
-- * 'iadPreferred'
--
-- * 'iadKind'
--
-- * 'iadEnablePiracyCheck'
instanceAndroidDetails
    :: InstanceAndroidDetails
instanceAndroidDetails =
    InstanceAndroidDetails'
    { _iadPackageName = Nothing
    , _iadPreferred = Nothing
    , _iadKind = "games#instanceAndroidDetails"
    , _iadEnablePiracyCheck = Nothing
    }

-- | Android package name which maps to Google Play URL.
iadPackageName :: Lens' InstanceAndroidDetails (Maybe Text)
iadPackageName
  = lens _iadPackageName
      (\ s a -> s{_iadPackageName = a})

-- | Indicates that this instance is the default for new installations.
iadPreferred :: Lens' InstanceAndroidDetails (Maybe Bool)
iadPreferred
  = lens _iadPreferred (\ s a -> s{_iadPreferred = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#instanceAndroidDetails.
iadKind :: Lens' InstanceAndroidDetails Text
iadKind = lens _iadKind (\ s a -> s{_iadKind = a})

-- | Flag indicating whether the anti-piracy check is enabled.
iadEnablePiracyCheck :: Lens' InstanceAndroidDetails (Maybe Bool)
iadEnablePiracyCheck
  = lens _iadEnablePiracyCheck
      (\ s a -> s{_iadEnablePiracyCheck = a})

instance FromJSON InstanceAndroidDetails where
        parseJSON
          = withObject "InstanceAndroidDetails"
              (\ o ->
                 InstanceAndroidDetails' <$>
                   (o .:? "packageName") <*> (o .:? "preferred") <*>
                     (o .:? "kind" .!= "games#instanceAndroidDetails")
                     <*> (o .:? "enablePiracyCheck"))

instance ToJSON InstanceAndroidDetails where
        toJSON InstanceAndroidDetails'{..}
          = object
              (catMaybes
                 [("packageName" .=) <$> _iadPackageName,
                  ("preferred" .=) <$> _iadPreferred,
                  Just ("kind" .= _iadKind),
                  ("enablePiracyCheck" .=) <$> _iadEnablePiracyCheck])

-- | This is a JSON template for a participant in a turn-based match.
--
-- /See:/ 'turnBasedMatchParticipant' smart constructor.
data TurnBasedMatchParticipant = TurnBasedMatchParticipant'
    { _tbmpStatus            :: !(Maybe Text)
    , _tbmpKind              :: !Text
    , _tbmpId                :: !(Maybe Text)
    , _tbmpAutoMatched       :: !(Maybe Bool)
    , _tbmpPlayer            :: !(Maybe Player)
    , _tbmpAutoMatchedPlayer :: !(Maybe AnonymousPlayer)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TurnBasedMatchParticipant' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tbmpStatus'
--
-- * 'tbmpKind'
--
-- * 'tbmpId'
--
-- * 'tbmpAutoMatched'
--
-- * 'tbmpPlayer'
--
-- * 'tbmpAutoMatchedPlayer'
turnBasedMatchParticipant
    :: TurnBasedMatchParticipant
turnBasedMatchParticipant =
    TurnBasedMatchParticipant'
    { _tbmpStatus = Nothing
    , _tbmpKind = "games#turnBasedMatchParticipant"
    , _tbmpId = Nothing
    , _tbmpAutoMatched = Nothing
    , _tbmpPlayer = Nothing
    , _tbmpAutoMatchedPlayer = Nothing
    }

-- | The status of the participant with respect to the match. Possible values
-- are: - \"PARTICIPANT_NOT_INVITED_YET\" - The participant is slated to be
-- invited to the match, but the invitation has not been sent; the invite
-- will be sent when it becomes their turn. - \"PARTICIPANT_INVITED\" - The
-- participant has been invited to join the match, but has not yet
-- responded. - \"PARTICIPANT_JOINED\" - The participant has joined the
-- match (either after creating it or accepting an invitation.) -
-- \"PARTICIPANT_DECLINED\" - The participant declined an invitation to
-- join the match. - \"PARTICIPANT_LEFT\" - The participant joined the
-- match and then left it. - \"PARTICIPANT_FINISHED\" - The participant
-- finished playing in the match. - \"PARTICIPANT_UNRESPONSIVE\" - The
-- participant did not take their turn in the allotted time.
tbmpStatus :: Lens' TurnBasedMatchParticipant (Maybe Text)
tbmpStatus
  = lens _tbmpStatus (\ s a -> s{_tbmpStatus = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#turnBasedMatchParticipant.
tbmpKind :: Lens' TurnBasedMatchParticipant Text
tbmpKind = lens _tbmpKind (\ s a -> s{_tbmpKind = a})

-- | An identifier for the participant in the scope of the match. Cannot be
-- used to identify a player across matches or in other contexts.
tbmpId :: Lens' TurnBasedMatchParticipant (Maybe Text)
tbmpId = lens _tbmpId (\ s a -> s{_tbmpId = a})

-- | True if this participant was auto-matched with the requesting player.
tbmpAutoMatched :: Lens' TurnBasedMatchParticipant (Maybe Bool)
tbmpAutoMatched
  = lens _tbmpAutoMatched
      (\ s a -> s{_tbmpAutoMatched = a})

-- | Information about the player. Not populated if this player was
-- anonymously auto-matched against the requesting player. (Either player
-- or autoMatchedPlayer will be set.)
tbmpPlayer :: Lens' TurnBasedMatchParticipant (Maybe Player)
tbmpPlayer
  = lens _tbmpPlayer (\ s a -> s{_tbmpPlayer = a})

-- | Information about a player that has been anonymously auto-matched
-- against the requesting player. (Either player or autoMatchedPlayer will
-- be set.)
tbmpAutoMatchedPlayer :: Lens' TurnBasedMatchParticipant (Maybe AnonymousPlayer)
tbmpAutoMatchedPlayer
  = lens _tbmpAutoMatchedPlayer
      (\ s a -> s{_tbmpAutoMatchedPlayer = a})

instance FromJSON TurnBasedMatchParticipant where
        parseJSON
          = withObject "TurnBasedMatchParticipant"
              (\ o ->
                 TurnBasedMatchParticipant' <$>
                   (o .:? "status") <*>
                     (o .:? "kind" .!= "games#turnBasedMatchParticipant")
                     <*> (o .:? "id")
                     <*> (o .:? "autoMatched")
                     <*> (o .:? "player")
                     <*> (o .:? "autoMatchedPlayer"))

instance ToJSON TurnBasedMatchParticipant where
        toJSON TurnBasedMatchParticipant'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _tbmpStatus,
                  Just ("kind" .= _tbmpKind), ("id" .=) <$> _tbmpId,
                  ("autoMatched" .=) <$> _tbmpAutoMatched,
                  ("player" .=) <$> _tbmpPlayer,
                  ("autoMatchedPlayer" .=) <$> _tbmpAutoMatchedPlayer])

-- | This is a JSON template for a list of achievement definition objects.
--
-- /See:/ 'achievementDefinitionsListResponse' smart constructor.
data AchievementDefinitionsListResponse = AchievementDefinitionsListResponse'
    { _adlrNextPageToken :: !(Maybe Text)
    , _adlrKind          :: !Text
    , _adlrItems         :: !(Maybe [AchievementDefinition])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'AchievementDefinitionsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'adlrNextPageToken'
--
-- * 'adlrKind'
--
-- * 'adlrItems'
achievementDefinitionsListResponse
    :: AchievementDefinitionsListResponse
achievementDefinitionsListResponse =
    AchievementDefinitionsListResponse'
    { _adlrNextPageToken = Nothing
    , _adlrKind = "games#achievementDefinitionsListResponse"
    , _adlrItems = Nothing
    }

-- | Token corresponding to the next page of results.
adlrNextPageToken :: Lens' AchievementDefinitionsListResponse (Maybe Text)
adlrNextPageToken
  = lens _adlrNextPageToken
      (\ s a -> s{_adlrNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#achievementDefinitionsListResponse.
adlrKind :: Lens' AchievementDefinitionsListResponse Text
adlrKind = lens _adlrKind (\ s a -> s{_adlrKind = a})

-- | The achievement definitions.
adlrItems :: Lens' AchievementDefinitionsListResponse [AchievementDefinition]
adlrItems
  = lens _adlrItems (\ s a -> s{_adlrItems = a}) .
      _Default
      . _Coerce

instance FromJSON AchievementDefinitionsListResponse
         where
        parseJSON
          = withObject "AchievementDefinitionsListResponse"
              (\ o ->
                 AchievementDefinitionsListResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!=
                        "games#achievementDefinitionsListResponse")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON AchievementDefinitionsListResponse
         where
        toJSON AchievementDefinitionsListResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _adlrNextPageToken,
                  Just ("kind" .= _adlrKind),
                  ("items" .=) <$> _adlrItems])

-- | This is a JSON template for a list of leaderboard entry resources.
--
-- /See:/ 'playerScoreResponse' smart constructor.
data PlayerScoreResponse = PlayerScoreResponse'
    { _psrScoreTag             :: !(Maybe Text)
    , _psrKind                 :: !Text
    , _psrFormattedScore       :: !(Maybe Text)
    , _psrLeaderboardId        :: !(Maybe Text)
    , _psrBeatenScoreTimeSpans :: !(Maybe [Text])
    , _psrUnbeatenScores       :: !(Maybe [PlayerScore])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerScoreResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psrScoreTag'
--
-- * 'psrKind'
--
-- * 'psrFormattedScore'
--
-- * 'psrLeaderboardId'
--
-- * 'psrBeatenScoreTimeSpans'
--
-- * 'psrUnbeatenScores'
playerScoreResponse
    :: PlayerScoreResponse
playerScoreResponse =
    PlayerScoreResponse'
    { _psrScoreTag = Nothing
    , _psrKind = "games#playerScoreResponse"
    , _psrFormattedScore = Nothing
    , _psrLeaderboardId = Nothing
    , _psrBeatenScoreTimeSpans = Nothing
    , _psrUnbeatenScores = Nothing
    }

-- | Additional information about this score. Values will contain no more
-- than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
psrScoreTag :: Lens' PlayerScoreResponse (Maybe Text)
psrScoreTag
  = lens _psrScoreTag (\ s a -> s{_psrScoreTag = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerScoreResponse.
psrKind :: Lens' PlayerScoreResponse Text
psrKind = lens _psrKind (\ s a -> s{_psrKind = a})

-- | The formatted value of the submitted score.
psrFormattedScore :: Lens' PlayerScoreResponse (Maybe Text)
psrFormattedScore
  = lens _psrFormattedScore
      (\ s a -> s{_psrFormattedScore = a})

-- | The leaderboard ID that this score was submitted to.
psrLeaderboardId :: Lens' PlayerScoreResponse (Maybe Text)
psrLeaderboardId
  = lens _psrLeaderboardId
      (\ s a -> s{_psrLeaderboardId = a})

-- | The time spans where the submitted score is better than the existing
-- score for that time span. Possible values are: - \"ALL_TIME\" - The
-- score is an all-time score. - \"WEEKLY\" - The score is a weekly score.
-- - \"DAILY\" - The score is a daily score.
psrBeatenScoreTimeSpans :: Lens' PlayerScoreResponse [Text]
psrBeatenScoreTimeSpans
  = lens _psrBeatenScoreTimeSpans
      (\ s a -> s{_psrBeatenScoreTimeSpans = a})
      . _Default
      . _Coerce

-- | The scores in time spans that have not been beaten. As an example, the
-- submitted score may be better than the player\'s DAILY score, but not
-- better than the player\'s scores for the WEEKLY or ALL_TIME time spans.
psrUnbeatenScores :: Lens' PlayerScoreResponse [PlayerScore]
psrUnbeatenScores
  = lens _psrUnbeatenScores
      (\ s a -> s{_psrUnbeatenScores = a})
      . _Default
      . _Coerce

instance FromJSON PlayerScoreResponse where
        parseJSON
          = withObject "PlayerScoreResponse"
              (\ o ->
                 PlayerScoreResponse' <$>
                   (o .:? "scoreTag") <*>
                     (o .:? "kind" .!= "games#playerScoreResponse")
                     <*> (o .:? "formattedScore")
                     <*> (o .:? "leaderboardId")
                     <*> (o .:? "beatenScoreTimeSpans" .!= mempty)
                     <*> (o .:? "unbeatenScores" .!= mempty))

instance ToJSON PlayerScoreResponse where
        toJSON PlayerScoreResponse'{..}
          = object
              (catMaybes
                 [("scoreTag" .=) <$> _psrScoreTag,
                  Just ("kind" .= _psrKind),
                  ("formattedScore" .=) <$> _psrFormattedScore,
                  ("leaderboardId" .=) <$> _psrLeaderboardId,
                  ("beatenScoreTimeSpans" .=) <$>
                    _psrBeatenScoreTimeSpans,
                  ("unbeatenScores" .=) <$> _psrUnbeatenScores])

-- | This is a JSON template for an anonymous player
--
-- /See:/ 'anonymousPlayer' smart constructor.
data AnonymousPlayer = AnonymousPlayer'
    { _apAvatarImageURL :: !(Maybe Text)
    , _apKind           :: !Text
    , _apDisplayName    :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'AnonymousPlayer' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apAvatarImageURL'
--
-- * 'apKind'
--
-- * 'apDisplayName'
anonymousPlayer
    :: AnonymousPlayer
anonymousPlayer =
    AnonymousPlayer'
    { _apAvatarImageURL = Nothing
    , _apKind = "games#anonymousPlayer"
    , _apDisplayName = Nothing
    }

-- | The base URL for the image to display for the anonymous player.
apAvatarImageURL :: Lens' AnonymousPlayer (Maybe Text)
apAvatarImageURL
  = lens _apAvatarImageURL
      (\ s a -> s{_apAvatarImageURL = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#anonymousPlayer.
apKind :: Lens' AnonymousPlayer Text
apKind = lens _apKind (\ s a -> s{_apKind = a})

-- | The name to display for the anonymous player.
apDisplayName :: Lens' AnonymousPlayer (Maybe Text)
apDisplayName
  = lens _apDisplayName
      (\ s a -> s{_apDisplayName = a})

instance FromJSON AnonymousPlayer where
        parseJSON
          = withObject "AnonymousPlayer"
              (\ o ->
                 AnonymousPlayer' <$>
                   (o .:? "avatarImageUrl") <*>
                     (o .:? "kind" .!= "games#anonymousPlayer")
                     <*> (o .:? "displayName"))

instance ToJSON AnonymousPlayer where
        toJSON AnonymousPlayer'{..}
          = object
              (catMaybes
                 [("avatarImageUrl" .=) <$> _apAvatarImageURL,
                  Just ("kind" .= _apKind),
                  ("displayName" .=) <$> _apDisplayName])

-- | This is a JSON template for a Quest Criterion Contribution resource.
--
-- /See:/ 'questContribution' smart constructor.
data QuestContribution = QuestContribution'
    { _qKind           :: !Text
    , _qValue          :: !(Maybe (Textual Int64))
    , _qFormattedValue :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QuestContribution' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qKind'
--
-- * 'qValue'
--
-- * 'qFormattedValue'
questContribution
    :: QuestContribution
questContribution =
    QuestContribution'
    { _qKind = "games#questContribution"
    , _qValue = Nothing
    , _qFormattedValue = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#questContribution.
qKind :: Lens' QuestContribution Text
qKind = lens _qKind (\ s a -> s{_qKind = a})

-- | The value of the contribution.
qValue :: Lens' QuestContribution (Maybe Int64)
qValue
  = lens _qValue (\ s a -> s{_qValue = a}) .
      mapping _Coerce

-- | The formatted value of the contribution as a string. Format depends on
-- the configuration for the associated event definition in the Play Games
-- Developer Console.
qFormattedValue :: Lens' QuestContribution (Maybe Text)
qFormattedValue
  = lens _qFormattedValue
      (\ s a -> s{_qFormattedValue = a})

instance FromJSON QuestContribution where
        parseJSON
          = withObject "QuestContribution"
              (\ o ->
                 QuestContribution' <$>
                   (o .:? "kind" .!= "games#questContribution") <*>
                     (o .:? "value")
                     <*> (o .:? "formattedValue"))

instance ToJSON QuestContribution where
        toJSON QuestContribution'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _qKind), ("value" .=) <$> _qValue,
                  ("formattedValue" .=) <$> _qFormattedValue])

-- | This is a JSON template for the client address when setting up a room.
--
-- /See:/ 'roomClientAddress' smart constructor.
data RoomClientAddress = RoomClientAddress'
    { _rcaKind        :: !Text
    , _rcaXmppAddress :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RoomClientAddress' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rcaKind'
--
-- * 'rcaXmppAddress'
roomClientAddress
    :: RoomClientAddress
roomClientAddress =
    RoomClientAddress'
    { _rcaKind = "games#roomClientAddress"
    , _rcaXmppAddress = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#roomClientAddress.
rcaKind :: Lens' RoomClientAddress Text
rcaKind = lens _rcaKind (\ s a -> s{_rcaKind = a})

-- | The XMPP address of the client on the Google Games XMPP network.
rcaXmppAddress :: Lens' RoomClientAddress (Maybe Text)
rcaXmppAddress
  = lens _rcaXmppAddress
      (\ s a -> s{_rcaXmppAddress = a})

instance FromJSON RoomClientAddress where
        parseJSON
          = withObject "RoomClientAddress"
              (\ o ->
                 RoomClientAddress' <$>
                   (o .:? "kind" .!= "games#roomClientAddress") <*>
                     (o .:? "xmppAddress"))

instance ToJSON RoomClientAddress where
        toJSON RoomClientAddress'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _rcaKind),
                  ("xmppAddress" .=) <$> _rcaXmppAddress])

-- | This is a JSON template for a list of leaderboard objects.
--
-- /See:/ 'leaderboardListResponse' smart constructor.
data LeaderboardListResponse = LeaderboardListResponse'
    { _llrNextPageToken :: !(Maybe Text)
    , _llrKind          :: !Text
    , _llrItems         :: !(Maybe [Leaderboard])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'LeaderboardListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'llrNextPageToken'
--
-- * 'llrKind'
--
-- * 'llrItems'
leaderboardListResponse
    :: LeaderboardListResponse
leaderboardListResponse =
    LeaderboardListResponse'
    { _llrNextPageToken = Nothing
    , _llrKind = "games#leaderboardListResponse"
    , _llrItems = Nothing
    }

-- | Token corresponding to the next page of results.
llrNextPageToken :: Lens' LeaderboardListResponse (Maybe Text)
llrNextPageToken
  = lens _llrNextPageToken
      (\ s a -> s{_llrNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#leaderboardListResponse.
llrKind :: Lens' LeaderboardListResponse Text
llrKind = lens _llrKind (\ s a -> s{_llrKind = a})

-- | The leaderboards.
llrItems :: Lens' LeaderboardListResponse [Leaderboard]
llrItems
  = lens _llrItems (\ s a -> s{_llrItems = a}) .
      _Default
      . _Coerce

instance FromJSON LeaderboardListResponse where
        parseJSON
          = withObject "LeaderboardListResponse"
              (\ o ->
                 LeaderboardListResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "games#leaderboardListResponse")
                     <*> (o .:? "items" .!= mempty))

instance ToJSON LeaderboardListResponse where
        toJSON LeaderboardListResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _llrNextPageToken,
                  Just ("kind" .= _llrKind),
                  ("items" .=) <$> _llrItems])

-- | This is a JSON template for a player score.
--
-- /See:/ 'playerScore' smart constructor.
data PlayerScore = PlayerScore'
    { _psScoreTag       :: !(Maybe Text)
    , _psScore          :: !(Maybe (Textual Int64))
    , _psKind           :: !Text
    , _psFormattedScore :: !(Maybe Text)
    , _psTimeSpan       :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerScore' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psScoreTag'
--
-- * 'psScore'
--
-- * 'psKind'
--
-- * 'psFormattedScore'
--
-- * 'psTimeSpan'
playerScore
    :: PlayerScore
playerScore =
    PlayerScore'
    { _psScoreTag = Nothing
    , _psScore = Nothing
    , _psKind = "games#playerScore"
    , _psFormattedScore = Nothing
    , _psTimeSpan = Nothing
    }

-- | Additional information about this score. Values will contain no more
-- than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
psScoreTag :: Lens' PlayerScore (Maybe Text)
psScoreTag
  = lens _psScoreTag (\ s a -> s{_psScoreTag = a})

-- | The numerical value for this player score.
psScore :: Lens' PlayerScore (Maybe Int64)
psScore
  = lens _psScore (\ s a -> s{_psScore = a}) .
      mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerScore.
psKind :: Lens' PlayerScore Text
psKind = lens _psKind (\ s a -> s{_psKind = a})

-- | The formatted score for this player score.
psFormattedScore :: Lens' PlayerScore (Maybe Text)
psFormattedScore
  = lens _psFormattedScore
      (\ s a -> s{_psFormattedScore = a})

-- | The time span for this player score. Possible values are: - \"ALL_TIME\"
-- - The score is an all-time score. - \"WEEKLY\" - The score is a weekly
-- score. - \"DAILY\" - The score is a daily score.
psTimeSpan :: Lens' PlayerScore (Maybe Text)
psTimeSpan
  = lens _psTimeSpan (\ s a -> s{_psTimeSpan = a})

instance FromJSON PlayerScore where
        parseJSON
          = withObject "PlayerScore"
              (\ o ->
                 PlayerScore' <$>
                   (o .:? "scoreTag") <*> (o .:? "score") <*>
                     (o .:? "kind" .!= "games#playerScore")
                     <*> (o .:? "formattedScore")
                     <*> (o .:? "timeSpan"))

instance ToJSON PlayerScore where
        toJSON PlayerScore'{..}
          = object
              (catMaybes
                 [("scoreTag" .=) <$> _psScoreTag,
                  ("score" .=) <$> _psScore, Just ("kind" .= _psKind),
                  ("formattedScore" .=) <$> _psFormattedScore,
                  ("timeSpan" .=) <$> _psTimeSpan])

-- | This is a JSON template for an turn-based auto-match criteria object.
--
-- /See:/ 'turnBasedAutoMatchingCriteria' smart constructor.
data TurnBasedAutoMatchingCriteria = TurnBasedAutoMatchingCriteria'
    { _tbamcKind                   :: !Text
    , _tbamcExclusiveBitmask       :: !(Maybe (Textual Int64))
    , _tbamcMaxAutoMatchingPlayers :: !(Maybe (Textual Int32))
    , _tbamcMinAutoMatchingPlayers :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TurnBasedAutoMatchingCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tbamcKind'
--
-- * 'tbamcExclusiveBitmask'
--
-- * 'tbamcMaxAutoMatchingPlayers'
--
-- * 'tbamcMinAutoMatchingPlayers'
turnBasedAutoMatchingCriteria
    :: TurnBasedAutoMatchingCriteria
turnBasedAutoMatchingCriteria =
    TurnBasedAutoMatchingCriteria'
    { _tbamcKind = "games#turnBasedAutoMatchingCriteria"
    , _tbamcExclusiveBitmask = Nothing
    , _tbamcMaxAutoMatchingPlayers = Nothing
    , _tbamcMinAutoMatchingPlayers = Nothing
    }

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#turnBasedAutoMatchingCriteria.
tbamcKind :: Lens' TurnBasedAutoMatchingCriteria Text
tbamcKind
  = lens _tbamcKind (\ s a -> s{_tbamcKind = a})

-- | A bitmask indicating when auto-matches are valid. When ANDed with other
-- exclusive bitmasks, the result must be zero. Can be used to support
-- exclusive roles within a game.
tbamcExclusiveBitmask :: Lens' TurnBasedAutoMatchingCriteria (Maybe Int64)
tbamcExclusiveBitmask
  = lens _tbamcExclusiveBitmask
      (\ s a -> s{_tbamcExclusiveBitmask = a})
      . mapping _Coerce

-- | The maximum number of players that should be added to the match by
-- auto-matching.
tbamcMaxAutoMatchingPlayers :: Lens' TurnBasedAutoMatchingCriteria (Maybe Int32)
tbamcMaxAutoMatchingPlayers
  = lens _tbamcMaxAutoMatchingPlayers
      (\ s a -> s{_tbamcMaxAutoMatchingPlayers = a})
      . mapping _Coerce

-- | The minimum number of players that should be added to the match by
-- auto-matching.
tbamcMinAutoMatchingPlayers :: Lens' TurnBasedAutoMatchingCriteria (Maybe Int32)
tbamcMinAutoMatchingPlayers
  = lens _tbamcMinAutoMatchingPlayers
      (\ s a -> s{_tbamcMinAutoMatchingPlayers = a})
      . mapping _Coerce

instance FromJSON TurnBasedAutoMatchingCriteria where
        parseJSON
          = withObject "TurnBasedAutoMatchingCriteria"
              (\ o ->
                 TurnBasedAutoMatchingCriteria' <$>
                   (o .:? "kind" .!=
                      "games#turnBasedAutoMatchingCriteria")
                     <*> (o .:? "exclusiveBitmask")
                     <*> (o .:? "maxAutoMatchingPlayers")
                     <*> (o .:? "minAutoMatchingPlayers"))

instance ToJSON TurnBasedAutoMatchingCriteria where
        toJSON TurnBasedAutoMatchingCriteria'{..}
          = object
              (catMaybes
                 [Just ("kind" .= _tbamcKind),
                  ("exclusiveBitmask" .=) <$> _tbamcExclusiveBitmask,
                  ("maxAutoMatchingPlayers" .=) <$>
                    _tbamcMaxAutoMatchingPlayers,
                  ("minAutoMatchingPlayers" .=) <$>
                    _tbamcMinAutoMatchingPlayers])

-- | This is a JSON template for an image of a snapshot.
--
-- /See:/ 'snapshotImage' smart constructor.
data SnapshotImage = SnapshotImage'
    { _siHeight   :: !(Maybe (Textual Int32))
    , _siKind     :: !Text
    , _siURL      :: !(Maybe Text)
    , _siMimeType :: !(Maybe Text)
    , _siWidth    :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'SnapshotImage' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'siHeight'
--
-- * 'siKind'
--
-- * 'siURL'
--
-- * 'siMimeType'
--
-- * 'siWidth'
snapshotImage
    :: SnapshotImage
snapshotImage =
    SnapshotImage'
    { _siHeight = Nothing
    , _siKind = "games#snapshotImage"
    , _siURL = Nothing
    , _siMimeType = Nothing
    , _siWidth = Nothing
    }

-- | The height of the image.
siHeight :: Lens' SnapshotImage (Maybe Int32)
siHeight
  = lens _siHeight (\ s a -> s{_siHeight = a}) .
      mapping _Coerce

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#snapshotImage.
siKind :: Lens' SnapshotImage Text
siKind = lens _siKind (\ s a -> s{_siKind = a})

-- | The URL of the image. This URL may be invalidated at any time and should
-- not be cached.
siURL :: Lens' SnapshotImage (Maybe Text)
siURL = lens _siURL (\ s a -> s{_siURL = a})

-- | The MIME type of the image.
siMimeType :: Lens' SnapshotImage (Maybe Text)
siMimeType
  = lens _siMimeType (\ s a -> s{_siMimeType = a})

-- | The width of the image.
siWidth :: Lens' SnapshotImage (Maybe Int32)
siWidth
  = lens _siWidth (\ s a -> s{_siWidth = a}) .
      mapping _Coerce

instance FromJSON SnapshotImage where
        parseJSON
          = withObject "SnapshotImage"
              (\ o ->
                 SnapshotImage' <$>
                   (o .:? "height") <*>
                     (o .:? "kind" .!= "games#snapshotImage")
                     <*> (o .:? "url")
                     <*> (o .:? "mime_type")
                     <*> (o .:? "width"))

instance ToJSON SnapshotImage where
        toJSON SnapshotImage'{..}
          = object
              (catMaybes
                 [("height" .=) <$> _siHeight,
                  Just ("kind" .= _siKind), ("url" .=) <$> _siURL,
                  ("mime_type" .=) <$> _siMimeType,
                  ("width" .=) <$> _siWidth])

-- | This is a JSON template for the status of a room that the player has
-- joined.
--
-- /See:/ 'roomStatus' smart constructor.
data RoomStatus = RoomStatus'
    { _rsStatus             :: !(Maybe Text)
    , _rsKind               :: !Text
    , _rsAutoMatchingStatus :: !(Maybe RoomAutoMatchStatus)
    , _rsStatusVersion      :: !(Maybe (Textual Int32))
    , _rsParticipants       :: !(Maybe [RoomParticipant])
    , _rsRoomId             :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RoomStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rsStatus'
--
-- * 'rsKind'
--
-- * 'rsAutoMatchingStatus'
--
-- * 'rsStatusVersion'
--
-- * 'rsParticipants'
--
-- * 'rsRoomId'
roomStatus
    :: RoomStatus
roomStatus =
    RoomStatus'
    { _rsStatus = Nothing
    , _rsKind = "games#roomStatus"
    , _rsAutoMatchingStatus = Nothing
    , _rsStatusVersion = Nothing
    , _rsParticipants = Nothing
    , _rsRoomId = Nothing
    }

-- | The status of the room. Possible values are: - \"ROOM_INVITING\" - One
-- or more players have been invited and not responded. -
-- \"ROOM_AUTO_MATCHING\" - One or more slots need to be filled by
-- auto-matching. - \"ROOM_CONNECTING\" - Players have joined are
-- connecting to each other (either before or after auto-matching). -
-- \"ROOM_ACTIVE\" - All players have joined and connected to each other. -
-- \"ROOM_DELETED\" - All joined players have left.
rsStatus :: Lens' RoomStatus (Maybe Text)
rsStatus = lens _rsStatus (\ s a -> s{_rsStatus = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#roomStatus.
rsKind :: Lens' RoomStatus Text
rsKind = lens _rsKind (\ s a -> s{_rsKind = a})

-- | Auto-matching status for this room. Not set if the room is not currently
-- in the automatching queue.
rsAutoMatchingStatus :: Lens' RoomStatus (Maybe RoomAutoMatchStatus)
rsAutoMatchingStatus
  = lens _rsAutoMatchingStatus
      (\ s a -> s{_rsAutoMatchingStatus = a})

-- | The version of the status for the room: an increasing counter, used by
-- the client to ignore out-of-order updates to room status.
rsStatusVersion :: Lens' RoomStatus (Maybe Int32)
rsStatusVersion
  = lens _rsStatusVersion
      (\ s a -> s{_rsStatusVersion = a})
      . mapping _Coerce

-- | The participants involved in the room, along with their statuses.
-- Includes participants who have left or declined invitations.
rsParticipants :: Lens' RoomStatus [RoomParticipant]
rsParticipants
  = lens _rsParticipants
      (\ s a -> s{_rsParticipants = a})
      . _Default
      . _Coerce

-- | Globally unique ID for a room.
rsRoomId :: Lens' RoomStatus (Maybe Text)
rsRoomId = lens _rsRoomId (\ s a -> s{_rsRoomId = a})

instance FromJSON RoomStatus where
        parseJSON
          = withObject "RoomStatus"
              (\ o ->
                 RoomStatus' <$>
                   (o .:? "status") <*>
                     (o .:? "kind" .!= "games#roomStatus")
                     <*> (o .:? "autoMatchingStatus")
                     <*> (o .:? "statusVersion")
                     <*> (o .:? "participants" .!= mempty)
                     <*> (o .:? "roomId"))

instance ToJSON RoomStatus where
        toJSON RoomStatus'{..}
          = object
              (catMaybes
                 [("status" .=) <$> _rsStatus,
                  Just ("kind" .= _rsKind),
                  ("autoMatchingStatus" .=) <$> _rsAutoMatchingStatus,
                  ("statusVersion" .=) <$> _rsStatusVersion,
                  ("participants" .=) <$> _rsParticipants,
                  ("roomId" .=) <$> _rsRoomId])

-- | This is a JSON template for a list of player leaderboard scores.
--
-- /See:/ 'playerLeaderboardScoreListResponse' smart constructor.
data PlayerLeaderboardScoreListResponse = PlayerLeaderboardScoreListResponse'
    { _plslrNextPageToken :: !(Maybe Text)
    , _plslrKind          :: !Text
    , _plslrItems         :: !(Maybe [PlayerLeaderboardScore])
    , _plslrPlayer        :: !(Maybe Player)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'PlayerLeaderboardScoreListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plslrNextPageToken'
--
-- * 'plslrKind'
--
-- * 'plslrItems'
--
-- * 'plslrPlayer'
playerLeaderboardScoreListResponse
    :: PlayerLeaderboardScoreListResponse
playerLeaderboardScoreListResponse =
    PlayerLeaderboardScoreListResponse'
    { _plslrNextPageToken = Nothing
    , _plslrKind = "games#playerLeaderboardScoreListResponse"
    , _plslrItems = Nothing
    , _plslrPlayer = Nothing
    }

-- | The pagination token for the next page of results.
plslrNextPageToken :: Lens' PlayerLeaderboardScoreListResponse (Maybe Text)
plslrNextPageToken
  = lens _plslrNextPageToken
      (\ s a -> s{_plslrNextPageToken = a})

-- | Uniquely identifies the type of this resource. Value is always the fixed
-- string games#playerLeaderboardScoreListResponse.
plslrKind :: Lens' PlayerLeaderboardScoreListResponse Text
plslrKind
  = lens _plslrKind (\ s a -> s{_plslrKind = a})

-- | The leaderboard scores.
plslrItems :: Lens' PlayerLeaderboardScoreListResponse [PlayerLeaderboardScore]
plslrItems
  = lens _plslrItems (\ s a -> s{_plslrItems = a}) .
      _Default
      . _Coerce

-- | The Player resources for the owner of this score.
plslrPlayer :: Lens' PlayerLeaderboardScoreListResponse (Maybe Player)