{-# 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.PinpointEmail.Types.SendingOptions 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
data SendingOptions = SendingOptions'
{
SendingOptions -> Maybe Bool
sendingEnabled :: Prelude.Maybe Prelude.Bool
}
deriving (SendingOptions -> SendingOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendingOptions -> SendingOptions -> Bool
$c/= :: SendingOptions -> SendingOptions -> Bool
== :: SendingOptions -> SendingOptions -> Bool
$c== :: SendingOptions -> SendingOptions -> Bool
Prelude.Eq, ReadPrec [SendingOptions]
ReadPrec SendingOptions
Int -> ReadS SendingOptions
ReadS [SendingOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendingOptions]
$creadListPrec :: ReadPrec [SendingOptions]
readPrec :: ReadPrec SendingOptions
$creadPrec :: ReadPrec SendingOptions
readList :: ReadS [SendingOptions]
$creadList :: ReadS [SendingOptions]
readsPrec :: Int -> ReadS SendingOptions
$creadsPrec :: Int -> ReadS SendingOptions
Prelude.Read, Int -> SendingOptions -> ShowS
[SendingOptions] -> ShowS
SendingOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendingOptions] -> ShowS
$cshowList :: [SendingOptions] -> ShowS
show :: SendingOptions -> String
$cshow :: SendingOptions -> String
showsPrec :: Int -> SendingOptions -> ShowS
$cshowsPrec :: Int -> SendingOptions -> ShowS
Prelude.Show, forall x. Rep SendingOptions x -> SendingOptions
forall x. SendingOptions -> Rep SendingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendingOptions x -> SendingOptions
$cfrom :: forall x. SendingOptions -> Rep SendingOptions x
Prelude.Generic)
newSendingOptions ::
SendingOptions
newSendingOptions :: SendingOptions
newSendingOptions =
SendingOptions' {$sel:sendingEnabled:SendingOptions' :: Maybe Bool
sendingEnabled = forall a. Maybe a
Prelude.Nothing}
sendingOptions_sendingEnabled :: Lens.Lens' SendingOptions (Prelude.Maybe Prelude.Bool)
sendingOptions_sendingEnabled :: Lens' SendingOptions (Maybe Bool)
sendingOptions_sendingEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendingOptions' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:SendingOptions' :: SendingOptions -> Maybe Bool
sendingEnabled} -> Maybe Bool
sendingEnabled) (\s :: SendingOptions
s@SendingOptions' {} Maybe Bool
a -> SendingOptions
s {$sel:sendingEnabled:SendingOptions' :: Maybe Bool
sendingEnabled = Maybe Bool
a} :: SendingOptions)
instance Data.FromJSON SendingOptions where
parseJSON :: Value -> Parser SendingOptions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SendingOptions"
( \Object
x ->
Maybe Bool -> SendingOptions
SendingOptions'
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
"SendingEnabled")
)
instance Prelude.Hashable SendingOptions where
hashWithSalt :: Int -> SendingOptions -> Int
hashWithSalt Int
_salt SendingOptions' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:SendingOptions' :: SendingOptions -> Maybe Bool
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
sendingEnabled
instance Prelude.NFData SendingOptions where
rnf :: SendingOptions -> ()
rnf SendingOptions' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:SendingOptions' :: SendingOptions -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
sendingEnabled
instance Data.ToJSON SendingOptions where
toJSON :: SendingOptions -> Value
toJSON SendingOptions' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:SendingOptions' :: SendingOptions -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SendingEnabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
sendingEnabled
]
)