{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.Types.ContactData
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AlexaBusiness.Types.ContactData 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

-- | Information related to a contact.
--
-- /See:/ 'newContactData' smart constructor.
data ContactData = ContactData'
  { -- | The last name of the contact, used to call the contact on the device.
    ContactData -> Maybe Text
lastName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the contact.
    ContactData -> Maybe Text
contactArn :: Prelude.Maybe Prelude.Text,
    -- | The list of phone numbers for the contact.
    ContactData -> Maybe [PhoneNumber]
phoneNumbers :: Prelude.Maybe [PhoneNumber],
    -- | The phone number of the contact. The phone number type defaults to WORK.
    -- You can specify PhoneNumber or PhoneNumbers. We recommend that you use
    -- PhoneNumbers, which lets you specify the phone number type and multiple
    -- numbers.
    ContactData -> Maybe (Sensitive Text)
phoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The list of SIP addresses for the contact.
    ContactData -> Maybe [SipAddress]
sipAddresses :: Prelude.Maybe [SipAddress],
    -- | The first name of the contact, used to call the contact on the device.
    ContactData -> Maybe Text
firstName :: Prelude.Maybe Prelude.Text,
    -- | The name of the contact to display on the console.
    ContactData -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text
  }
  deriving (ContactData -> ContactData -> Bool
(ContactData -> ContactData -> Bool)
-> (ContactData -> ContactData -> Bool) -> Eq ContactData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContactData -> ContactData -> Bool
$c/= :: ContactData -> ContactData -> Bool
== :: ContactData -> ContactData -> Bool
$c== :: ContactData -> ContactData -> Bool
Prelude.Eq, Int -> ContactData -> ShowS
[ContactData] -> ShowS
ContactData -> String
(Int -> ContactData -> ShowS)
-> (ContactData -> String)
-> ([ContactData] -> ShowS)
-> Show ContactData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContactData] -> ShowS
$cshowList :: [ContactData] -> ShowS
show :: ContactData -> String
$cshow :: ContactData -> String
showsPrec :: Int -> ContactData -> ShowS
$cshowsPrec :: Int -> ContactData -> ShowS
Prelude.Show, (forall x. ContactData -> Rep ContactData x)
-> (forall x. Rep ContactData x -> ContactData)
-> Generic ContactData
forall x. Rep ContactData x -> ContactData
forall x. ContactData -> Rep ContactData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContactData x -> ContactData
$cfrom :: forall x. ContactData -> Rep ContactData x
Prelude.Generic)

-- |
-- Create a value of 'ContactData' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'lastName', 'contactData_lastName' - The last name of the contact, used to call the contact on the device.
--
-- 'contactArn', 'contactData_contactArn' - The ARN of the contact.
--
-- 'phoneNumbers', 'contactData_phoneNumbers' - The list of phone numbers for the contact.
--
-- 'phoneNumber', 'contactData_phoneNumber' - The phone number of the contact. The phone number type defaults to WORK.
-- You can specify PhoneNumber or PhoneNumbers. We recommend that you use
-- PhoneNumbers, which lets you specify the phone number type and multiple
-- numbers.
--
-- 'sipAddresses', 'contactData_sipAddresses' - The list of SIP addresses for the contact.
--
-- 'firstName', 'contactData_firstName' - The first name of the contact, used to call the contact on the device.
--
-- 'displayName', 'contactData_displayName' - The name of the contact to display on the console.
newContactData ::
  ContactData
newContactData :: ContactData
newContactData =
  ContactData' :: Maybe Text
-> Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> ContactData
ContactData'
    { $sel:lastName:ContactData' :: Maybe Text
lastName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contactArn:ContactData' :: Maybe Text
contactArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumbers:ContactData' :: Maybe [PhoneNumber]
phoneNumbers = Maybe [PhoneNumber]
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:ContactData' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:sipAddresses:ContactData' :: Maybe [SipAddress]
sipAddresses = Maybe [SipAddress]
forall a. Maybe a
Prelude.Nothing,
      $sel:firstName:ContactData' :: Maybe Text
firstName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:ContactData' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The last name of the contact, used to call the contact on the device.
contactData_lastName :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_lastName :: (Maybe Text -> f (Maybe Text)) -> ContactData -> f ContactData
contactData_lastName = (ContactData -> Maybe Text)
-> (ContactData -> Maybe Text -> ContactData)
-> Lens ContactData ContactData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe Text
lastName :: Maybe Text
$sel:lastName:ContactData' :: ContactData -> Maybe Text
lastName} -> Maybe Text
lastName) (\s :: ContactData
s@ContactData' {} Maybe Text
a -> ContactData
s {$sel:lastName:ContactData' :: Maybe Text
lastName = Maybe Text
a} :: ContactData)

-- | The ARN of the contact.
contactData_contactArn :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_contactArn :: (Maybe Text -> f (Maybe Text)) -> ContactData -> f ContactData
contactData_contactArn = (ContactData -> Maybe Text)
-> (ContactData -> Maybe Text -> ContactData)
-> Lens ContactData ContactData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe Text
contactArn :: Maybe Text
$sel:contactArn:ContactData' :: ContactData -> Maybe Text
contactArn} -> Maybe Text
contactArn) (\s :: ContactData
s@ContactData' {} Maybe Text
a -> ContactData
s {$sel:contactArn:ContactData' :: Maybe Text
contactArn = Maybe Text
a} :: ContactData)

-- | The list of phone numbers for the contact.
contactData_phoneNumbers :: Lens.Lens' ContactData (Prelude.Maybe [PhoneNumber])
contactData_phoneNumbers :: (Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> ContactData -> f ContactData
contactData_phoneNumbers = (ContactData -> Maybe [PhoneNumber])
-> (ContactData -> Maybe [PhoneNumber] -> ContactData)
-> Lens
     ContactData ContactData (Maybe [PhoneNumber]) (Maybe [PhoneNumber])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe [PhoneNumber]
phoneNumbers :: Maybe [PhoneNumber]
$sel:phoneNumbers:ContactData' :: ContactData -> Maybe [PhoneNumber]
phoneNumbers} -> Maybe [PhoneNumber]
phoneNumbers) (\s :: ContactData
s@ContactData' {} Maybe [PhoneNumber]
a -> ContactData
s {$sel:phoneNumbers:ContactData' :: Maybe [PhoneNumber]
phoneNumbers = Maybe [PhoneNumber]
a} :: ContactData) ((Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
 -> ContactData -> f ContactData)
-> ((Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
    -> Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> (Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> ContactData
-> f ContactData
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

-- | The phone number of the contact. The phone number type defaults to WORK.
-- You can specify PhoneNumber or PhoneNumbers. We recommend that you use
-- PhoneNumbers, which lets you specify the phone number type and multiple
-- numbers.
contactData_phoneNumber :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_phoneNumber :: (Maybe Text -> f (Maybe Text)) -> ContactData -> f ContactData
contactData_phoneNumber = (ContactData -> Maybe (Sensitive Text))
-> (ContactData -> Maybe (Sensitive Text) -> ContactData)
-> Lens
     ContactData
     ContactData
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe (Sensitive Text)
phoneNumber :: Maybe (Sensitive Text)
$sel:phoneNumber:ContactData' :: ContactData -> Maybe (Sensitive Text)
phoneNumber} -> Maybe (Sensitive Text)
phoneNumber) (\s :: ContactData
s@ContactData' {} Maybe (Sensitive Text)
a -> ContactData
s {$sel:phoneNumber:ContactData' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
a} :: ContactData) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ContactData -> f ContactData)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ContactData
-> f ContactData
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

-- | The list of SIP addresses for the contact.
contactData_sipAddresses :: Lens.Lens' ContactData (Prelude.Maybe [SipAddress])
contactData_sipAddresses :: (Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> ContactData -> f ContactData
contactData_sipAddresses = (ContactData -> Maybe [SipAddress])
-> (ContactData -> Maybe [SipAddress] -> ContactData)
-> Lens
     ContactData ContactData (Maybe [SipAddress]) (Maybe [SipAddress])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe [SipAddress]
sipAddresses :: Maybe [SipAddress]
$sel:sipAddresses:ContactData' :: ContactData -> Maybe [SipAddress]
sipAddresses} -> Maybe [SipAddress]
sipAddresses) (\s :: ContactData
s@ContactData' {} Maybe [SipAddress]
a -> ContactData
s {$sel:sipAddresses:ContactData' :: Maybe [SipAddress]
sipAddresses = Maybe [SipAddress]
a} :: ContactData) ((Maybe [SipAddress] -> f (Maybe [SipAddress]))
 -> ContactData -> f ContactData)
-> ((Maybe [SipAddress] -> f (Maybe [SipAddress]))
    -> Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> (Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> ContactData
-> f ContactData
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

-- | The first name of the contact, used to call the contact on the device.
contactData_firstName :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_firstName :: (Maybe Text -> f (Maybe Text)) -> ContactData -> f ContactData
contactData_firstName = (ContactData -> Maybe Text)
-> (ContactData -> Maybe Text -> ContactData)
-> Lens ContactData ContactData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe Text
firstName :: Maybe Text
$sel:firstName:ContactData' :: ContactData -> Maybe Text
firstName} -> Maybe Text
firstName) (\s :: ContactData
s@ContactData' {} Maybe Text
a -> ContactData
s {$sel:firstName:ContactData' :: Maybe Text
firstName = Maybe Text
a} :: ContactData)

-- | The name of the contact to display on the console.
contactData_displayName :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_displayName :: (Maybe Text -> f (Maybe Text)) -> ContactData -> f ContactData
contactData_displayName = (ContactData -> Maybe Text)
-> (ContactData -> Maybe Text -> ContactData)
-> Lens ContactData ContactData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactData' {Maybe Text
displayName :: Maybe Text
$sel:displayName:ContactData' :: ContactData -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: ContactData
s@ContactData' {} Maybe Text
a -> ContactData
s {$sel:displayName:ContactData' :: Maybe Text
displayName = Maybe Text
a} :: ContactData)

instance Core.FromJSON ContactData where
  parseJSON :: Value -> Parser ContactData
parseJSON =
    String
-> (Object -> Parser ContactData) -> Value -> Parser ContactData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContactData"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> ContactData
ContactData'
            (Maybe Text
 -> Maybe Text
 -> Maybe [PhoneNumber]
 -> Maybe (Sensitive Text)
 -> Maybe [SipAddress]
 -> Maybe Text
 -> Maybe Text
 -> ContactData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [PhoneNumber]
      -> Maybe (Sensitive Text)
      -> Maybe [SipAddress]
      -> Maybe Text
      -> Maybe Text
      -> ContactData)
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
   -> ContactData)
-> Parser (Maybe Text)
-> Parser
     (Maybe [PhoneNumber]
      -> Maybe (Sensitive Text)
      -> Maybe [SipAddress]
      -> Maybe Text
      -> Maybe Text
      -> ContactData)
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
   -> ContactData)
-> Parser (Maybe [PhoneNumber])
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe [SipAddress] -> Maybe Text -> Maybe Text -> ContactData)
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 -> ContactData)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe [SipAddress] -> Maybe Text -> Maybe Text -> ContactData)
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 -> ContactData)
-> Parser (Maybe [SipAddress])
-> Parser (Maybe Text -> Maybe Text -> ContactData)
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 -> ContactData)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ContactData)
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 -> ContactData)
-> Parser (Maybe Text) -> Parser ContactData
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 ContactData

instance Prelude.NFData ContactData