{-# 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.GamesParks.Types.GameDetails
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GamesParks.Types.GameDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GamesParks.Types.GameState
import qualified Amazonka.Prelude as Prelude

-- | Details about a game.
--
-- /See:/ 'newGameDetails' smart constructor.
data GameDetails = GameDetails'
  { -- | The Amazon Resource Name (ARN) of this game.
    GameDetails -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date when the game was created.
    GameDetails -> Maybe ISO8601
created :: Prelude.Maybe Data.ISO8601,
    -- | The description of the game.
    GameDetails -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Determines if the game can be deleted.
    GameDetails -> Maybe Bool
enableTerminationProtection :: Prelude.Maybe Prelude.Bool,
    -- | The date when the game was last modified.
    GameDetails -> Maybe ISO8601
lastUpdated :: Prelude.Maybe Data.ISO8601,
    -- | The name of the game.
    GameDetails -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The state of the game.
    GameDetails -> Maybe GameState
state :: Prelude.Maybe GameState,
    -- | The tags associated with the game.
    GameDetails -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (GameDetails -> GameDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GameDetails -> GameDetails -> Bool
$c/= :: GameDetails -> GameDetails -> Bool
== :: GameDetails -> GameDetails -> Bool
$c== :: GameDetails -> GameDetails -> Bool
Prelude.Eq, ReadPrec [GameDetails]
ReadPrec GameDetails
Int -> ReadS GameDetails
ReadS [GameDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GameDetails]
$creadListPrec :: ReadPrec [GameDetails]
readPrec :: ReadPrec GameDetails
$creadPrec :: ReadPrec GameDetails
readList :: ReadS [GameDetails]
$creadList :: ReadS [GameDetails]
readsPrec :: Int -> ReadS GameDetails
$creadsPrec :: Int -> ReadS GameDetails
Prelude.Read, Int -> GameDetails -> ShowS
[GameDetails] -> ShowS
GameDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GameDetails] -> ShowS
$cshowList :: [GameDetails] -> ShowS
show :: GameDetails -> String
$cshow :: GameDetails -> String
showsPrec :: Int -> GameDetails -> ShowS
$cshowsPrec :: Int -> GameDetails -> ShowS
Prelude.Show, forall x. Rep GameDetails x -> GameDetails
forall x. GameDetails -> Rep GameDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GameDetails x -> GameDetails
$cfrom :: forall x. GameDetails -> Rep GameDetails x
Prelude.Generic)

-- |
-- Create a value of 'GameDetails' 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:
--
-- 'arn', 'gameDetails_arn' - The Amazon Resource Name (ARN) of this game.
--
-- 'created', 'gameDetails_created' - The date when the game was created.
--
-- 'description', 'gameDetails_description' - The description of the game.
--
-- 'enableTerminationProtection', 'gameDetails_enableTerminationProtection' - Determines if the game can be deleted.
--
-- 'lastUpdated', 'gameDetails_lastUpdated' - The date when the game was last modified.
--
-- 'name', 'gameDetails_name' - The name of the game.
--
-- 'state', 'gameDetails_state' - The state of the game.
--
-- 'tags', 'gameDetails_tags' - The tags associated with the game.
newGameDetails ::
  GameDetails
newGameDetails :: GameDetails
newGameDetails =
  GameDetails'
    { $sel:arn:GameDetails' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:created:GameDetails' :: Maybe ISO8601
created = forall a. Maybe a
Prelude.Nothing,
      $sel:description:GameDetails' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:enableTerminationProtection:GameDetails' :: Maybe Bool
enableTerminationProtection = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:GameDetails' :: Maybe ISO8601
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:name:GameDetails' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:state:GameDetails' :: Maybe GameState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:GameDetails' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of this game.
gameDetails_arn :: Lens.Lens' GameDetails (Prelude.Maybe Prelude.Text)
gameDetails_arn :: Lens' GameDetails (Maybe Text)
gameDetails_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe Text
arn :: Maybe Text
$sel:arn:GameDetails' :: GameDetails -> Maybe Text
arn} -> Maybe Text
arn) (\s :: GameDetails
s@GameDetails' {} Maybe Text
a -> GameDetails
s {$sel:arn:GameDetails' :: Maybe Text
arn = Maybe Text
a} :: GameDetails)

-- | The date when the game was created.
gameDetails_created :: Lens.Lens' GameDetails (Prelude.Maybe Prelude.UTCTime)
gameDetails_created :: Lens' GameDetails (Maybe UTCTime)
gameDetails_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe ISO8601
created :: Maybe ISO8601
$sel:created:GameDetails' :: GameDetails -> Maybe ISO8601
created} -> Maybe ISO8601
created) (\s :: GameDetails
s@GameDetails' {} Maybe ISO8601
a -> GameDetails
s {$sel:created:GameDetails' :: Maybe ISO8601
created = Maybe ISO8601
a} :: GameDetails) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the game.
gameDetails_description :: Lens.Lens' GameDetails (Prelude.Maybe Prelude.Text)
gameDetails_description :: Lens' GameDetails (Maybe Text)
gameDetails_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe Text
description :: Maybe Text
$sel:description:GameDetails' :: GameDetails -> Maybe Text
description} -> Maybe Text
description) (\s :: GameDetails
s@GameDetails' {} Maybe Text
a -> GameDetails
s {$sel:description:GameDetails' :: Maybe Text
description = Maybe Text
a} :: GameDetails)

-- | Determines if the game can be deleted.
gameDetails_enableTerminationProtection :: Lens.Lens' GameDetails (Prelude.Maybe Prelude.Bool)
gameDetails_enableTerminationProtection :: Lens' GameDetails (Maybe Bool)
gameDetails_enableTerminationProtection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe Bool
enableTerminationProtection :: Maybe Bool
$sel:enableTerminationProtection:GameDetails' :: GameDetails -> Maybe Bool
enableTerminationProtection} -> Maybe Bool
enableTerminationProtection) (\s :: GameDetails
s@GameDetails' {} Maybe Bool
a -> GameDetails
s {$sel:enableTerminationProtection:GameDetails' :: Maybe Bool
enableTerminationProtection = Maybe Bool
a} :: GameDetails)

-- | The date when the game was last modified.
gameDetails_lastUpdated :: Lens.Lens' GameDetails (Prelude.Maybe Prelude.UTCTime)
gameDetails_lastUpdated :: Lens' GameDetails (Maybe UTCTime)
gameDetails_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe ISO8601
lastUpdated :: Maybe ISO8601
$sel:lastUpdated:GameDetails' :: GameDetails -> Maybe ISO8601
lastUpdated} -> Maybe ISO8601
lastUpdated) (\s :: GameDetails
s@GameDetails' {} Maybe ISO8601
a -> GameDetails
s {$sel:lastUpdated:GameDetails' :: Maybe ISO8601
lastUpdated = Maybe ISO8601
a} :: GameDetails) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the game.
gameDetails_name :: Lens.Lens' GameDetails (Prelude.Maybe Prelude.Text)
gameDetails_name :: Lens' GameDetails (Maybe Text)
gameDetails_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe Text
name :: Maybe Text
$sel:name:GameDetails' :: GameDetails -> Maybe Text
name} -> Maybe Text
name) (\s :: GameDetails
s@GameDetails' {} Maybe Text
a -> GameDetails
s {$sel:name:GameDetails' :: Maybe Text
name = Maybe Text
a} :: GameDetails)

-- | The state of the game.
gameDetails_state :: Lens.Lens' GameDetails (Prelude.Maybe GameState)
gameDetails_state :: Lens' GameDetails (Maybe GameState)
gameDetails_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe GameState
state :: Maybe GameState
$sel:state:GameDetails' :: GameDetails -> Maybe GameState
state} -> Maybe GameState
state) (\s :: GameDetails
s@GameDetails' {} Maybe GameState
a -> GameDetails
s {$sel:state:GameDetails' :: Maybe GameState
state = Maybe GameState
a} :: GameDetails)

-- | The tags associated with the game.
gameDetails_tags :: Lens.Lens' GameDetails (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
gameDetails_tags :: Lens' GameDetails (Maybe (HashMap Text Text))
gameDetails_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameDetails' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:GameDetails' :: GameDetails -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: GameDetails
s@GameDetails' {} Maybe (HashMap Text Text)
a -> GameDetails
s {$sel:tags:GameDetails' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: GameDetails) 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

instance Data.FromJSON GameDetails where
  parseJSON :: Value -> Parser GameDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GameDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Bool
-> Maybe ISO8601
-> Maybe Text
-> Maybe GameState
-> Maybe (HashMap Text Text)
-> GameDetails
GameDetails'
            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
"Arn")
            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
"Created")
            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
"Description")
            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
"EnableTerminationProtection")
            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
"LastUpdated")
            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
"Name")
            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
"State")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GameDetails where
  hashWithSalt :: Int -> GameDetails -> Int
hashWithSalt Int
_salt GameDetails' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe ISO8601
Maybe GameState
tags :: Maybe (HashMap Text Text)
state :: Maybe GameState
name :: Maybe Text
lastUpdated :: Maybe ISO8601
enableTerminationProtection :: Maybe Bool
description :: Maybe Text
created :: Maybe ISO8601
arn :: Maybe Text
$sel:tags:GameDetails' :: GameDetails -> Maybe (HashMap Text Text)
$sel:state:GameDetails' :: GameDetails -> Maybe GameState
$sel:name:GameDetails' :: GameDetails -> Maybe Text
$sel:lastUpdated:GameDetails' :: GameDetails -> Maybe ISO8601
$sel:enableTerminationProtection:GameDetails' :: GameDetails -> Maybe Bool
$sel:description:GameDetails' :: GameDetails -> Maybe Text
$sel:created:GameDetails' :: GameDetails -> Maybe ISO8601
$sel:arn:GameDetails' :: GameDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
created
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableTerminationProtection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
lastUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GameState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData GameDetails where
  rnf :: GameDetails -> ()
rnf GameDetails' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe ISO8601
Maybe GameState
tags :: Maybe (HashMap Text Text)
state :: Maybe GameState
name :: Maybe Text
lastUpdated :: Maybe ISO8601
enableTerminationProtection :: Maybe Bool
description :: Maybe Text
created :: Maybe ISO8601
arn :: Maybe Text
$sel:tags:GameDetails' :: GameDetails -> Maybe (HashMap Text Text)
$sel:state:GameDetails' :: GameDetails -> Maybe GameState
$sel:name:GameDetails' :: GameDetails -> Maybe Text
$sel:lastUpdated:GameDetails' :: GameDetails -> Maybe ISO8601
$sel:enableTerminationProtection:GameDetails' :: GameDetails -> Maybe Bool
$sel:description:GameDetails' :: GameDetails -> Maybe Text
$sel:created:GameDetails' :: GameDetails -> Maybe ISO8601
$sel:arn:GameDetails' :: GameDetails -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
created
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableTerminationProtection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
lastUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GameState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags