{-# 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.PhoneNumber
-- 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.PhoneNumber where

import Amazonka.Chime.Types.CallingNameStatus
import Amazonka.Chime.Types.PhoneNumberAssociation
import Amazonka.Chime.Types.PhoneNumberCapabilities
import Amazonka.Chime.Types.PhoneNumberProductType
import Amazonka.Chime.Types.PhoneNumberStatus
import Amazonka.Chime.Types.PhoneNumberType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A phone number used for Amazon Chime Business Calling or an Amazon Chime
-- Voice Connector.
--
-- /See:/ 'newPhoneNumber' smart constructor.
data PhoneNumber = PhoneNumber'
  { -- | The phone number status.
    PhoneNumber -> Maybe PhoneNumberStatus
status :: Prelude.Maybe PhoneNumberStatus,
    -- | The deleted phone number timestamp, in ISO 8601 format.
    PhoneNumber -> Maybe POSIX
deletionTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The phone number ID.
    PhoneNumber -> Maybe Text
phoneNumberId :: Prelude.Maybe Prelude.Text,
    -- | The phone number country. Format: ISO 3166-1 alpha-2.
    PhoneNumber -> Maybe Text
country :: Prelude.Maybe Prelude.Text,
    -- | The updated phone number timestamp, in ISO 8601 format.
    PhoneNumber -> Maybe POSIX
updatedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The phone number product type.
    PhoneNumber -> Maybe PhoneNumberProductType
productType :: Prelude.Maybe PhoneNumberProductType,
    -- | The phone number, in E.164 format.
    PhoneNumber -> Maybe (Sensitive Text)
e164PhoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The phone number associations.
    PhoneNumber -> Maybe [PhoneNumberAssociation]
associations :: Prelude.Maybe [PhoneNumberAssociation],
    -- | The outbound calling name associated with the phone number.
    PhoneNumber -> Maybe (Sensitive Text)
callingName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The phone number type.
    PhoneNumber -> Maybe PhoneNumberType
type' :: Prelude.Maybe PhoneNumberType,
    -- | The phone number creation timestamp, in ISO 8601 format.
    PhoneNumber -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The phone number capabilities.
    PhoneNumber -> Maybe PhoneNumberCapabilities
capabilities :: Prelude.Maybe PhoneNumberCapabilities,
    -- | The outbound calling name status.
    PhoneNumber -> Maybe CallingNameStatus
callingNameStatus :: Prelude.Maybe CallingNameStatus
  }
  deriving (PhoneNumber -> PhoneNumber -> Bool
(PhoneNumber -> PhoneNumber -> Bool)
-> (PhoneNumber -> PhoneNumber -> Bool) -> Eq PhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumber -> PhoneNumber -> Bool
$c/= :: PhoneNumber -> PhoneNumber -> Bool
== :: PhoneNumber -> PhoneNumber -> Bool
$c== :: PhoneNumber -> PhoneNumber -> Bool
Prelude.Eq, Int -> PhoneNumber -> ShowS
[PhoneNumber] -> ShowS
PhoneNumber -> String
(Int -> PhoneNumber -> ShowS)
-> (PhoneNumber -> String)
-> ([PhoneNumber] -> ShowS)
-> Show PhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumber] -> ShowS
$cshowList :: [PhoneNumber] -> ShowS
show :: PhoneNumber -> String
$cshow :: PhoneNumber -> String
showsPrec :: Int -> PhoneNumber -> ShowS
$cshowsPrec :: Int -> PhoneNumber -> ShowS
Prelude.Show, (forall x. PhoneNumber -> Rep PhoneNumber x)
-> (forall x. Rep PhoneNumber x -> PhoneNumber)
-> Generic PhoneNumber
forall x. Rep PhoneNumber x -> PhoneNumber
forall x. PhoneNumber -> Rep PhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumber x -> PhoneNumber
$cfrom :: forall x. PhoneNumber -> Rep PhoneNumber x
Prelude.Generic)

-- |
-- Create a value of 'PhoneNumber' 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:
--
-- 'status', 'phoneNumber_status' - The phone number status.
--
-- 'deletionTimestamp', 'phoneNumber_deletionTimestamp' - The deleted phone number timestamp, in ISO 8601 format.
--
-- 'phoneNumberId', 'phoneNumber_phoneNumberId' - The phone number ID.
--
-- 'country', 'phoneNumber_country' - The phone number country. Format: ISO 3166-1 alpha-2.
--
-- 'updatedTimestamp', 'phoneNumber_updatedTimestamp' - The updated phone number timestamp, in ISO 8601 format.
--
-- 'productType', 'phoneNumber_productType' - The phone number product type.
--
-- 'e164PhoneNumber', 'phoneNumber_e164PhoneNumber' - The phone number, in E.164 format.
--
-- 'associations', 'phoneNumber_associations' - The phone number associations.
--
-- 'callingName', 'phoneNumber_callingName' - The outbound calling name associated with the phone number.
--
-- 'type'', 'phoneNumber_type' - The phone number type.
--
-- 'createdTimestamp', 'phoneNumber_createdTimestamp' - The phone number creation timestamp, in ISO 8601 format.
--
-- 'capabilities', 'phoneNumber_capabilities' - The phone number capabilities.
--
-- 'callingNameStatus', 'phoneNumber_callingNameStatus' - The outbound calling name status.
newPhoneNumber ::
  PhoneNumber
newPhoneNumber :: PhoneNumber
newPhoneNumber =
  PhoneNumber' :: Maybe PhoneNumberStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe PhoneNumberProductType
-> Maybe (Sensitive Text)
-> Maybe [PhoneNumberAssociation]
-> Maybe (Sensitive Text)
-> Maybe PhoneNumberType
-> Maybe POSIX
-> Maybe PhoneNumberCapabilities
-> Maybe CallingNameStatus
-> PhoneNumber
PhoneNumber'
    { $sel:status:PhoneNumber' :: Maybe PhoneNumberStatus
status = Maybe PhoneNumberStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:deletionTimestamp:PhoneNumber' :: Maybe POSIX
deletionTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberId:PhoneNumber' :: Maybe Text
phoneNumberId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:country:PhoneNumber' :: Maybe Text
country = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedTimestamp:PhoneNumber' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:productType:PhoneNumber' :: Maybe PhoneNumberProductType
productType = Maybe PhoneNumberProductType
forall a. Maybe a
Prelude.Nothing,
      $sel:e164PhoneNumber:PhoneNumber' :: Maybe (Sensitive Text)
e164PhoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:associations:PhoneNumber' :: Maybe [PhoneNumberAssociation]
associations = Maybe [PhoneNumberAssociation]
forall a. Maybe a
Prelude.Nothing,
      $sel:callingName:PhoneNumber' :: Maybe (Sensitive Text)
callingName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:type':PhoneNumber' :: Maybe PhoneNumberType
type' = Maybe PhoneNumberType
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:PhoneNumber' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:capabilities:PhoneNumber' :: Maybe PhoneNumberCapabilities
capabilities = Maybe PhoneNumberCapabilities
forall a. Maybe a
Prelude.Nothing,
      $sel:callingNameStatus:PhoneNumber' :: Maybe CallingNameStatus
callingNameStatus = Maybe CallingNameStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The phone number status.
phoneNumber_status :: Lens.Lens' PhoneNumber (Prelude.Maybe PhoneNumberStatus)
phoneNumber_status :: (Maybe PhoneNumberStatus -> f (Maybe PhoneNumberStatus))
-> PhoneNumber -> f PhoneNumber
phoneNumber_status = (PhoneNumber -> Maybe PhoneNumberStatus)
-> (PhoneNumber -> Maybe PhoneNumberStatus -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe PhoneNumberStatus)
     (Maybe PhoneNumberStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe PhoneNumberStatus
status :: Maybe PhoneNumberStatus
$sel:status:PhoneNumber' :: PhoneNumber -> Maybe PhoneNumberStatus
status} -> Maybe PhoneNumberStatus
status) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe PhoneNumberStatus
a -> PhoneNumber
s {$sel:status:PhoneNumber' :: Maybe PhoneNumberStatus
status = Maybe PhoneNumberStatus
a} :: PhoneNumber)

-- | The deleted phone number timestamp, in ISO 8601 format.
phoneNumber_deletionTimestamp :: Lens.Lens' PhoneNumber (Prelude.Maybe Prelude.UTCTime)
phoneNumber_deletionTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumber -> f PhoneNumber
phoneNumber_deletionTimestamp = (PhoneNumber -> Maybe POSIX)
-> (PhoneNumber -> Maybe POSIX -> PhoneNumber)
-> Lens PhoneNumber PhoneNumber (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe POSIX
deletionTimestamp :: Maybe POSIX
$sel:deletionTimestamp:PhoneNumber' :: PhoneNumber -> Maybe POSIX
deletionTimestamp} -> Maybe POSIX
deletionTimestamp) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe POSIX
a -> PhoneNumber
s {$sel:deletionTimestamp:PhoneNumber' :: Maybe POSIX
deletionTimestamp = Maybe POSIX
a} :: PhoneNumber) ((Maybe POSIX -> f (Maybe POSIX)) -> PhoneNumber -> f PhoneNumber)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumber
-> f PhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

-- | The phone number country. Format: ISO 3166-1 alpha-2.
phoneNumber_country :: Lens.Lens' PhoneNumber (Prelude.Maybe Prelude.Text)
phoneNumber_country :: (Maybe Text -> f (Maybe Text)) -> PhoneNumber -> f PhoneNumber
phoneNumber_country = (PhoneNumber -> Maybe Text)
-> (PhoneNumber -> Maybe Text -> PhoneNumber)
-> Lens PhoneNumber PhoneNumber (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe Text
country :: Maybe Text
$sel:country:PhoneNumber' :: PhoneNumber -> Maybe Text
country} -> Maybe Text
country) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe Text
a -> PhoneNumber
s {$sel:country:PhoneNumber' :: Maybe Text
country = Maybe Text
a} :: PhoneNumber)

-- | The updated phone number timestamp, in ISO 8601 format.
phoneNumber_updatedTimestamp :: Lens.Lens' PhoneNumber (Prelude.Maybe Prelude.UTCTime)
phoneNumber_updatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumber -> f PhoneNumber
phoneNumber_updatedTimestamp = (PhoneNumber -> Maybe POSIX)
-> (PhoneNumber -> Maybe POSIX -> PhoneNumber)
-> Lens PhoneNumber PhoneNumber (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe POSIX
updatedTimestamp :: Maybe POSIX
$sel:updatedTimestamp:PhoneNumber' :: PhoneNumber -> Maybe POSIX
updatedTimestamp} -> Maybe POSIX
updatedTimestamp) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe POSIX
a -> PhoneNumber
s {$sel:updatedTimestamp:PhoneNumber' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
a} :: PhoneNumber) ((Maybe POSIX -> f (Maybe POSIX)) -> PhoneNumber -> f PhoneNumber)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumber
-> f PhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The phone number product type.
phoneNumber_productType :: Lens.Lens' PhoneNumber (Prelude.Maybe PhoneNumberProductType)
phoneNumber_productType :: (Maybe PhoneNumberProductType -> f (Maybe PhoneNumberProductType))
-> PhoneNumber -> f PhoneNumber
phoneNumber_productType = (PhoneNumber -> Maybe PhoneNumberProductType)
-> (PhoneNumber -> Maybe PhoneNumberProductType -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe PhoneNumberProductType)
     (Maybe PhoneNumberProductType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe PhoneNumberProductType
productType :: Maybe PhoneNumberProductType
$sel:productType:PhoneNumber' :: PhoneNumber -> Maybe PhoneNumberProductType
productType} -> Maybe PhoneNumberProductType
productType) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe PhoneNumberProductType
a -> PhoneNumber
s {$sel:productType:PhoneNumber' :: Maybe PhoneNumberProductType
productType = Maybe PhoneNumberProductType
a} :: PhoneNumber)

-- | The phone number, in E.164 format.
phoneNumber_e164PhoneNumber :: Lens.Lens' PhoneNumber (Prelude.Maybe Prelude.Text)
phoneNumber_e164PhoneNumber :: (Maybe Text -> f (Maybe Text)) -> PhoneNumber -> f PhoneNumber
phoneNumber_e164PhoneNumber = (PhoneNumber -> Maybe (Sensitive Text))
-> (PhoneNumber -> Maybe (Sensitive Text) -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe (Sensitive Text)
e164PhoneNumber :: Maybe (Sensitive Text)
$sel:e164PhoneNumber:PhoneNumber' :: PhoneNumber -> Maybe (Sensitive Text)
e164PhoneNumber} -> Maybe (Sensitive Text)
e164PhoneNumber) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe (Sensitive Text)
a -> PhoneNumber
s {$sel:e164PhoneNumber:PhoneNumber' :: Maybe (Sensitive Text)
e164PhoneNumber = Maybe (Sensitive Text)
a} :: PhoneNumber) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> PhoneNumber -> f PhoneNumber)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> PhoneNumber
-> f PhoneNumber
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 phone number associations.
phoneNumber_associations :: Lens.Lens' PhoneNumber (Prelude.Maybe [PhoneNumberAssociation])
phoneNumber_associations :: (Maybe [PhoneNumberAssociation]
 -> f (Maybe [PhoneNumberAssociation]))
-> PhoneNumber -> f PhoneNumber
phoneNumber_associations = (PhoneNumber -> Maybe [PhoneNumberAssociation])
-> (PhoneNumber -> Maybe [PhoneNumberAssociation] -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe [PhoneNumberAssociation])
     (Maybe [PhoneNumberAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe [PhoneNumberAssociation]
associations :: Maybe [PhoneNumberAssociation]
$sel:associations:PhoneNumber' :: PhoneNumber -> Maybe [PhoneNumberAssociation]
associations} -> Maybe [PhoneNumberAssociation]
associations) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe [PhoneNumberAssociation]
a -> PhoneNumber
s {$sel:associations:PhoneNumber' :: Maybe [PhoneNumberAssociation]
associations = Maybe [PhoneNumberAssociation]
a} :: PhoneNumber) ((Maybe [PhoneNumberAssociation]
  -> f (Maybe [PhoneNumberAssociation]))
 -> PhoneNumber -> f PhoneNumber)
-> ((Maybe [PhoneNumberAssociation]
     -> f (Maybe [PhoneNumberAssociation]))
    -> Maybe [PhoneNumberAssociation]
    -> f (Maybe [PhoneNumberAssociation]))
-> (Maybe [PhoneNumberAssociation]
    -> f (Maybe [PhoneNumberAssociation]))
-> PhoneNumber
-> f PhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PhoneNumberAssociation]
  [PhoneNumberAssociation]
  [PhoneNumberAssociation]
  [PhoneNumberAssociation]
-> Iso
     (Maybe [PhoneNumberAssociation])
     (Maybe [PhoneNumberAssociation])
     (Maybe [PhoneNumberAssociation])
     (Maybe [PhoneNumberAssociation])
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
  [PhoneNumberAssociation]
  [PhoneNumberAssociation]
  [PhoneNumberAssociation]
  [PhoneNumberAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The outbound calling name associated with the phone number.
phoneNumber_callingName :: Lens.Lens' PhoneNumber (Prelude.Maybe Prelude.Text)
phoneNumber_callingName :: (Maybe Text -> f (Maybe Text)) -> PhoneNumber -> f PhoneNumber
phoneNumber_callingName = (PhoneNumber -> Maybe (Sensitive Text))
-> (PhoneNumber -> Maybe (Sensitive Text) -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe (Sensitive Text)
callingName :: Maybe (Sensitive Text)
$sel:callingName:PhoneNumber' :: PhoneNumber -> Maybe (Sensitive Text)
callingName} -> Maybe (Sensitive Text)
callingName) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe (Sensitive Text)
a -> PhoneNumber
s {$sel:callingName:PhoneNumber' :: Maybe (Sensitive Text)
callingName = Maybe (Sensitive Text)
a} :: PhoneNumber) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> PhoneNumber -> f PhoneNumber)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> PhoneNumber
-> f PhoneNumber
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 phone number type.
phoneNumber_type :: Lens.Lens' PhoneNumber (Prelude.Maybe PhoneNumberType)
phoneNumber_type :: (Maybe PhoneNumberType -> f (Maybe PhoneNumberType))
-> PhoneNumber -> f PhoneNumber
phoneNumber_type = (PhoneNumber -> Maybe PhoneNumberType)
-> (PhoneNumber -> Maybe PhoneNumberType -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe PhoneNumberType)
     (Maybe PhoneNumberType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe PhoneNumberType
type' :: Maybe PhoneNumberType
$sel:type':PhoneNumber' :: PhoneNumber -> Maybe PhoneNumberType
type'} -> Maybe PhoneNumberType
type') (\s :: PhoneNumber
s@PhoneNumber' {} Maybe PhoneNumberType
a -> PhoneNumber
s {$sel:type':PhoneNumber' :: Maybe PhoneNumberType
type' = Maybe PhoneNumberType
a} :: PhoneNumber)

-- | The phone number creation timestamp, in ISO 8601 format.
phoneNumber_createdTimestamp :: Lens.Lens' PhoneNumber (Prelude.Maybe Prelude.UTCTime)
phoneNumber_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumber -> f PhoneNumber
phoneNumber_createdTimestamp = (PhoneNumber -> Maybe POSIX)
-> (PhoneNumber -> Maybe POSIX -> PhoneNumber)
-> Lens PhoneNumber PhoneNumber (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:PhoneNumber' :: PhoneNumber -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe POSIX
a -> PhoneNumber
s {$sel:createdTimestamp:PhoneNumber' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: PhoneNumber) ((Maybe POSIX -> f (Maybe POSIX)) -> PhoneNumber -> f PhoneNumber)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumber
-> f PhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The phone number capabilities.
phoneNumber_capabilities :: Lens.Lens' PhoneNumber (Prelude.Maybe PhoneNumberCapabilities)
phoneNumber_capabilities :: (Maybe PhoneNumberCapabilities
 -> f (Maybe PhoneNumberCapabilities))
-> PhoneNumber -> f PhoneNumber
phoneNumber_capabilities = (PhoneNumber -> Maybe PhoneNumberCapabilities)
-> (PhoneNumber -> Maybe PhoneNumberCapabilities -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe PhoneNumberCapabilities)
     (Maybe PhoneNumberCapabilities)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe PhoneNumberCapabilities
capabilities :: Maybe PhoneNumberCapabilities
$sel:capabilities:PhoneNumber' :: PhoneNumber -> Maybe PhoneNumberCapabilities
capabilities} -> Maybe PhoneNumberCapabilities
capabilities) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe PhoneNumberCapabilities
a -> PhoneNumber
s {$sel:capabilities:PhoneNumber' :: Maybe PhoneNumberCapabilities
capabilities = Maybe PhoneNumberCapabilities
a} :: PhoneNumber)

-- | The outbound calling name status.
phoneNumber_callingNameStatus :: Lens.Lens' PhoneNumber (Prelude.Maybe CallingNameStatus)
phoneNumber_callingNameStatus :: (Maybe CallingNameStatus -> f (Maybe CallingNameStatus))
-> PhoneNumber -> f PhoneNumber
phoneNumber_callingNameStatus = (PhoneNumber -> Maybe CallingNameStatus)
-> (PhoneNumber -> Maybe CallingNameStatus -> PhoneNumber)
-> Lens
     PhoneNumber
     PhoneNumber
     (Maybe CallingNameStatus)
     (Maybe CallingNameStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Maybe CallingNameStatus
callingNameStatus :: Maybe CallingNameStatus
$sel:callingNameStatus:PhoneNumber' :: PhoneNumber -> Maybe CallingNameStatus
callingNameStatus} -> Maybe CallingNameStatus
callingNameStatus) (\s :: PhoneNumber
s@PhoneNumber' {} Maybe CallingNameStatus
a -> PhoneNumber
s {$sel:callingNameStatus:PhoneNumber' :: Maybe CallingNameStatus
callingNameStatus = Maybe CallingNameStatus
a} :: PhoneNumber)

instance Core.FromJSON PhoneNumber where
  parseJSON :: Value -> Parser PhoneNumber
parseJSON =
    String
-> (Object -> Parser PhoneNumber) -> Value -> Parser PhoneNumber
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PhoneNumber"
      ( \Object
x ->
          Maybe PhoneNumberStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe PhoneNumberProductType
-> Maybe (Sensitive Text)
-> Maybe [PhoneNumberAssociation]
-> Maybe (Sensitive Text)
-> Maybe PhoneNumberType
-> Maybe POSIX
-> Maybe PhoneNumberCapabilities
-> Maybe CallingNameStatus
-> PhoneNumber
PhoneNumber'
            (Maybe PhoneNumberStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe PhoneNumberProductType
 -> Maybe (Sensitive Text)
 -> Maybe [PhoneNumberAssociation]
 -> Maybe (Sensitive Text)
 -> Maybe PhoneNumberType
 -> Maybe POSIX
 -> Maybe PhoneNumberCapabilities
 -> Maybe CallingNameStatus
 -> PhoneNumber)
-> Parser (Maybe PhoneNumberStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe PhoneNumberProductType
      -> Maybe (Sensitive Text)
      -> Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PhoneNumberStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe PhoneNumberProductType
   -> Maybe (Sensitive Text)
   -> Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe PhoneNumberProductType
      -> Maybe (Sensitive Text)
      -> Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeletionTimestamp")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe PhoneNumberProductType
   -> Maybe (Sensitive Text)
   -> Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe PhoneNumberProductType
      -> Maybe (Sensitive Text)
      -> Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
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
"PhoneNumberId")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe PhoneNumberProductType
   -> Maybe (Sensitive Text)
   -> Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe PhoneNumberProductType
      -> Maybe (Sensitive Text)
      -> Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
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
"Country")
            Parser
  (Maybe POSIX
   -> Maybe PhoneNumberProductType
   -> Maybe (Sensitive Text)
   -> Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe PhoneNumberProductType
      -> Maybe (Sensitive Text)
      -> Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedTimestamp")
            Parser
  (Maybe PhoneNumberProductType
   -> Maybe (Sensitive Text)
   -> Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe PhoneNumberProductType)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PhoneNumberProductType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProductType")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe [PhoneNumberAssociation]
      -> Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
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
"E164PhoneNumber")
            Parser
  (Maybe [PhoneNumberAssociation]
   -> Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe [PhoneNumberAssociation])
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [PhoneNumberAssociation]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Associations" Parser (Maybe (Maybe [PhoneNumberAssociation]))
-> Maybe [PhoneNumberAssociation]
-> Parser (Maybe [PhoneNumberAssociation])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PhoneNumberAssociation]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe (Sensitive Text)
   -> Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe PhoneNumberType
      -> Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
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
"CallingName")
            Parser
  (Maybe PhoneNumberType
   -> Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe PhoneNumberType)
-> Parser
     (Maybe POSIX
      -> Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus
      -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => 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
"Type")
            Parser
  (Maybe POSIX
   -> Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus
   -> PhoneNumber)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe PhoneNumberCapabilities
      -> Maybe CallingNameStatus -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTimestamp")
            Parser
  (Maybe PhoneNumberCapabilities
   -> Maybe CallingNameStatus -> PhoneNumber)
-> Parser (Maybe PhoneNumberCapabilities)
-> Parser (Maybe CallingNameStatus -> PhoneNumber)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PhoneNumberCapabilities)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Capabilities")
            Parser (Maybe CallingNameStatus -> PhoneNumber)
-> Parser (Maybe CallingNameStatus) -> Parser PhoneNumber
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CallingNameStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CallingNameStatus")
      )

instance Prelude.Hashable PhoneNumber

instance Prelude.NFData PhoneNumber