{-# 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 #-}
module Amazonka.Chime.Types.ConversationRetentionSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ConversationRetentionSettings = ConversationRetentionSettings'
{
ConversationRetentionSettings -> Maybe Natural
retentionDays :: Prelude.Maybe Prelude.Natural
}
deriving (ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool
(ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool)
-> (ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool)
-> Eq ConversationRetentionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool
$c/= :: ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool
== :: ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool
$c== :: ConversationRetentionSettings
-> ConversationRetentionSettings -> Bool
Prelude.Eq, ReadPrec [ConversationRetentionSettings]
ReadPrec ConversationRetentionSettings
Int -> ReadS ConversationRetentionSettings
ReadS [ConversationRetentionSettings]
(Int -> ReadS ConversationRetentionSettings)
-> ReadS [ConversationRetentionSettings]
-> ReadPrec ConversationRetentionSettings
-> ReadPrec [ConversationRetentionSettings]
-> Read ConversationRetentionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConversationRetentionSettings]
$creadListPrec :: ReadPrec [ConversationRetentionSettings]
readPrec :: ReadPrec ConversationRetentionSettings
$creadPrec :: ReadPrec ConversationRetentionSettings
readList :: ReadS [ConversationRetentionSettings]
$creadList :: ReadS [ConversationRetentionSettings]
readsPrec :: Int -> ReadS ConversationRetentionSettings
$creadsPrec :: Int -> ReadS ConversationRetentionSettings
Prelude.Read, Int -> ConversationRetentionSettings -> ShowS
[ConversationRetentionSettings] -> ShowS
ConversationRetentionSettings -> String
(Int -> ConversationRetentionSettings -> ShowS)
-> (ConversationRetentionSettings -> String)
-> ([ConversationRetentionSettings] -> ShowS)
-> Show ConversationRetentionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConversationRetentionSettings] -> ShowS
$cshowList :: [ConversationRetentionSettings] -> ShowS
show :: ConversationRetentionSettings -> String
$cshow :: ConversationRetentionSettings -> String
showsPrec :: Int -> ConversationRetentionSettings -> ShowS
$cshowsPrec :: Int -> ConversationRetentionSettings -> ShowS
Prelude.Show, (forall x.
ConversationRetentionSettings
-> Rep ConversationRetentionSettings x)
-> (forall x.
Rep ConversationRetentionSettings x
-> ConversationRetentionSettings)
-> Generic ConversationRetentionSettings
forall x.
Rep ConversationRetentionSettings x
-> ConversationRetentionSettings
forall x.
ConversationRetentionSettings
-> Rep ConversationRetentionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConversationRetentionSettings x
-> ConversationRetentionSettings
$cfrom :: forall x.
ConversationRetentionSettings
-> Rep ConversationRetentionSettings x
Prelude.Generic)
newConversationRetentionSettings ::
ConversationRetentionSettings
newConversationRetentionSettings :: ConversationRetentionSettings
newConversationRetentionSettings =
ConversationRetentionSettings' :: Maybe Natural -> ConversationRetentionSettings
ConversationRetentionSettings'
{ $sel:retentionDays:ConversationRetentionSettings' :: Maybe Natural
retentionDays =
Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
conversationRetentionSettings_retentionDays :: Lens.Lens' ConversationRetentionSettings (Prelude.Maybe Prelude.Natural)
conversationRetentionSettings_retentionDays :: (Maybe Natural -> f (Maybe Natural))
-> ConversationRetentionSettings -> f ConversationRetentionSettings
conversationRetentionSettings_retentionDays = (ConversationRetentionSettings -> Maybe Natural)
-> (ConversationRetentionSettings
-> Maybe Natural -> ConversationRetentionSettings)
-> Lens
ConversationRetentionSettings
ConversationRetentionSettings
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConversationRetentionSettings' {Maybe Natural
retentionDays :: Maybe Natural
$sel:retentionDays:ConversationRetentionSettings' :: ConversationRetentionSettings -> Maybe Natural
retentionDays} -> Maybe Natural
retentionDays) (\s :: ConversationRetentionSettings
s@ConversationRetentionSettings' {} Maybe Natural
a -> ConversationRetentionSettings
s {$sel:retentionDays:ConversationRetentionSettings' :: Maybe Natural
retentionDays = Maybe Natural
a} :: ConversationRetentionSettings)
instance Core.FromJSON ConversationRetentionSettings where
parseJSON :: Value -> Parser ConversationRetentionSettings
parseJSON =
String
-> (Object -> Parser ConversationRetentionSettings)
-> Value
-> Parser ConversationRetentionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConversationRetentionSettings"
( \Object
x ->
Maybe Natural -> ConversationRetentionSettings
ConversationRetentionSettings'
(Maybe Natural -> ConversationRetentionSettings)
-> Parser (Maybe Natural) -> Parser ConversationRetentionSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RetentionDays")
)
instance
Prelude.Hashable
ConversationRetentionSettings
instance Prelude.NFData ConversationRetentionSettings
instance Core.ToJSON ConversationRetentionSettings where
toJSON :: ConversationRetentionSettings -> Value
toJSON ConversationRetentionSettings' {Maybe Natural
retentionDays :: Maybe Natural
$sel:retentionDays:ConversationRetentionSettings' :: ConversationRetentionSettings -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RetentionDays" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
retentionDays
]
)