{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GameLift.Types.PlacedPlayerSession
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GameLift.Types.PlacedPlayerSession where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a player session that was created as part of a
-- StartGameSessionPlacement request. This object contains only the player
-- ID and player session ID. To retrieve full details on a player session,
-- call DescribePlayerSessions with the player session ID.
--
-- __Related actions__
--
-- CreatePlayerSession | CreatePlayerSessions | DescribePlayerSessions |
-- StartGameSessionPlacement | DescribeGameSessionPlacement |
-- StopGameSessionPlacement |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newPlacedPlayerSession' smart constructor.
data PlacedPlayerSession = PlacedPlayerSession'
  { -- | A unique identifier for a player session.
    PlacedPlayerSession -> Maybe Text
playerSessionId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for a player that is associated with this player
    -- session.
    PlacedPlayerSession -> Maybe Text
playerId :: Prelude.Maybe Prelude.Text
  }
  deriving (PlacedPlayerSession -> PlacedPlayerSession -> Bool
(PlacedPlayerSession -> PlacedPlayerSession -> Bool)
-> (PlacedPlayerSession -> PlacedPlayerSession -> Bool)
-> Eq PlacedPlayerSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlacedPlayerSession -> PlacedPlayerSession -> Bool
$c/= :: PlacedPlayerSession -> PlacedPlayerSession -> Bool
== :: PlacedPlayerSession -> PlacedPlayerSession -> Bool
$c== :: PlacedPlayerSession -> PlacedPlayerSession -> Bool
Prelude.Eq, ReadPrec [PlacedPlayerSession]
ReadPrec PlacedPlayerSession
Int -> ReadS PlacedPlayerSession
ReadS [PlacedPlayerSession]
(Int -> ReadS PlacedPlayerSession)
-> ReadS [PlacedPlayerSession]
-> ReadPrec PlacedPlayerSession
-> ReadPrec [PlacedPlayerSession]
-> Read PlacedPlayerSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlacedPlayerSession]
$creadListPrec :: ReadPrec [PlacedPlayerSession]
readPrec :: ReadPrec PlacedPlayerSession
$creadPrec :: ReadPrec PlacedPlayerSession
readList :: ReadS [PlacedPlayerSession]
$creadList :: ReadS [PlacedPlayerSession]
readsPrec :: Int -> ReadS PlacedPlayerSession
$creadsPrec :: Int -> ReadS PlacedPlayerSession
Prelude.Read, Int -> PlacedPlayerSession -> ShowS
[PlacedPlayerSession] -> ShowS
PlacedPlayerSession -> String
(Int -> PlacedPlayerSession -> ShowS)
-> (PlacedPlayerSession -> String)
-> ([PlacedPlayerSession] -> ShowS)
-> Show PlacedPlayerSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlacedPlayerSession] -> ShowS
$cshowList :: [PlacedPlayerSession] -> ShowS
show :: PlacedPlayerSession -> String
$cshow :: PlacedPlayerSession -> String
showsPrec :: Int -> PlacedPlayerSession -> ShowS
$cshowsPrec :: Int -> PlacedPlayerSession -> ShowS
Prelude.Show, (forall x. PlacedPlayerSession -> Rep PlacedPlayerSession x)
-> (forall x. Rep PlacedPlayerSession x -> PlacedPlayerSession)
-> Generic PlacedPlayerSession
forall x. Rep PlacedPlayerSession x -> PlacedPlayerSession
forall x. PlacedPlayerSession -> Rep PlacedPlayerSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlacedPlayerSession x -> PlacedPlayerSession
$cfrom :: forall x. PlacedPlayerSession -> Rep PlacedPlayerSession x
Prelude.Generic)

-- |
-- Create a value of 'PlacedPlayerSession' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'playerSessionId', 'placedPlayerSession_playerSessionId' - A unique identifier for a player session.
--
-- 'playerId', 'placedPlayerSession_playerId' - A unique identifier for a player that is associated with this player
-- session.
newPlacedPlayerSession ::
  PlacedPlayerSession
newPlacedPlayerSession :: PlacedPlayerSession
newPlacedPlayerSession =
  PlacedPlayerSession' :: Maybe Text -> Maybe Text -> PlacedPlayerSession
PlacedPlayerSession'
    { $sel:playerSessionId:PlacedPlayerSession' :: Maybe Text
playerSessionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:playerId:PlacedPlayerSession' :: Maybe Text
playerId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for a player session.
placedPlayerSession_playerSessionId :: Lens.Lens' PlacedPlayerSession (Prelude.Maybe Prelude.Text)
placedPlayerSession_playerSessionId :: (Maybe Text -> f (Maybe Text))
-> PlacedPlayerSession -> f PlacedPlayerSession
placedPlayerSession_playerSessionId = (PlacedPlayerSession -> Maybe Text)
-> (PlacedPlayerSession -> Maybe Text -> PlacedPlayerSession)
-> Lens
     PlacedPlayerSession PlacedPlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacedPlayerSession' {Maybe Text
playerSessionId :: Maybe Text
$sel:playerSessionId:PlacedPlayerSession' :: PlacedPlayerSession -> Maybe Text
playerSessionId} -> Maybe Text
playerSessionId) (\s :: PlacedPlayerSession
s@PlacedPlayerSession' {} Maybe Text
a -> PlacedPlayerSession
s {$sel:playerSessionId:PlacedPlayerSession' :: Maybe Text
playerSessionId = Maybe Text
a} :: PlacedPlayerSession)

-- | A unique identifier for a player that is associated with this player
-- session.
placedPlayerSession_playerId :: Lens.Lens' PlacedPlayerSession (Prelude.Maybe Prelude.Text)
placedPlayerSession_playerId :: (Maybe Text -> f (Maybe Text))
-> PlacedPlayerSession -> f PlacedPlayerSession
placedPlayerSession_playerId = (PlacedPlayerSession -> Maybe Text)
-> (PlacedPlayerSession -> Maybe Text -> PlacedPlayerSession)
-> Lens
     PlacedPlayerSession PlacedPlayerSession (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlacedPlayerSession' {Maybe Text
playerId :: Maybe Text
$sel:playerId:PlacedPlayerSession' :: PlacedPlayerSession -> Maybe Text
playerId} -> Maybe Text
playerId) (\s :: PlacedPlayerSession
s@PlacedPlayerSession' {} Maybe Text
a -> PlacedPlayerSession
s {$sel:playerId:PlacedPlayerSession' :: Maybe Text
playerId = Maybe Text
a} :: PlacedPlayerSession)

instance Core.FromJSON PlacedPlayerSession where
  parseJSON :: Value -> Parser PlacedPlayerSession
parseJSON =
    String
-> (Object -> Parser PlacedPlayerSession)
-> Value
-> Parser PlacedPlayerSession
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PlacedPlayerSession"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> PlacedPlayerSession
PlacedPlayerSession'
            (Maybe Text -> Maybe Text -> PlacedPlayerSession)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PlacedPlayerSession)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlayerSessionId")
            Parser (Maybe Text -> PlacedPlayerSession)
-> Parser (Maybe Text) -> Parser PlacedPlayerSession
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlayerId")
      )

instance Prelude.Hashable PlacedPlayerSession

instance Prelude.NFData PlacedPlayerSession