{-# 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.SESV2.Types.Contact where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.TopicPreference
data Contact = Contact'
{
Contact -> Maybe Bool
unsubscribeAll :: Prelude.Maybe Prelude.Bool,
Contact -> Maybe [TopicPreference]
topicDefaultPreferences :: Prelude.Maybe [TopicPreference],
Contact -> Maybe Text
emailAddress :: Prelude.Maybe Prelude.Text,
Contact -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Core.POSIX,
Contact -> Maybe [TopicPreference]
topicPreferences :: Prelude.Maybe [TopicPreference]
}
deriving (Contact -> Contact -> Bool
(Contact -> Contact -> Bool)
-> (Contact -> Contact -> Bool) -> Eq Contact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Contact -> Contact -> Bool
$c/= :: Contact -> Contact -> Bool
== :: Contact -> Contact -> Bool
$c== :: Contact -> Contact -> Bool
Prelude.Eq, ReadPrec [Contact]
ReadPrec Contact
Int -> ReadS Contact
ReadS [Contact]
(Int -> ReadS Contact)
-> ReadS [Contact]
-> ReadPrec Contact
-> ReadPrec [Contact]
-> Read Contact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Contact]
$creadListPrec :: ReadPrec [Contact]
readPrec :: ReadPrec Contact
$creadPrec :: ReadPrec Contact
readList :: ReadS [Contact]
$creadList :: ReadS [Contact]
readsPrec :: Int -> ReadS Contact
$creadsPrec :: Int -> ReadS Contact
Prelude.Read, Int -> Contact -> ShowS
[Contact] -> ShowS
Contact -> String
(Int -> Contact -> ShowS)
-> (Contact -> String) -> ([Contact] -> ShowS) -> Show Contact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Contact] -> ShowS
$cshowList :: [Contact] -> ShowS
show :: Contact -> String
$cshow :: Contact -> String
showsPrec :: Int -> Contact -> ShowS
$cshowsPrec :: Int -> Contact -> ShowS
Prelude.Show, (forall x. Contact -> Rep Contact x)
-> (forall x. Rep Contact x -> Contact) -> Generic Contact
forall x. Rep Contact x -> Contact
forall x. Contact -> Rep Contact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Contact x -> Contact
$cfrom :: forall x. Contact -> Rep Contact x
Prelude.Generic)
newContact ::
Contact
newContact :: Contact
newContact =
Contact' :: Maybe Bool
-> Maybe [TopicPreference]
-> Maybe Text
-> Maybe POSIX
-> Maybe [TopicPreference]
-> Contact
Contact'
{ $sel:unsubscribeAll:Contact' :: Maybe Bool
unsubscribeAll = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:topicDefaultPreferences:Contact' :: Maybe [TopicPreference]
topicDefaultPreferences = Maybe [TopicPreference]
forall a. Maybe a
Prelude.Nothing,
$sel:emailAddress:Contact' :: Maybe Text
emailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdatedTimestamp:Contact' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:topicPreferences:Contact' :: Maybe [TopicPreference]
topicPreferences = Maybe [TopicPreference]
forall a. Maybe a
Prelude.Nothing
}
contact_unsubscribeAll :: Lens.Lens' Contact (Prelude.Maybe Prelude.Bool)
contact_unsubscribeAll :: (Maybe Bool -> f (Maybe Bool)) -> Contact -> f Contact
contact_unsubscribeAll = (Contact -> Maybe Bool)
-> (Contact -> Maybe Bool -> Contact)
-> Lens Contact Contact (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe Bool
unsubscribeAll :: Maybe Bool
$sel:unsubscribeAll:Contact' :: Contact -> Maybe Bool
unsubscribeAll} -> Maybe Bool
unsubscribeAll) (\s :: Contact
s@Contact' {} Maybe Bool
a -> Contact
s {$sel:unsubscribeAll:Contact' :: Maybe Bool
unsubscribeAll = Maybe Bool
a} :: Contact)
contact_topicDefaultPreferences :: Lens.Lens' Contact (Prelude.Maybe [TopicPreference])
contact_topicDefaultPreferences :: (Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Contact -> f Contact
contact_topicDefaultPreferences = (Contact -> Maybe [TopicPreference])
-> (Contact -> Maybe [TopicPreference] -> Contact)
-> Lens
Contact Contact (Maybe [TopicPreference]) (Maybe [TopicPreference])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe [TopicPreference]
topicDefaultPreferences :: Maybe [TopicPreference]
$sel:topicDefaultPreferences:Contact' :: Contact -> Maybe [TopicPreference]
topicDefaultPreferences} -> Maybe [TopicPreference]
topicDefaultPreferences) (\s :: Contact
s@Contact' {} Maybe [TopicPreference]
a -> Contact
s {$sel:topicDefaultPreferences:Contact' :: Maybe [TopicPreference]
topicDefaultPreferences = Maybe [TopicPreference]
a} :: Contact) ((Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Contact -> f Contact)
-> ((Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> (Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Contact
-> f Contact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TopicPreference]
[TopicPreference]
[TopicPreference]
[TopicPreference]
-> Iso
(Maybe [TopicPreference])
(Maybe [TopicPreference])
(Maybe [TopicPreference])
(Maybe [TopicPreference])
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
[TopicPreference]
[TopicPreference]
[TopicPreference]
[TopicPreference]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
contact_emailAddress :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_emailAddress :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_emailAddress = (Contact -> Maybe Text)
-> (Contact -> Maybe Text -> Contact)
-> Lens Contact Contact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe Text
emailAddress :: Maybe Text
$sel:emailAddress:Contact' :: Contact -> Maybe Text
emailAddress} -> Maybe Text
emailAddress) (\s :: Contact
s@Contact' {} Maybe Text
a -> Contact
s {$sel:emailAddress:Contact' :: Maybe Text
emailAddress = Maybe Text
a} :: Contact)
contact_lastUpdatedTimestamp :: Lens.Lens' Contact (Prelude.Maybe Prelude.UTCTime)
contact_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Contact -> f Contact
contact_lastUpdatedTimestamp = (Contact -> Maybe POSIX)
-> (Contact -> Maybe POSIX -> Contact)
-> Lens Contact Contact (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:Contact' :: Contact -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: Contact
s@Contact' {} Maybe POSIX
a -> Contact
s {$sel:lastUpdatedTimestamp:Contact' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: Contact) ((Maybe POSIX -> f (Maybe POSIX)) -> Contact -> f Contact)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Contact
-> f Contact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
contact_topicPreferences :: Lens.Lens' Contact (Prelude.Maybe [TopicPreference])
contact_topicPreferences :: (Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Contact -> f Contact
contact_topicPreferences = (Contact -> Maybe [TopicPreference])
-> (Contact -> Maybe [TopicPreference] -> Contact)
-> Lens
Contact Contact (Maybe [TopicPreference]) (Maybe [TopicPreference])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe [TopicPreference]
topicPreferences :: Maybe [TopicPreference]
$sel:topicPreferences:Contact' :: Contact -> Maybe [TopicPreference]
topicPreferences} -> Maybe [TopicPreference]
topicPreferences) (\s :: Contact
s@Contact' {} Maybe [TopicPreference]
a -> Contact
s {$sel:topicPreferences:Contact' :: Maybe [TopicPreference]
topicPreferences = Maybe [TopicPreference]
a} :: Contact) ((Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Contact -> f Contact)
-> ((Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> (Maybe [TopicPreference] -> f (Maybe [TopicPreference]))
-> Contact
-> f Contact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TopicPreference]
[TopicPreference]
[TopicPreference]
[TopicPreference]
-> Iso
(Maybe [TopicPreference])
(Maybe [TopicPreference])
(Maybe [TopicPreference])
(Maybe [TopicPreference])
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
[TopicPreference]
[TopicPreference]
[TopicPreference]
[TopicPreference]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Contact where
parseJSON :: Value -> Parser Contact
parseJSON =
String -> (Object -> Parser Contact) -> Value -> Parser Contact
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Contact"
( \Object
x ->
Maybe Bool
-> Maybe [TopicPreference]
-> Maybe Text
-> Maybe POSIX
-> Maybe [TopicPreference]
-> Contact
Contact'
(Maybe Bool
-> Maybe [TopicPreference]
-> Maybe Text
-> Maybe POSIX
-> Maybe [TopicPreference]
-> Contact)
-> Parser (Maybe Bool)
-> Parser
(Maybe [TopicPreference]
-> Maybe Text -> Maybe POSIX -> Maybe [TopicPreference] -> Contact)
forall (f :: * -> *) a b. Functor 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
"UnsubscribeAll")
Parser
(Maybe [TopicPreference]
-> Maybe Text -> Maybe POSIX -> Maybe [TopicPreference] -> Contact)
-> Parser (Maybe [TopicPreference])
-> Parser
(Maybe Text -> Maybe POSIX -> Maybe [TopicPreference] -> Contact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [TopicPreference]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TopicDefaultPreferences"
Parser (Maybe (Maybe [TopicPreference]))
-> Maybe [TopicPreference] -> Parser (Maybe [TopicPreference])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [TopicPreference]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe Text -> Maybe POSIX -> Maybe [TopicPreference] -> Contact)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe [TopicPreference] -> Contact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EmailAddress")
Parser (Maybe POSIX -> Maybe [TopicPreference] -> Contact)
-> Parser (Maybe POSIX)
-> Parser (Maybe [TopicPreference] -> Contact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdatedTimestamp")
Parser (Maybe [TopicPreference] -> Contact)
-> Parser (Maybe [TopicPreference]) -> Parser Contact
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [TopicPreference]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TopicPreferences"
Parser (Maybe (Maybe [TopicPreference]))
-> Maybe [TopicPreference] -> Parser (Maybe [TopicPreference])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [TopicPreference]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Contact
instance Prelude.NFData Contact