{-# 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.DynamoDB.Types.PointInTimeRecoverySpecification
-- 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.DynamoDB.Types.PointInTimeRecoverySpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Represents the settings used to enable point in time recovery.
--
-- /See:/ 'newPointInTimeRecoverySpecification' smart constructor.
data PointInTimeRecoverySpecification = PointInTimeRecoverySpecification'
  { -- | Indicates whether point in time recovery is enabled (true) or disabled
    -- (false) on the table.
    PointInTimeRecoverySpecification -> Bool
pointInTimeRecoveryEnabled :: Prelude.Bool
  }
  deriving (PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
$c/= :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
== :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
$c== :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
Prelude.Eq, ReadPrec [PointInTimeRecoverySpecification]
ReadPrec PointInTimeRecoverySpecification
Int -> ReadS PointInTimeRecoverySpecification
ReadS [PointInTimeRecoverySpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PointInTimeRecoverySpecification]
$creadListPrec :: ReadPrec [PointInTimeRecoverySpecification]
readPrec :: ReadPrec PointInTimeRecoverySpecification
$creadPrec :: ReadPrec PointInTimeRecoverySpecification
readList :: ReadS [PointInTimeRecoverySpecification]
$creadList :: ReadS [PointInTimeRecoverySpecification]
readsPrec :: Int -> ReadS PointInTimeRecoverySpecification
$creadsPrec :: Int -> ReadS PointInTimeRecoverySpecification
Prelude.Read, Int -> PointInTimeRecoverySpecification -> ShowS
[PointInTimeRecoverySpecification] -> ShowS
PointInTimeRecoverySpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PointInTimeRecoverySpecification] -> ShowS
$cshowList :: [PointInTimeRecoverySpecification] -> ShowS
show :: PointInTimeRecoverySpecification -> String
$cshow :: PointInTimeRecoverySpecification -> String
showsPrec :: Int -> PointInTimeRecoverySpecification -> ShowS
$cshowsPrec :: Int -> PointInTimeRecoverySpecification -> ShowS
Prelude.Show, forall x.
Rep PointInTimeRecoverySpecification x
-> PointInTimeRecoverySpecification
forall x.
PointInTimeRecoverySpecification
-> Rep PointInTimeRecoverySpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PointInTimeRecoverySpecification x
-> PointInTimeRecoverySpecification
$cfrom :: forall x.
PointInTimeRecoverySpecification
-> Rep PointInTimeRecoverySpecification x
Prelude.Generic)

-- |
-- Create a value of 'PointInTimeRecoverySpecification' 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:
--
-- 'pointInTimeRecoveryEnabled', 'pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled' - Indicates whether point in time recovery is enabled (true) or disabled
-- (false) on the table.
newPointInTimeRecoverySpecification ::
  -- | 'pointInTimeRecoveryEnabled'
  Prelude.Bool ->
  PointInTimeRecoverySpecification
newPointInTimeRecoverySpecification :: Bool -> PointInTimeRecoverySpecification
newPointInTimeRecoverySpecification
  Bool
pPointInTimeRecoveryEnabled_ =
    PointInTimeRecoverySpecification'
      { $sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: Bool
pointInTimeRecoveryEnabled =
          Bool
pPointInTimeRecoveryEnabled_
      }

-- | Indicates whether point in time recovery is enabled (true) or disabled
-- (false) on the table.
pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled :: Lens.Lens' PointInTimeRecoverySpecification Prelude.Bool
pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled :: Lens' PointInTimeRecoverySpecification Bool
pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PointInTimeRecoverySpecification' {Bool
pointInTimeRecoveryEnabled :: Bool
$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: PointInTimeRecoverySpecification -> Bool
pointInTimeRecoveryEnabled} -> Bool
pointInTimeRecoveryEnabled) (\s :: PointInTimeRecoverySpecification
s@PointInTimeRecoverySpecification' {} Bool
a -> PointInTimeRecoverySpecification
s {$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: Bool
pointInTimeRecoveryEnabled = Bool
a} :: PointInTimeRecoverySpecification)

instance
  Prelude.Hashable
    PointInTimeRecoverySpecification
  where
  hashWithSalt :: Int -> PointInTimeRecoverySpecification -> Int
hashWithSalt
    Int
_salt
    PointInTimeRecoverySpecification' {Bool
pointInTimeRecoveryEnabled :: Bool
$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: PointInTimeRecoverySpecification -> Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
pointInTimeRecoveryEnabled

instance
  Prelude.NFData
    PointInTimeRecoverySpecification
  where
  rnf :: PointInTimeRecoverySpecification -> ()
rnf PointInTimeRecoverySpecification' {Bool
pointInTimeRecoveryEnabled :: Bool
$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: PointInTimeRecoverySpecification -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
pointInTimeRecoveryEnabled

instance Data.ToJSON PointInTimeRecoverySpecification where
  toJSON :: PointInTimeRecoverySpecification -> Value
toJSON PointInTimeRecoverySpecification' {Bool
pointInTimeRecoveryEnabled :: Bool
$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: PointInTimeRecoverySpecification -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"PointInTimeRecoveryEnabled"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
pointInTimeRecoveryEnabled
              )
          ]
      )