{-# 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.SnapshotDetails
-- 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.SnapshotDetails 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

-- | Properties that provide details of a snapshot.
--
-- /See:/ 'newSnapshotDetails' smart constructor.
data SnapshotDetails = SnapshotDetails'
  { -- | The timestamp of when the snapshot was created.
    SnapshotDetails -> Maybe ISO8601
created :: Prelude.Maybe Data.ISO8601,
    -- | The description of the snapshot.
    SnapshotDetails -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the snapshot.
    SnapshotDetails -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of when the snapshot was last updated.
    SnapshotDetails -> Maybe ISO8601
lastUpdated :: Prelude.Maybe Data.ISO8601,
    -- | The sections in the snapshot.
    SnapshotDetails -> Maybe (HashMap Text Section)
sections :: Prelude.Maybe (Prelude.HashMap Prelude.Text Section)
  }
  deriving (SnapshotDetails -> SnapshotDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnapshotDetails -> SnapshotDetails -> Bool
$c/= :: SnapshotDetails -> SnapshotDetails -> Bool
== :: SnapshotDetails -> SnapshotDetails -> Bool
$c== :: SnapshotDetails -> SnapshotDetails -> Bool
Prelude.Eq, ReadPrec [SnapshotDetails]
ReadPrec SnapshotDetails
Int -> ReadS SnapshotDetails
ReadS [SnapshotDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnapshotDetails]
$creadListPrec :: ReadPrec [SnapshotDetails]
readPrec :: ReadPrec SnapshotDetails
$creadPrec :: ReadPrec SnapshotDetails
readList :: ReadS [SnapshotDetails]
$creadList :: ReadS [SnapshotDetails]
readsPrec :: Int -> ReadS SnapshotDetails
$creadsPrec :: Int -> ReadS SnapshotDetails
Prelude.Read, Int -> SnapshotDetails -> ShowS
[SnapshotDetails] -> ShowS
SnapshotDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnapshotDetails] -> ShowS
$cshowList :: [SnapshotDetails] -> ShowS
show :: SnapshotDetails -> String
$cshow :: SnapshotDetails -> String
showsPrec :: Int -> SnapshotDetails -> ShowS
$cshowsPrec :: Int -> SnapshotDetails -> ShowS
Prelude.Show, forall x. Rep SnapshotDetails x -> SnapshotDetails
forall x. SnapshotDetails -> Rep SnapshotDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnapshotDetails x -> SnapshotDetails
$cfrom :: forall x. SnapshotDetails -> Rep SnapshotDetails x
Prelude.Generic)

-- |
-- Create a value of 'SnapshotDetails' 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', 'snapshotDetails_created' - The timestamp of when the snapshot was created.
--
-- 'description', 'snapshotDetails_description' - The description of the snapshot.
--
-- 'id', 'snapshotDetails_id' - The identifier of the snapshot.
--
-- 'lastUpdated', 'snapshotDetails_lastUpdated' - The timestamp of when the snapshot was last updated.
--
-- 'sections', 'snapshotDetails_sections' - The sections in the snapshot.
newSnapshotDetails ::
  SnapshotDetails
newSnapshotDetails :: SnapshotDetails
newSnapshotDetails =
  SnapshotDetails'
    { $sel:created:SnapshotDetails' :: Maybe ISO8601
created = forall a. Maybe a
Prelude.Nothing,
      $sel:description:SnapshotDetails' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:SnapshotDetails' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:SnapshotDetails' :: Maybe ISO8601
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:sections:SnapshotDetails' :: Maybe (HashMap Text Section)
sections = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp of when the snapshot was created.
snapshotDetails_created :: Lens.Lens' SnapshotDetails (Prelude.Maybe Prelude.UTCTime)
snapshotDetails_created :: Lens' SnapshotDetails (Maybe UTCTime)
snapshotDetails_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Maybe ISO8601
created :: Maybe ISO8601
$sel:created:SnapshotDetails' :: SnapshotDetails -> Maybe ISO8601
created} -> Maybe ISO8601
created) (\s :: SnapshotDetails
s@SnapshotDetails' {} Maybe ISO8601
a -> SnapshotDetails
s {$sel:created:SnapshotDetails' :: Maybe ISO8601
created = Maybe ISO8601
a} :: SnapshotDetails) 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 snapshot.
snapshotDetails_description :: Lens.Lens' SnapshotDetails (Prelude.Maybe Prelude.Text)
snapshotDetails_description :: Lens' SnapshotDetails (Maybe Text)
snapshotDetails_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Maybe Text
description :: Maybe Text
$sel:description:SnapshotDetails' :: SnapshotDetails -> Maybe Text
description} -> Maybe Text
description) (\s :: SnapshotDetails
s@SnapshotDetails' {} Maybe Text
a -> SnapshotDetails
s {$sel:description:SnapshotDetails' :: Maybe Text
description = Maybe Text
a} :: SnapshotDetails)

-- | The identifier of the snapshot.
snapshotDetails_id :: Lens.Lens' SnapshotDetails (Prelude.Maybe Prelude.Text)
snapshotDetails_id :: Lens' SnapshotDetails (Maybe Text)
snapshotDetails_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Maybe Text
id :: Maybe Text
$sel:id:SnapshotDetails' :: SnapshotDetails -> Maybe Text
id} -> Maybe Text
id) (\s :: SnapshotDetails
s@SnapshotDetails' {} Maybe Text
a -> SnapshotDetails
s {$sel:id:SnapshotDetails' :: Maybe Text
id = Maybe Text
a} :: SnapshotDetails)

-- | The timestamp of when the snapshot was last updated.
snapshotDetails_lastUpdated :: Lens.Lens' SnapshotDetails (Prelude.Maybe Prelude.UTCTime)
snapshotDetails_lastUpdated :: Lens' SnapshotDetails (Maybe UTCTime)
snapshotDetails_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Maybe ISO8601
lastUpdated :: Maybe ISO8601
$sel:lastUpdated:SnapshotDetails' :: SnapshotDetails -> Maybe ISO8601
lastUpdated} -> Maybe ISO8601
lastUpdated) (\s :: SnapshotDetails
s@SnapshotDetails' {} Maybe ISO8601
a -> SnapshotDetails
s {$sel:lastUpdated:SnapshotDetails' :: Maybe ISO8601
lastUpdated = Maybe ISO8601
a} :: SnapshotDetails) 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 sections in the snapshot.
snapshotDetails_sections :: Lens.Lens' SnapshotDetails (Prelude.Maybe (Prelude.HashMap Prelude.Text Section))
snapshotDetails_sections :: Lens' SnapshotDetails (Maybe (HashMap Text Section))
snapshotDetails_sections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Maybe (HashMap Text Section)
sections :: Maybe (HashMap Text Section)
$sel:sections:SnapshotDetails' :: SnapshotDetails -> Maybe (HashMap Text Section)
sections} -> Maybe (HashMap Text Section)
sections) (\s :: SnapshotDetails
s@SnapshotDetails' {} Maybe (HashMap Text Section)
a -> SnapshotDetails
s {$sel:sections:SnapshotDetails' :: Maybe (HashMap Text Section)
sections = Maybe (HashMap Text Section)
a} :: SnapshotDetails) 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 SnapshotDetails where
  parseJSON :: Value -> Parser SnapshotDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SnapshotDetails"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe (HashMap Text Section)
-> SnapshotDetails
SnapshotDetails'
            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
"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
"Id")
            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 SnapshotDetails where
  hashWithSalt :: Int -> SnapshotDetails -> Int
hashWithSalt Int
_salt SnapshotDetails' {Maybe Text
Maybe (HashMap Text Section)
Maybe ISO8601
sections :: Maybe (HashMap Text Section)
lastUpdated :: Maybe ISO8601
id :: Maybe Text
description :: Maybe Text
created :: Maybe ISO8601
$sel:sections:SnapshotDetails' :: SnapshotDetails -> Maybe (HashMap Text Section)
$sel:lastUpdated:SnapshotDetails' :: SnapshotDetails -> Maybe ISO8601
$sel:id:SnapshotDetails' :: SnapshotDetails -> Maybe Text
$sel:description:SnapshotDetails' :: SnapshotDetails -> Maybe Text
$sel:created:SnapshotDetails' :: SnapshotDetails -> 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 Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      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 SnapshotDetails where
  rnf :: SnapshotDetails -> ()
rnf SnapshotDetails' {Maybe Text
Maybe (HashMap Text Section)
Maybe ISO8601
sections :: Maybe (HashMap Text Section)
lastUpdated :: Maybe ISO8601
id :: Maybe Text
description :: Maybe Text
created :: Maybe ISO8601
$sel:sections:SnapshotDetails' :: SnapshotDetails -> Maybe (HashMap Text Section)
$sel:lastUpdated:SnapshotDetails' :: SnapshotDetails -> Maybe ISO8601
$sel:id:SnapshotDetails' :: SnapshotDetails -> Maybe Text
$sel:description:SnapshotDetails' :: SnapshotDetails -> Maybe Text
$sel:created:SnapshotDetails' :: SnapshotDetails -> 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 Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      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