{-# 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.InboxPlacementTrackingOption where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InboxPlacementTrackingOption = InboxPlacementTrackingOption'
{
InboxPlacementTrackingOption -> Maybe [Text]
trackedIsps :: Prelude.Maybe [Prelude.Text],
InboxPlacementTrackingOption -> Maybe Bool
global :: Prelude.Maybe Prelude.Bool
}
deriving (InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool
(InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool)
-> (InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool)
-> Eq InboxPlacementTrackingOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool
$c/= :: InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool
== :: InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool
$c== :: InboxPlacementTrackingOption
-> InboxPlacementTrackingOption -> Bool
Prelude.Eq, ReadPrec [InboxPlacementTrackingOption]
ReadPrec InboxPlacementTrackingOption
Int -> ReadS InboxPlacementTrackingOption
ReadS [InboxPlacementTrackingOption]
(Int -> ReadS InboxPlacementTrackingOption)
-> ReadS [InboxPlacementTrackingOption]
-> ReadPrec InboxPlacementTrackingOption
-> ReadPrec [InboxPlacementTrackingOption]
-> Read InboxPlacementTrackingOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InboxPlacementTrackingOption]
$creadListPrec :: ReadPrec [InboxPlacementTrackingOption]
readPrec :: ReadPrec InboxPlacementTrackingOption
$creadPrec :: ReadPrec InboxPlacementTrackingOption
readList :: ReadS [InboxPlacementTrackingOption]
$creadList :: ReadS [InboxPlacementTrackingOption]
readsPrec :: Int -> ReadS InboxPlacementTrackingOption
$creadsPrec :: Int -> ReadS InboxPlacementTrackingOption
Prelude.Read, Int -> InboxPlacementTrackingOption -> ShowS
[InboxPlacementTrackingOption] -> ShowS
InboxPlacementTrackingOption -> String
(Int -> InboxPlacementTrackingOption -> ShowS)
-> (InboxPlacementTrackingOption -> String)
-> ([InboxPlacementTrackingOption] -> ShowS)
-> Show InboxPlacementTrackingOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InboxPlacementTrackingOption] -> ShowS
$cshowList :: [InboxPlacementTrackingOption] -> ShowS
show :: InboxPlacementTrackingOption -> String
$cshow :: InboxPlacementTrackingOption -> String
showsPrec :: Int -> InboxPlacementTrackingOption -> ShowS
$cshowsPrec :: Int -> InboxPlacementTrackingOption -> ShowS
Prelude.Show, (forall x.
InboxPlacementTrackingOption -> Rep InboxPlacementTrackingOption x)
-> (forall x.
Rep InboxPlacementTrackingOption x -> InboxPlacementTrackingOption)
-> Generic InboxPlacementTrackingOption
forall x.
Rep InboxPlacementTrackingOption x -> InboxPlacementTrackingOption
forall x.
InboxPlacementTrackingOption -> Rep InboxPlacementTrackingOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InboxPlacementTrackingOption x -> InboxPlacementTrackingOption
$cfrom :: forall x.
InboxPlacementTrackingOption -> Rep InboxPlacementTrackingOption x
Prelude.Generic)
newInboxPlacementTrackingOption ::
InboxPlacementTrackingOption
newInboxPlacementTrackingOption :: InboxPlacementTrackingOption
newInboxPlacementTrackingOption =
InboxPlacementTrackingOption' :: Maybe [Text] -> Maybe Bool -> InboxPlacementTrackingOption
InboxPlacementTrackingOption'
{ $sel:trackedIsps:InboxPlacementTrackingOption' :: Maybe [Text]
trackedIsps =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:global:InboxPlacementTrackingOption' :: Maybe Bool
global = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
inboxPlacementTrackingOption_trackedIsps :: Lens.Lens' InboxPlacementTrackingOption (Prelude.Maybe [Prelude.Text])
inboxPlacementTrackingOption_trackedIsps :: (Maybe [Text] -> f (Maybe [Text]))
-> InboxPlacementTrackingOption -> f InboxPlacementTrackingOption
inboxPlacementTrackingOption_trackedIsps = (InboxPlacementTrackingOption -> Maybe [Text])
-> (InboxPlacementTrackingOption
-> Maybe [Text] -> InboxPlacementTrackingOption)
-> Lens
InboxPlacementTrackingOption
InboxPlacementTrackingOption
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboxPlacementTrackingOption' {Maybe [Text]
trackedIsps :: Maybe [Text]
$sel:trackedIsps:InboxPlacementTrackingOption' :: InboxPlacementTrackingOption -> Maybe [Text]
trackedIsps} -> Maybe [Text]
trackedIsps) (\s :: InboxPlacementTrackingOption
s@InboxPlacementTrackingOption' {} Maybe [Text]
a -> InboxPlacementTrackingOption
s {$sel:trackedIsps:InboxPlacementTrackingOption' :: Maybe [Text]
trackedIsps = Maybe [Text]
a} :: InboxPlacementTrackingOption) ((Maybe [Text] -> f (Maybe [Text]))
-> InboxPlacementTrackingOption -> f InboxPlacementTrackingOption)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InboxPlacementTrackingOption
-> f InboxPlacementTrackingOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
inboxPlacementTrackingOption_global :: Lens.Lens' InboxPlacementTrackingOption (Prelude.Maybe Prelude.Bool)
inboxPlacementTrackingOption_global :: (Maybe Bool -> f (Maybe Bool))
-> InboxPlacementTrackingOption -> f InboxPlacementTrackingOption
inboxPlacementTrackingOption_global = (InboxPlacementTrackingOption -> Maybe Bool)
-> (InboxPlacementTrackingOption
-> Maybe Bool -> InboxPlacementTrackingOption)
-> Lens
InboxPlacementTrackingOption
InboxPlacementTrackingOption
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboxPlacementTrackingOption' {Maybe Bool
global :: Maybe Bool
$sel:global:InboxPlacementTrackingOption' :: InboxPlacementTrackingOption -> Maybe Bool
global} -> Maybe Bool
global) (\s :: InboxPlacementTrackingOption
s@InboxPlacementTrackingOption' {} Maybe Bool
a -> InboxPlacementTrackingOption
s {$sel:global:InboxPlacementTrackingOption' :: Maybe Bool
global = Maybe Bool
a} :: InboxPlacementTrackingOption)
instance Core.FromJSON InboxPlacementTrackingOption where
parseJSON :: Value -> Parser InboxPlacementTrackingOption
parseJSON =
String
-> (Object -> Parser InboxPlacementTrackingOption)
-> Value
-> Parser InboxPlacementTrackingOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InboxPlacementTrackingOption"
( \Object
x ->
Maybe [Text] -> Maybe Bool -> InboxPlacementTrackingOption
InboxPlacementTrackingOption'
(Maybe [Text] -> Maybe Bool -> InboxPlacementTrackingOption)
-> Parser (Maybe [Text])
-> Parser (Maybe Bool -> InboxPlacementTrackingOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TrackedIsps" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Bool -> InboxPlacementTrackingOption)
-> Parser (Maybe Bool) -> Parser InboxPlacementTrackingOption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Global")
)
instance
Prelude.Hashable
InboxPlacementTrackingOption
instance Prelude.NFData InboxPlacementTrackingOption
instance Core.ToJSON InboxPlacementTrackingOption where
toJSON :: InboxPlacementTrackingOption -> Value
toJSON InboxPlacementTrackingOption' {Maybe Bool
Maybe [Text]
global :: Maybe Bool
trackedIsps :: Maybe [Text]
$sel:global:InboxPlacementTrackingOption' :: InboxPlacementTrackingOption -> Maybe Bool
$sel:trackedIsps:InboxPlacementTrackingOption' :: InboxPlacementTrackingOption -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TrackedIsps" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
trackedIsps,
(Text
"Global" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
global
]
)