{-# 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.Connect.Types.PhoneNumberSummary
-- 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.Connect.Types.PhoneNumberSummary where

import Amazonka.Connect.Types.PhoneNumberCountryCode
import Amazonka.Connect.Types.PhoneNumberType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains summary information about a phone number for a contact center.
--
-- /See:/ 'newPhoneNumberSummary' smart constructor.
data PhoneNumberSummary = PhoneNumberSummary'
  { -- | The type of phone number.
    PhoneNumberSummary -> Maybe PhoneNumberType
phoneNumberType :: Prelude.Maybe PhoneNumberType,
    -- | The Amazon Resource Name (ARN) of the phone number.
    PhoneNumberSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The phone number.
    PhoneNumberSummary -> Maybe Text
phoneNumber :: Prelude.Maybe Prelude.Text,
    -- | The ISO country code.
    PhoneNumberSummary -> Maybe PhoneNumberCountryCode
phoneNumberCountryCode :: Prelude.Maybe PhoneNumberCountryCode,
    -- | The identifier of the phone number.
    PhoneNumberSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (PhoneNumberSummary -> PhoneNumberSummary -> Bool
(PhoneNumberSummary -> PhoneNumberSummary -> Bool)
-> (PhoneNumberSummary -> PhoneNumberSummary -> Bool)
-> Eq PhoneNumberSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumberSummary -> PhoneNumberSummary -> Bool
$c/= :: PhoneNumberSummary -> PhoneNumberSummary -> Bool
== :: PhoneNumberSummary -> PhoneNumberSummary -> Bool
$c== :: PhoneNumberSummary -> PhoneNumberSummary -> Bool
Prelude.Eq, ReadPrec [PhoneNumberSummary]
ReadPrec PhoneNumberSummary
Int -> ReadS PhoneNumberSummary
ReadS [PhoneNumberSummary]
(Int -> ReadS PhoneNumberSummary)
-> ReadS [PhoneNumberSummary]
-> ReadPrec PhoneNumberSummary
-> ReadPrec [PhoneNumberSummary]
-> Read PhoneNumberSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhoneNumberSummary]
$creadListPrec :: ReadPrec [PhoneNumberSummary]
readPrec :: ReadPrec PhoneNumberSummary
$creadPrec :: ReadPrec PhoneNumberSummary
readList :: ReadS [PhoneNumberSummary]
$creadList :: ReadS [PhoneNumberSummary]
readsPrec :: Int -> ReadS PhoneNumberSummary
$creadsPrec :: Int -> ReadS PhoneNumberSummary
Prelude.Read, Int -> PhoneNumberSummary -> ShowS
[PhoneNumberSummary] -> ShowS
PhoneNumberSummary -> String
(Int -> PhoneNumberSummary -> ShowS)
-> (PhoneNumberSummary -> String)
-> ([PhoneNumberSummary] -> ShowS)
-> Show PhoneNumberSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumberSummary] -> ShowS
$cshowList :: [PhoneNumberSummary] -> ShowS
show :: PhoneNumberSummary -> String
$cshow :: PhoneNumberSummary -> String
showsPrec :: Int -> PhoneNumberSummary -> ShowS
$cshowsPrec :: Int -> PhoneNumberSummary -> ShowS
Prelude.Show, (forall x. PhoneNumberSummary -> Rep PhoneNumberSummary x)
-> (forall x. Rep PhoneNumberSummary x -> PhoneNumberSummary)
-> Generic PhoneNumberSummary
forall x. Rep PhoneNumberSummary x -> PhoneNumberSummary
forall x. PhoneNumberSummary -> Rep PhoneNumberSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumberSummary x -> PhoneNumberSummary
$cfrom :: forall x. PhoneNumberSummary -> Rep PhoneNumberSummary x
Prelude.Generic)

-- |
-- Create a value of 'PhoneNumberSummary' 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:
--
-- 'phoneNumberType', 'phoneNumberSummary_phoneNumberType' - The type of phone number.
--
-- 'arn', 'phoneNumberSummary_arn' - The Amazon Resource Name (ARN) of the phone number.
--
-- 'phoneNumber', 'phoneNumberSummary_phoneNumber' - The phone number.
--
-- 'phoneNumberCountryCode', 'phoneNumberSummary_phoneNumberCountryCode' - The ISO country code.
--
-- 'id', 'phoneNumberSummary_id' - The identifier of the phone number.
newPhoneNumberSummary ::
  PhoneNumberSummary
newPhoneNumberSummary :: PhoneNumberSummary
newPhoneNumberSummary =
  PhoneNumberSummary' :: Maybe PhoneNumberType
-> Maybe Text
-> Maybe Text
-> Maybe PhoneNumberCountryCode
-> Maybe Text
-> PhoneNumberSummary
PhoneNumberSummary'
    { $sel:phoneNumberType:PhoneNumberSummary' :: Maybe PhoneNumberType
phoneNumberType =
        Maybe PhoneNumberType
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:PhoneNumberSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:PhoneNumberSummary' :: Maybe Text
phoneNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberCountryCode:PhoneNumberSummary' :: Maybe PhoneNumberCountryCode
phoneNumberCountryCode = Maybe PhoneNumberCountryCode
forall a. Maybe a
Prelude.Nothing,
      $sel:id:PhoneNumberSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of phone number.
phoneNumberSummary_phoneNumberType :: Lens.Lens' PhoneNumberSummary (Prelude.Maybe PhoneNumberType)
phoneNumberSummary_phoneNumberType :: (Maybe PhoneNumberType -> f (Maybe PhoneNumberType))
-> PhoneNumberSummary -> f PhoneNumberSummary
phoneNumberSummary_phoneNumberType = (PhoneNumberSummary -> Maybe PhoneNumberType)
-> (PhoneNumberSummary
    -> Maybe PhoneNumberType -> PhoneNumberSummary)
-> Lens
     PhoneNumberSummary
     PhoneNumberSummary
     (Maybe PhoneNumberType)
     (Maybe PhoneNumberType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberSummary' {Maybe PhoneNumberType
phoneNumberType :: Maybe PhoneNumberType
$sel:phoneNumberType:PhoneNumberSummary' :: PhoneNumberSummary -> Maybe PhoneNumberType
phoneNumberType} -> Maybe PhoneNumberType
phoneNumberType) (\s :: PhoneNumberSummary
s@PhoneNumberSummary' {} Maybe PhoneNumberType
a -> PhoneNumberSummary
s {$sel:phoneNumberType:PhoneNumberSummary' :: Maybe PhoneNumberType
phoneNumberType = Maybe PhoneNumberType
a} :: PhoneNumberSummary)

-- | The Amazon Resource Name (ARN) of the phone number.
phoneNumberSummary_arn :: Lens.Lens' PhoneNumberSummary (Prelude.Maybe Prelude.Text)
phoneNumberSummary_arn :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberSummary -> f PhoneNumberSummary
phoneNumberSummary_arn = (PhoneNumberSummary -> Maybe Text)
-> (PhoneNumberSummary -> Maybe Text -> PhoneNumberSummary)
-> Lens
     PhoneNumberSummary PhoneNumberSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:PhoneNumberSummary' :: PhoneNumberSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PhoneNumberSummary
s@PhoneNumberSummary' {} Maybe Text
a -> PhoneNumberSummary
s {$sel:arn:PhoneNumberSummary' :: Maybe Text
arn = Maybe Text
a} :: PhoneNumberSummary)

-- | The phone number.
phoneNumberSummary_phoneNumber :: Lens.Lens' PhoneNumberSummary (Prelude.Maybe Prelude.Text)
phoneNumberSummary_phoneNumber :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberSummary -> f PhoneNumberSummary
phoneNumberSummary_phoneNumber = (PhoneNumberSummary -> Maybe Text)
-> (PhoneNumberSummary -> Maybe Text -> PhoneNumberSummary)
-> Lens
     PhoneNumberSummary PhoneNumberSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberSummary' {Maybe Text
phoneNumber :: Maybe Text
$sel:phoneNumber:PhoneNumberSummary' :: PhoneNumberSummary -> Maybe Text
phoneNumber} -> Maybe Text
phoneNumber) (\s :: PhoneNumberSummary
s@PhoneNumberSummary' {} Maybe Text
a -> PhoneNumberSummary
s {$sel:phoneNumber:PhoneNumberSummary' :: Maybe Text
phoneNumber = Maybe Text
a} :: PhoneNumberSummary)

-- | The ISO country code.
phoneNumberSummary_phoneNumberCountryCode :: Lens.Lens' PhoneNumberSummary (Prelude.Maybe PhoneNumberCountryCode)
phoneNumberSummary_phoneNumberCountryCode :: (Maybe PhoneNumberCountryCode -> f (Maybe PhoneNumberCountryCode))
-> PhoneNumberSummary -> f PhoneNumberSummary
phoneNumberSummary_phoneNumberCountryCode = (PhoneNumberSummary -> Maybe PhoneNumberCountryCode)
-> (PhoneNumberSummary
    -> Maybe PhoneNumberCountryCode -> PhoneNumberSummary)
-> Lens
     PhoneNumberSummary
     PhoneNumberSummary
     (Maybe PhoneNumberCountryCode)
     (Maybe PhoneNumberCountryCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberSummary' {Maybe PhoneNumberCountryCode
phoneNumberCountryCode :: Maybe PhoneNumberCountryCode
$sel:phoneNumberCountryCode:PhoneNumberSummary' :: PhoneNumberSummary -> Maybe PhoneNumberCountryCode
phoneNumberCountryCode} -> Maybe PhoneNumberCountryCode
phoneNumberCountryCode) (\s :: PhoneNumberSummary
s@PhoneNumberSummary' {} Maybe PhoneNumberCountryCode
a -> PhoneNumberSummary
s {$sel:phoneNumberCountryCode:PhoneNumberSummary' :: Maybe PhoneNumberCountryCode
phoneNumberCountryCode = Maybe PhoneNumberCountryCode
a} :: PhoneNumberSummary)

-- | The identifier of the phone number.
phoneNumberSummary_id :: Lens.Lens' PhoneNumberSummary (Prelude.Maybe Prelude.Text)
phoneNumberSummary_id :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberSummary -> f PhoneNumberSummary
phoneNumberSummary_id = (PhoneNumberSummary -> Maybe Text)
-> (PhoneNumberSummary -> Maybe Text -> PhoneNumberSummary)
-> Lens
     PhoneNumberSummary PhoneNumberSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberSummary' {Maybe Text
id :: Maybe Text
$sel:id:PhoneNumberSummary' :: PhoneNumberSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: PhoneNumberSummary
s@PhoneNumberSummary' {} Maybe Text
a -> PhoneNumberSummary
s {$sel:id:PhoneNumberSummary' :: Maybe Text
id = Maybe Text
a} :: PhoneNumberSummary)

instance Core.FromJSON PhoneNumberSummary where
  parseJSON :: Value -> Parser PhoneNumberSummary
parseJSON =
    String
-> (Object -> Parser PhoneNumberSummary)
-> Value
-> Parser PhoneNumberSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PhoneNumberSummary"
      ( \Object
x ->
          Maybe PhoneNumberType
-> Maybe Text
-> Maybe Text
-> Maybe PhoneNumberCountryCode
-> Maybe Text
-> PhoneNumberSummary
PhoneNumberSummary'
            (Maybe PhoneNumberType
 -> Maybe Text
 -> Maybe Text
 -> Maybe PhoneNumberCountryCode
 -> Maybe Text
 -> PhoneNumberSummary)
-> Parser (Maybe PhoneNumberType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PhoneNumberCountryCode
      -> Maybe Text
      -> PhoneNumberSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PhoneNumberType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PhoneNumberType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PhoneNumberCountryCode
   -> Maybe Text
   -> PhoneNumberSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PhoneNumberCountryCode
      -> Maybe Text
      -> PhoneNumberSummary)
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
"Arn")
            Parser
  (Maybe Text
   -> Maybe PhoneNumberCountryCode
   -> Maybe Text
   -> PhoneNumberSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe PhoneNumberCountryCode -> Maybe Text -> PhoneNumberSummary)
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
"PhoneNumber")
            Parser
  (Maybe PhoneNumberCountryCode -> Maybe Text -> PhoneNumberSummary)
-> Parser (Maybe PhoneNumberCountryCode)
-> Parser (Maybe Text -> PhoneNumberSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PhoneNumberCountryCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PhoneNumberCountryCode")
            Parser (Maybe Text -> PhoneNumberSummary)
-> Parser (Maybe Text) -> Parser PhoneNumberSummary
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
"Id")
      )

instance Prelude.Hashable PhoneNumberSummary

instance Prelude.NFData PhoneNumberSummary