{-# 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.RBin.Types.LockConfiguration
-- 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.RBin.Types.LockConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.RBin.Types.UnlockDelay

-- | Information about a retention rule lock configuration.
--
-- /See:/ 'newLockConfiguration' smart constructor.
data LockConfiguration = LockConfiguration'
  { -- | Information about the retention rule unlock delay.
    LockConfiguration -> UnlockDelay
unlockDelay :: UnlockDelay
  }
  deriving (LockConfiguration -> LockConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LockConfiguration -> LockConfiguration -> Bool
$c/= :: LockConfiguration -> LockConfiguration -> Bool
== :: LockConfiguration -> LockConfiguration -> Bool
$c== :: LockConfiguration -> LockConfiguration -> Bool
Prelude.Eq, ReadPrec [LockConfiguration]
ReadPrec LockConfiguration
Int -> ReadS LockConfiguration
ReadS [LockConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LockConfiguration]
$creadListPrec :: ReadPrec [LockConfiguration]
readPrec :: ReadPrec LockConfiguration
$creadPrec :: ReadPrec LockConfiguration
readList :: ReadS [LockConfiguration]
$creadList :: ReadS [LockConfiguration]
readsPrec :: Int -> ReadS LockConfiguration
$creadsPrec :: Int -> ReadS LockConfiguration
Prelude.Read, Int -> LockConfiguration -> ShowS
[LockConfiguration] -> ShowS
LockConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LockConfiguration] -> ShowS
$cshowList :: [LockConfiguration] -> ShowS
show :: LockConfiguration -> String
$cshow :: LockConfiguration -> String
showsPrec :: Int -> LockConfiguration -> ShowS
$cshowsPrec :: Int -> LockConfiguration -> ShowS
Prelude.Show, forall x. Rep LockConfiguration x -> LockConfiguration
forall x. LockConfiguration -> Rep LockConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LockConfiguration x -> LockConfiguration
$cfrom :: forall x. LockConfiguration -> Rep LockConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LockConfiguration' 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:
--
-- 'unlockDelay', 'lockConfiguration_unlockDelay' - Information about the retention rule unlock delay.
newLockConfiguration ::
  -- | 'unlockDelay'
  UnlockDelay ->
  LockConfiguration
newLockConfiguration :: UnlockDelay -> LockConfiguration
newLockConfiguration UnlockDelay
pUnlockDelay_ =
  LockConfiguration' {$sel:unlockDelay:LockConfiguration' :: UnlockDelay
unlockDelay = UnlockDelay
pUnlockDelay_}

-- | Information about the retention rule unlock delay.
lockConfiguration_unlockDelay :: Lens.Lens' LockConfiguration UnlockDelay
lockConfiguration_unlockDelay :: Lens' LockConfiguration UnlockDelay
lockConfiguration_unlockDelay = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LockConfiguration' {UnlockDelay
unlockDelay :: UnlockDelay
$sel:unlockDelay:LockConfiguration' :: LockConfiguration -> UnlockDelay
unlockDelay} -> UnlockDelay
unlockDelay) (\s :: LockConfiguration
s@LockConfiguration' {} UnlockDelay
a -> LockConfiguration
s {$sel:unlockDelay:LockConfiguration' :: UnlockDelay
unlockDelay = UnlockDelay
a} :: LockConfiguration)

instance Data.FromJSON LockConfiguration where
  parseJSON :: Value -> Parser LockConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LockConfiguration"
      ( \Object
x ->
          UnlockDelay -> LockConfiguration
LockConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"UnlockDelay")
      )

instance Prelude.Hashable LockConfiguration where
  hashWithSalt :: Int -> LockConfiguration -> Int
hashWithSalt Int
_salt LockConfiguration' {UnlockDelay
unlockDelay :: UnlockDelay
$sel:unlockDelay:LockConfiguration' :: LockConfiguration -> UnlockDelay
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` UnlockDelay
unlockDelay

instance Prelude.NFData LockConfiguration where
  rnf :: LockConfiguration -> ()
rnf LockConfiguration' {UnlockDelay
unlockDelay :: UnlockDelay
$sel:unlockDelay:LockConfiguration' :: LockConfiguration -> UnlockDelay
..} = forall a. NFData a => a -> ()
Prelude.rnf UnlockDelay
unlockDelay

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