{-# 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.AlexaBusiness.Types.Contact where
import Amazonka.AlexaBusiness.Types.PhoneNumber
import Amazonka.AlexaBusiness.Types.SipAddress
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Contact = Contact'
{
Contact -> Maybe Text
lastName :: Prelude.Maybe Prelude.Text,
Contact -> Maybe Text
contactArn :: Prelude.Maybe Prelude.Text,
Contact -> Maybe [PhoneNumber]
phoneNumbers :: Prelude.Maybe [PhoneNumber],
Contact -> Maybe (Sensitive Text)
phoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
Contact -> Maybe [SipAddress]
sipAddresses :: Prelude.Maybe [SipAddress],
Contact -> Maybe Text
firstName :: Prelude.Maybe Prelude.Text,
Contact -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text
}
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, 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 Text
-> Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Contact
Contact'
{ $sel:lastName:Contact' :: Maybe Text
lastName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contactArn:Contact' :: Maybe Text
contactArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:phoneNumbers:Contact' :: Maybe [PhoneNumber]
phoneNumbers = Maybe [PhoneNumber]
forall a. Maybe a
Prelude.Nothing,
$sel:phoneNumber:Contact' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:sipAddresses:Contact' :: Maybe [SipAddress]
sipAddresses = Maybe [SipAddress]
forall a. Maybe a
Prelude.Nothing,
$sel:firstName:Contact' :: Maybe Text
firstName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:displayName:Contact' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
contact_lastName :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_lastName :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_lastName = (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
lastName :: Maybe Text
$sel:lastName:Contact' :: Contact -> Maybe Text
lastName} -> Maybe Text
lastName) (\s :: Contact
s@Contact' {} Maybe Text
a -> Contact
s {$sel:lastName:Contact' :: Maybe Text
lastName = Maybe Text
a} :: Contact)
contact_contactArn :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_contactArn :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_contactArn = (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
contactArn :: Maybe Text
$sel:contactArn:Contact' :: Contact -> Maybe Text
contactArn} -> Maybe Text
contactArn) (\s :: Contact
s@Contact' {} Maybe Text
a -> Contact
s {$sel:contactArn:Contact' :: Maybe Text
contactArn = Maybe Text
a} :: Contact)
contact_phoneNumbers :: Lens.Lens' Contact (Prelude.Maybe [PhoneNumber])
contact_phoneNumbers :: (Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> Contact -> f Contact
contact_phoneNumbers = (Contact -> Maybe [PhoneNumber])
-> (Contact -> Maybe [PhoneNumber] -> Contact)
-> Lens Contact Contact (Maybe [PhoneNumber]) (Maybe [PhoneNumber])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe [PhoneNumber]
phoneNumbers :: Maybe [PhoneNumber]
$sel:phoneNumbers:Contact' :: Contact -> Maybe [PhoneNumber]
phoneNumbers} -> Maybe [PhoneNumber]
phoneNumbers) (\s :: Contact
s@Contact' {} Maybe [PhoneNumber]
a -> Contact
s {$sel:phoneNumbers:Contact' :: Maybe [PhoneNumber]
phoneNumbers = Maybe [PhoneNumber]
a} :: Contact) ((Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> Contact -> f Contact)
-> ((Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> (Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> Contact
-> f Contact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PhoneNumber] [PhoneNumber] [PhoneNumber] [PhoneNumber]
-> Iso
(Maybe [PhoneNumber])
(Maybe [PhoneNumber])
(Maybe [PhoneNumber])
(Maybe [PhoneNumber])
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 [PhoneNumber] [PhoneNumber] [PhoneNumber] [PhoneNumber]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
contact_phoneNumber :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_phoneNumber :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_phoneNumber = (Contact -> Maybe (Sensitive Text))
-> (Contact -> Maybe (Sensitive Text) -> Contact)
-> Lens
Contact Contact (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe (Sensitive Text)
phoneNumber :: Maybe (Sensitive Text)
$sel:phoneNumber:Contact' :: Contact -> Maybe (Sensitive Text)
phoneNumber} -> Maybe (Sensitive Text)
phoneNumber) (\s :: Contact
s@Contact' {} Maybe (Sensitive Text)
a -> Contact
s {$sel:phoneNumber:Contact' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
a} :: Contact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Contact -> f Contact)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Contact
-> f Contact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
contact_sipAddresses :: Lens.Lens' Contact (Prelude.Maybe [SipAddress])
contact_sipAddresses :: (Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> Contact -> f Contact
contact_sipAddresses = (Contact -> Maybe [SipAddress])
-> (Contact -> Maybe [SipAddress] -> Contact)
-> Lens Contact Contact (Maybe [SipAddress]) (Maybe [SipAddress])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe [SipAddress]
sipAddresses :: Maybe [SipAddress]
$sel:sipAddresses:Contact' :: Contact -> Maybe [SipAddress]
sipAddresses} -> Maybe [SipAddress]
sipAddresses) (\s :: Contact
s@Contact' {} Maybe [SipAddress]
a -> Contact
s {$sel:sipAddresses:Contact' :: Maybe [SipAddress]
sipAddresses = Maybe [SipAddress]
a} :: Contact) ((Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> Contact -> f Contact)
-> ((Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> (Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> Contact
-> f Contact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SipAddress] [SipAddress] [SipAddress] [SipAddress]
-> Iso
(Maybe [SipAddress])
(Maybe [SipAddress])
(Maybe [SipAddress])
(Maybe [SipAddress])
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 [SipAddress] [SipAddress] [SipAddress] [SipAddress]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
contact_firstName :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_firstName :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_firstName = (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
firstName :: Maybe Text
$sel:firstName:Contact' :: Contact -> Maybe Text
firstName} -> Maybe Text
firstName) (\s :: Contact
s@Contact' {} Maybe Text
a -> Contact
s {$sel:firstName:Contact' :: Maybe Text
firstName = Maybe Text
a} :: Contact)
contact_displayName :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_displayName :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_displayName = (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
displayName :: Maybe Text
$sel:displayName:Contact' :: Contact -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: Contact
s@Contact' {} Maybe Text
a -> Contact
s {$sel:displayName:Contact' :: Maybe Text
displayName = Maybe Text
a} :: Contact)
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 Text
-> Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Contact
Contact'
(Maybe Text
-> Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Contact)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Contact)
forall (f :: * -> *) a b. Functor 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
"LastName")
Parser
(Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Contact)
-> Parser (Maybe Text)
-> Parser
(Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> 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
"ContactArn")
Parser
(Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Contact)
-> Parser (Maybe [PhoneNumber])
-> Parser
(Maybe (Sensitive Text)
-> Maybe [SipAddress] -> Maybe Text -> Maybe Text -> Contact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [PhoneNumber]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PhoneNumbers" Parser (Maybe (Maybe [PhoneNumber]))
-> Maybe [PhoneNumber] -> Parser (Maybe [PhoneNumber])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PhoneNumber]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe (Sensitive Text)
-> Maybe [SipAddress] -> Maybe Text -> Maybe Text -> Contact)
-> Parser (Maybe (Sensitive Text))
-> Parser
(Maybe [SipAddress] -> Maybe Text -> Maybe Text -> Contact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PhoneNumber")
Parser (Maybe [SipAddress] -> Maybe Text -> Maybe Text -> Contact)
-> Parser (Maybe [SipAddress])
-> Parser (Maybe Text -> Maybe Text -> Contact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [SipAddress]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SipAddresses" Parser (Maybe (Maybe [SipAddress]))
-> Maybe [SipAddress] -> Parser (Maybe [SipAddress])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SipAddress]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe Text -> Contact)
-> Parser (Maybe Text) -> Parser (Maybe Text -> 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
"FirstName")
Parser (Maybe Text -> Contact)
-> Parser (Maybe Text) -> Parser 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
"DisplayName")
)
instance Prelude.Hashable Contact
instance Prelude.NFData Contact