{-# 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 #-}
module Amazonka.GameLift.Types.Player where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types.AttributeValue
import qualified Amazonka.Prelude as Prelude
data Player = Player'
{
Player -> Maybe (HashMap Text Natural)
latencyInMs :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Natural),
Player -> Maybe (HashMap Text AttributeValue)
playerAttributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
Player -> Maybe Text
playerId :: Prelude.Maybe Prelude.Text,
Player -> Maybe Text
team :: Prelude.Maybe Prelude.Text
}
deriving (Player -> Player -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Player -> Player -> Bool
$c/= :: Player -> Player -> Bool
== :: Player -> Player -> Bool
$c== :: Player -> Player -> Bool
Prelude.Eq, ReadPrec [Player]
ReadPrec Player
Int -> ReadS Player
ReadS [Player]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Player]
$creadListPrec :: ReadPrec [Player]
readPrec :: ReadPrec Player
$creadPrec :: ReadPrec Player
readList :: ReadS [Player]
$creadList :: ReadS [Player]
readsPrec :: Int -> ReadS Player
$creadsPrec :: Int -> ReadS Player
Prelude.Read, Int -> Player -> ShowS
[Player] -> ShowS
Player -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Player] -> ShowS
$cshowList :: [Player] -> ShowS
show :: Player -> String
$cshow :: Player -> String
showsPrec :: Int -> Player -> ShowS
$cshowsPrec :: Int -> Player -> ShowS
Prelude.Show, forall x. Rep Player x -> Player
forall x. Player -> Rep Player x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Player x -> Player
$cfrom :: forall x. Player -> Rep Player x
Prelude.Generic)
newPlayer ::
Player
newPlayer :: Player
newPlayer =
Player'
{ $sel:latencyInMs:Player' :: Maybe (HashMap Text Natural)
latencyInMs = forall a. Maybe a
Prelude.Nothing,
$sel:playerAttributes:Player' :: Maybe (HashMap Text AttributeValue)
playerAttributes = forall a. Maybe a
Prelude.Nothing,
$sel:playerId:Player' :: Maybe Text
playerId = forall a. Maybe a
Prelude.Nothing,
$sel:team:Player' :: Maybe Text
team = forall a. Maybe a
Prelude.Nothing
}
player_latencyInMs :: Lens.Lens' Player (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Natural))
player_latencyInMs :: Lens' Player (Maybe (HashMap Text Natural))
player_latencyInMs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Player' {Maybe (HashMap Text Natural)
latencyInMs :: Maybe (HashMap Text Natural)
$sel:latencyInMs:Player' :: Player -> Maybe (HashMap Text Natural)
latencyInMs} -> Maybe (HashMap Text Natural)
latencyInMs) (\s :: Player
s@Player' {} Maybe (HashMap Text Natural)
a -> Player
s {$sel:latencyInMs:Player' :: Maybe (HashMap Text Natural)
latencyInMs = Maybe (HashMap Text Natural)
a} :: Player) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
player_playerAttributes :: Lens.Lens' Player (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
player_playerAttributes :: Lens' Player (Maybe (HashMap Text AttributeValue))
player_playerAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Player' {Maybe (HashMap Text AttributeValue)
playerAttributes :: Maybe (HashMap Text AttributeValue)
$sel:playerAttributes:Player' :: Player -> Maybe (HashMap Text AttributeValue)
playerAttributes} -> Maybe (HashMap Text AttributeValue)
playerAttributes) (\s :: Player
s@Player' {} Maybe (HashMap Text AttributeValue)
a -> Player
s {$sel:playerAttributes:Player' :: Maybe (HashMap Text AttributeValue)
playerAttributes = Maybe (HashMap Text AttributeValue)
a} :: Player) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
player_playerId :: Lens.Lens' Player (Prelude.Maybe Prelude.Text)
player_playerId :: Lens' Player (Maybe Text)
player_playerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Player' {Maybe Text
playerId :: Maybe Text
$sel:playerId:Player' :: Player -> Maybe Text
playerId} -> Maybe Text
playerId) (\s :: Player
s@Player' {} Maybe Text
a -> Player
s {$sel:playerId:Player' :: Maybe Text
playerId = Maybe Text
a} :: Player)
player_team :: Lens.Lens' Player (Prelude.Maybe Prelude.Text)
player_team :: Lens' Player (Maybe Text)
player_team = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Player' {Maybe Text
team :: Maybe Text
$sel:team:Player' :: Player -> Maybe Text
team} -> Maybe Text
team) (\s :: Player
s@Player' {} Maybe Text
a -> Player
s {$sel:team:Player' :: Maybe Text
team = Maybe Text
a} :: Player)
instance Data.FromJSON Player where
parseJSON :: Value -> Parser Player
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Player"
( \Object
x ->
Maybe (HashMap Text Natural)
-> Maybe (HashMap Text AttributeValue)
-> Maybe Text
-> Maybe Text
-> Player
Player'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LatencyInMs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PlayerAttributes"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PlayerId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Team")
)
instance Prelude.Hashable Player where
hashWithSalt :: Int -> Player -> Int
hashWithSalt Int
_salt Player' {Maybe Text
Maybe (HashMap Text Natural)
Maybe (HashMap Text AttributeValue)
team :: Maybe Text
playerId :: Maybe Text
playerAttributes :: Maybe (HashMap Text AttributeValue)
latencyInMs :: Maybe (HashMap Text Natural)
$sel:team:Player' :: Player -> Maybe Text
$sel:playerId:Player' :: Player -> Maybe Text
$sel:playerAttributes:Player' :: Player -> Maybe (HashMap Text AttributeValue)
$sel:latencyInMs:Player' :: Player -> Maybe (HashMap Text Natural)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Natural)
latencyInMs
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text AttributeValue)
playerAttributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
playerId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
team
instance Prelude.NFData Player where
rnf :: Player -> ()
rnf Player' {Maybe Text
Maybe (HashMap Text Natural)
Maybe (HashMap Text AttributeValue)
team :: Maybe Text
playerId :: Maybe Text
playerAttributes :: Maybe (HashMap Text AttributeValue)
latencyInMs :: Maybe (HashMap Text Natural)
$sel:team:Player' :: Player -> Maybe Text
$sel:playerId:Player' :: Player -> Maybe Text
$sel:playerAttributes:Player' :: Player -> Maybe (HashMap Text AttributeValue)
$sel:latencyInMs:Player' :: Player -> Maybe (HashMap Text Natural)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Natural)
latencyInMs
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text AttributeValue)
playerAttributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
playerId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
team
instance Data.ToJSON Player where
toJSON :: Player -> Value
toJSON Player' {Maybe Text
Maybe (HashMap Text Natural)
Maybe (HashMap Text AttributeValue)
team :: Maybe Text
playerId :: Maybe Text
playerAttributes :: Maybe (HashMap Text AttributeValue)
latencyInMs :: Maybe (HashMap Text Natural)
$sel:team:Player' :: Player -> Maybe Text
$sel:playerId:Player' :: Player -> Maybe Text
$sel:playerAttributes:Player' :: Player -> Maybe (HashMap Text AttributeValue)
$sel:latencyInMs:Player' :: Player -> Maybe (HashMap Text Natural)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"LatencyInMs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Natural)
latencyInMs,
(Key
"PlayerAttributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text AttributeValue)
playerAttributes,
(Key
"PlayerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
playerId,
(Key
"Team" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
team
]
)