{-# 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.Chime.Types.Participant
-- 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.Chime.Types.Participant where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The phone number and proxy phone number for a participant in an Amazon
-- Chime Voice Connector proxy session.
--
-- /See:/ 'newParticipant' smart constructor.
data Participant = Participant'
  { -- | The participant\'s phone number.
    Participant -> Maybe (Sensitive Text)
phoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The participant\'s proxy phone number.
    Participant -> Maybe (Sensitive Text)
proxyPhoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (Participant -> Participant -> Bool
(Participant -> Participant -> Bool)
-> (Participant -> Participant -> Bool) -> Eq Participant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Participant -> Participant -> Bool
$c/= :: Participant -> Participant -> Bool
== :: Participant -> Participant -> Bool
$c== :: Participant -> Participant -> Bool
Prelude.Eq, Int -> Participant -> ShowS
[Participant] -> ShowS
Participant -> String
(Int -> Participant -> ShowS)
-> (Participant -> String)
-> ([Participant] -> ShowS)
-> Show Participant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Participant] -> ShowS
$cshowList :: [Participant] -> ShowS
show :: Participant -> String
$cshow :: Participant -> String
showsPrec :: Int -> Participant -> ShowS
$cshowsPrec :: Int -> Participant -> ShowS
Prelude.Show, (forall x. Participant -> Rep Participant x)
-> (forall x. Rep Participant x -> Participant)
-> Generic Participant
forall x. Rep Participant x -> Participant
forall x. Participant -> Rep Participant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Participant x -> Participant
$cfrom :: forall x. Participant -> Rep Participant x
Prelude.Generic)

-- |
-- Create a value of 'Participant' 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:
--
-- 'phoneNumber', 'participant_phoneNumber' - The participant\'s phone number.
--
-- 'proxyPhoneNumber', 'participant_proxyPhoneNumber' - The participant\'s proxy phone number.
newParticipant ::
  Participant
newParticipant :: Participant
newParticipant =
  Participant' :: Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Participant
Participant'
    { $sel:phoneNumber:Participant' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:proxyPhoneNumber:Participant' :: Maybe (Sensitive Text)
proxyPhoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The participant\'s phone number.
participant_phoneNumber :: Lens.Lens' Participant (Prelude.Maybe Prelude.Text)
participant_phoneNumber :: (Maybe Text -> f (Maybe Text)) -> Participant -> f Participant
participant_phoneNumber = (Participant -> Maybe (Sensitive Text))
-> (Participant -> Maybe (Sensitive Text) -> Participant)
-> Lens
     Participant
     Participant
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Participant' {Maybe (Sensitive Text)
phoneNumber :: Maybe (Sensitive Text)
$sel:phoneNumber:Participant' :: Participant -> Maybe (Sensitive Text)
phoneNumber} -> Maybe (Sensitive Text)
phoneNumber) (\s :: Participant
s@Participant' {} Maybe (Sensitive Text)
a -> Participant
s {$sel:phoneNumber:Participant' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
a} :: Participant) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Participant -> f Participant)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Participant
-> f Participant
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 participant\'s proxy phone number.
participant_proxyPhoneNumber :: Lens.Lens' Participant (Prelude.Maybe Prelude.Text)
participant_proxyPhoneNumber :: (Maybe Text -> f (Maybe Text)) -> Participant -> f Participant
participant_proxyPhoneNumber = (Participant -> Maybe (Sensitive Text))
-> (Participant -> Maybe (Sensitive Text) -> Participant)
-> Lens
     Participant
     Participant
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Participant' {Maybe (Sensitive Text)
proxyPhoneNumber :: Maybe (Sensitive Text)
$sel:proxyPhoneNumber:Participant' :: Participant -> Maybe (Sensitive Text)
proxyPhoneNumber} -> Maybe (Sensitive Text)
proxyPhoneNumber) (\s :: Participant
s@Participant' {} Maybe (Sensitive Text)
a -> Participant
s {$sel:proxyPhoneNumber:Participant' :: Maybe (Sensitive Text)
proxyPhoneNumber = Maybe (Sensitive Text)
a} :: Participant) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Participant -> f Participant)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Participant
-> f Participant
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

instance Core.FromJSON Participant where
  parseJSON :: Value -> Parser Participant
parseJSON =
    String
-> (Object -> Parser Participant) -> Value -> Parser Participant
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Participant"
      ( \Object
x ->
          Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Participant
Participant'
            (Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Participant)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe (Sensitive Text) -> Participant)
forall (f :: * -> *) a b. Functor 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 (Sensitive Text) -> Participant)
-> Parser (Maybe (Sensitive Text)) -> Parser Participant
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
"ProxyPhoneNumber")
      )

instance Prelude.Hashable Participant

instance Prelude.NFData Participant