{-# 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.GameConfigurationDetails
-- 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.GameConfigurationDetails 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.Section
import qualified Amazonka.Prelude as Prelude

-- | Details about the game configuration.
--
-- The game configuration is organized into named sections, where the
-- schema of each section is defined by an extension. The schema for these
-- sections can be retrieved using the @GetExtensionVersion@ operation.
--
-- /See:/ 'newGameConfigurationDetails' smart constructor.
data GameConfigurationDetails = GameConfigurationDetails'
  { -- | The date when the game was created.
    GameConfigurationDetails -> Maybe ISO8601
created :: Prelude.Maybe Data.ISO8601,
    -- | The date when the game was last modified.
    GameConfigurationDetails -> Maybe ISO8601
lastUpdated :: Prelude.Maybe Data.ISO8601,
    -- | Configuration data, organized by section name.
    GameConfigurationDetails -> Maybe (HashMap Text Section)
sections :: Prelude.Maybe (Prelude.HashMap Prelude.Text Section)
  }
  deriving (GameConfigurationDetails -> GameConfigurationDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GameConfigurationDetails -> GameConfigurationDetails -> Bool
$c/= :: GameConfigurationDetails -> GameConfigurationDetails -> Bool
== :: GameConfigurationDetails -> GameConfigurationDetails -> Bool
$c== :: GameConfigurationDetails -> GameConfigurationDetails -> Bool
Prelude.Eq, ReadPrec [GameConfigurationDetails]
ReadPrec GameConfigurationDetails
Int -> ReadS GameConfigurationDetails
ReadS [GameConfigurationDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GameConfigurationDetails]
$creadListPrec :: ReadPrec [GameConfigurationDetails]
readPrec :: ReadPrec GameConfigurationDetails
$creadPrec :: ReadPrec GameConfigurationDetails
readList :: ReadS [GameConfigurationDetails]
$creadList :: ReadS [GameConfigurationDetails]
readsPrec :: Int -> ReadS GameConfigurationDetails
$creadsPrec :: Int -> ReadS GameConfigurationDetails
Prelude.Read, Int -> GameConfigurationDetails -> ShowS
[GameConfigurationDetails] -> ShowS
GameConfigurationDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GameConfigurationDetails] -> ShowS
$cshowList :: [GameConfigurationDetails] -> ShowS
show :: GameConfigurationDetails -> String
$cshow :: GameConfigurationDetails -> String
showsPrec :: Int -> GameConfigurationDetails -> ShowS
$cshowsPrec :: Int -> GameConfigurationDetails -> ShowS
Prelude.Show, forall x.
Rep GameConfigurationDetails x -> GameConfigurationDetails
forall x.
GameConfigurationDetails -> Rep GameConfigurationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GameConfigurationDetails x -> GameConfigurationDetails
$cfrom :: forall x.
GameConfigurationDetails -> Rep GameConfigurationDetails x
Prelude.Generic)

-- |
-- Create a value of 'GameConfigurationDetails' 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:
--
-- 'created', 'gameConfigurationDetails_created' - The date when the game was created.
--
-- 'lastUpdated', 'gameConfigurationDetails_lastUpdated' - The date when the game was last modified.
--
-- 'sections', 'gameConfigurationDetails_sections' - Configuration data, organized by section name.
newGameConfigurationDetails ::
  GameConfigurationDetails
newGameConfigurationDetails :: GameConfigurationDetails
newGameConfigurationDetails =
  GameConfigurationDetails'
    { $sel:created:GameConfigurationDetails' :: Maybe ISO8601
created =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:GameConfigurationDetails' :: Maybe ISO8601
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:sections:GameConfigurationDetails' :: Maybe (HashMap Text Section)
sections = forall a. Maybe a
Prelude.Nothing
    }

-- | The date when the game was created.
gameConfigurationDetails_created :: Lens.Lens' GameConfigurationDetails (Prelude.Maybe Prelude.UTCTime)
gameConfigurationDetails_created :: Lens' GameConfigurationDetails (Maybe UTCTime)
gameConfigurationDetails_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameConfigurationDetails' {Maybe ISO8601
created :: Maybe ISO8601
$sel:created:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe ISO8601
created} -> Maybe ISO8601
created) (\s :: GameConfigurationDetails
s@GameConfigurationDetails' {} Maybe ISO8601
a -> GameConfigurationDetails
s {$sel:created:GameConfigurationDetails' :: Maybe ISO8601
created = Maybe ISO8601
a} :: GameConfigurationDetails) 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 date when the game was last modified.
gameConfigurationDetails_lastUpdated :: Lens.Lens' GameConfigurationDetails (Prelude.Maybe Prelude.UTCTime)
gameConfigurationDetails_lastUpdated :: Lens' GameConfigurationDetails (Maybe UTCTime)
gameConfigurationDetails_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameConfigurationDetails' {Maybe ISO8601
lastUpdated :: Maybe ISO8601
$sel:lastUpdated:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe ISO8601
lastUpdated} -> Maybe ISO8601
lastUpdated) (\s :: GameConfigurationDetails
s@GameConfigurationDetails' {} Maybe ISO8601
a -> GameConfigurationDetails
s {$sel:lastUpdated:GameConfigurationDetails' :: Maybe ISO8601
lastUpdated = Maybe ISO8601
a} :: GameConfigurationDetails) 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

-- | Configuration data, organized by section name.
gameConfigurationDetails_sections :: Lens.Lens' GameConfigurationDetails (Prelude.Maybe (Prelude.HashMap Prelude.Text Section))
gameConfigurationDetails_sections :: Lens' GameConfigurationDetails (Maybe (HashMap Text Section))
gameConfigurationDetails_sections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameConfigurationDetails' {Maybe (HashMap Text Section)
sections :: Maybe (HashMap Text Section)
$sel:sections:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe (HashMap Text Section)
sections} -> Maybe (HashMap Text Section)
sections) (\s :: GameConfigurationDetails
s@GameConfigurationDetails' {} Maybe (HashMap Text Section)
a -> GameConfigurationDetails
s {$sel:sections:GameConfigurationDetails' :: Maybe (HashMap Text Section)
sections = Maybe (HashMap Text Section)
a} :: GameConfigurationDetails) 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 GameConfigurationDetails where
  parseJSON :: Value -> Parser GameConfigurationDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GameConfigurationDetails"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe ISO8601
-> Maybe (HashMap Text Section)
-> GameConfigurationDetails
GameConfigurationDetails'
            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
"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
"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
"Sections" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GameConfigurationDetails where
  hashWithSalt :: Int -> GameConfigurationDetails -> Int
hashWithSalt Int
_salt GameConfigurationDetails' {Maybe (HashMap Text Section)
Maybe ISO8601
sections :: Maybe (HashMap Text Section)
lastUpdated :: Maybe ISO8601
created :: Maybe ISO8601
$sel:sections:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe (HashMap Text Section)
$sel:lastUpdated:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe ISO8601
$sel:created:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
created
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
lastUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Section)
sections

instance Prelude.NFData GameConfigurationDetails where
  rnf :: GameConfigurationDetails -> ()
rnf GameConfigurationDetails' {Maybe (HashMap Text Section)
Maybe ISO8601
sections :: Maybe (HashMap Text Section)
lastUpdated :: Maybe ISO8601
created :: Maybe ISO8601
$sel:sections:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe (HashMap Text Section)
$sel:lastUpdated:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe ISO8601
$sel:created:GameConfigurationDetails' :: GameConfigurationDetails -> Maybe ISO8601
..} =
    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 ISO8601
lastUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Section)
sections