{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information related to a contact.
--
-- /See:/ 'newContactData' smart constructor.
data ContactData = ContactData'
  { -- | The ARN of the contact.
    ContactData -> Maybe Text
contactArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the contact to display on the console.
    ContactData -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The first name of the contact, used to call the contact on the device.
    ContactData -> Maybe Text
firstName :: Prelude.Maybe Prelude.Text,
    -- | The last name of the contact, used to call the contact on the device.
    ContactData -> Maybe Text
lastName :: Prelude.Maybe Prelude.Text,
    -- | 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 (Data.Sensitive Prelude.Text),
    -- | The list of phone numbers for the contact.
    ContactData -> Maybe [PhoneNumber]
phoneNumbers :: Prelude.Maybe [PhoneNumber],
    -- | The list of SIP addresses for the contact.
    ContactData -> Maybe [SipAddress]
sipAddresses :: Prelude.Maybe [SipAddress]
  }
  deriving (ContactData -> ContactData -> Bool
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
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. 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:
--
-- 'contactArn', 'contactData_contactArn' - The ARN of the contact.
--
-- 'displayName', 'contactData_displayName' - The name of the contact to display on the console.
--
-- 'firstName', 'contactData_firstName' - The first name of the contact, used to call the contact on the device.
--
-- 'lastName', 'contactData_lastName' - The last name of the contact, used to call the contact on the device.
--
-- '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.
--
-- 'phoneNumbers', 'contactData_phoneNumbers' - The list of phone numbers for the contact.
--
-- 'sipAddresses', 'contactData_sipAddresses' - The list of SIP addresses for the contact.
newContactData ::
  ContactData
newContactData :: ContactData
newContactData =
  ContactData'
    { $sel:contactArn:ContactData' :: Maybe Text
contactArn = forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:ContactData' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
      $sel:firstName:ContactData' :: Maybe Text
firstName = forall a. Maybe a
Prelude.Nothing,
      $sel:lastName:ContactData' :: Maybe Text
lastName = forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:ContactData' :: Maybe (Sensitive Text)
phoneNumber = forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumbers:ContactData' :: Maybe [PhoneNumber]
phoneNumbers = forall a. Maybe a
Prelude.Nothing,
      $sel:sipAddresses:ContactData' :: Maybe [SipAddress]
sipAddresses = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the contact.
contactData_contactArn :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_contactArn :: Lens' ContactData (Maybe Text)
contactData_contactArn = 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 name of the contact to display on the console.
contactData_displayName :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_displayName :: Lens' ContactData (Maybe Text)
contactData_displayName = 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)

-- | 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 :: Lens' ContactData (Maybe Text)
contactData_firstName = 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 last name of the contact, used to call the contact on the device.
contactData_lastName :: Lens.Lens' ContactData (Prelude.Maybe Prelude.Text)
contactData_lastName :: Lens' ContactData (Maybe Text)
contactData_lastName = 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 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 :: Lens' ContactData (Maybe Text)
contactData_phoneNumber = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The list of phone numbers for the contact.
contactData_phoneNumbers :: Lens.Lens' ContactData (Prelude.Maybe [PhoneNumber])
contactData_phoneNumbers :: Lens' ContactData (Maybe [PhoneNumber])
contactData_phoneNumbers = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of SIP addresses for the contact.
contactData_sipAddresses :: Lens.Lens' ContactData (Prelude.Maybe [SipAddress])
contactData_sipAddresses :: Lens' ContactData (Maybe [SipAddress])
contactData_sipAddresses = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ContactData where
  parseJSON :: Value -> Parser ContactData
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContactData"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe [PhoneNumber]
-> Maybe [SipAddress]
-> ContactData
ContactData'
            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
"ContactArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DisplayName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FirstName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PhoneNumber")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PhoneNumbers" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SipAddresses" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ContactData where
  hashWithSalt :: Int -> ContactData -> Int
hashWithSalt Int
_salt ContactData' {Maybe [PhoneNumber]
Maybe [SipAddress]
Maybe Text
Maybe (Sensitive Text)
sipAddresses :: Maybe [SipAddress]
phoneNumbers :: Maybe [PhoneNumber]
phoneNumber :: Maybe (Sensitive Text)
lastName :: Maybe Text
firstName :: Maybe Text
displayName :: Maybe Text
contactArn :: Maybe Text
$sel:sipAddresses:ContactData' :: ContactData -> Maybe [SipAddress]
$sel:phoneNumbers:ContactData' :: ContactData -> Maybe [PhoneNumber]
$sel:phoneNumber:ContactData' :: ContactData -> Maybe (Sensitive Text)
$sel:lastName:ContactData' :: ContactData -> Maybe Text
$sel:firstName:ContactData' :: ContactData -> Maybe Text
$sel:displayName:ContactData' :: ContactData -> Maybe Text
$sel:contactArn:ContactData' :: ContactData -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contactArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
firstName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
phoneNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PhoneNumber]
phoneNumbers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SipAddress]
sipAddresses

instance Prelude.NFData ContactData where
  rnf :: ContactData -> ()
rnf ContactData' {Maybe [PhoneNumber]
Maybe [SipAddress]
Maybe Text
Maybe (Sensitive Text)
sipAddresses :: Maybe [SipAddress]
phoneNumbers :: Maybe [PhoneNumber]
phoneNumber :: Maybe (Sensitive Text)
lastName :: Maybe Text
firstName :: Maybe Text
displayName :: Maybe Text
contactArn :: Maybe Text
$sel:sipAddresses:ContactData' :: ContactData -> Maybe [SipAddress]
$sel:phoneNumbers:ContactData' :: ContactData -> Maybe [PhoneNumber]
$sel:phoneNumber:ContactData' :: ContactData -> Maybe (Sensitive Text)
$sel:lastName:ContactData' :: ContactData -> Maybe Text
$sel:firstName:ContactData' :: ContactData -> Maybe Text
$sel:displayName:ContactData' :: ContactData -> Maybe Text
$sel:contactArn:ContactData' :: ContactData -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contactArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firstName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
phoneNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PhoneNumber]
phoneNumbers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SipAddress]
sipAddresses