{-# 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 #-}
module Amazonka.AlexaBusiness.Types.PhoneNumber where
import Amazonka.AlexaBusiness.Types.PhoneNumberType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PhoneNumber = PhoneNumber'
{
PhoneNumber -> Sensitive Text
number :: Core.Sensitive Prelude.Text,
PhoneNumber -> Sensitive PhoneNumberType
type' :: Core.Sensitive PhoneNumberType
}
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)
newPhoneNumber ::
Prelude.Text ->
PhoneNumberType ->
PhoneNumber
newPhoneNumber :: Text -> PhoneNumberType -> PhoneNumber
newPhoneNumber Text
pNumber_ PhoneNumberType
pType_ =
PhoneNumber' :: Sensitive Text -> Sensitive PhoneNumberType -> PhoneNumber
PhoneNumber'
{ $sel:number:PhoneNumber' :: Sensitive Text
number =
Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pNumber_,
$sel:type':PhoneNumber' :: Sensitive PhoneNumberType
type' = Tagged PhoneNumberType (Identity PhoneNumberType)
-> Tagged
(Sensitive PhoneNumberType) (Identity (Sensitive PhoneNumberType))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged PhoneNumberType (Identity PhoneNumberType)
-> Tagged
(Sensitive PhoneNumberType) (Identity (Sensitive PhoneNumberType)))
-> PhoneNumberType -> Sensitive PhoneNumberType
forall t b. AReview t b -> b -> t
Lens.# PhoneNumberType
pType_
}
phoneNumber_number :: Lens.Lens' PhoneNumber Prelude.Text
phoneNumber_number :: (Text -> f Text) -> PhoneNumber -> f PhoneNumber
phoneNumber_number = (PhoneNumber -> Sensitive Text)
-> (PhoneNumber -> Sensitive Text -> PhoneNumber)
-> Lens PhoneNumber PhoneNumber (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Sensitive Text
number :: Sensitive Text
$sel:number:PhoneNumber' :: PhoneNumber -> Sensitive Text
number} -> Sensitive Text
number) (\s :: PhoneNumber
s@PhoneNumber' {} Sensitive Text
a -> PhoneNumber
s {$sel:number:PhoneNumber' :: Sensitive Text
number = Sensitive Text
a} :: PhoneNumber) ((Sensitive Text -> f (Sensitive Text))
-> PhoneNumber -> f PhoneNumber)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> PhoneNumber
-> f PhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
phoneNumber_type :: Lens.Lens' PhoneNumber PhoneNumberType
phoneNumber_type :: (PhoneNumberType -> f PhoneNumberType)
-> PhoneNumber -> f PhoneNumber
phoneNumber_type = (PhoneNumber -> Sensitive PhoneNumberType)
-> (PhoneNumber -> Sensitive PhoneNumberType -> PhoneNumber)
-> Lens
PhoneNumber
PhoneNumber
(Sensitive PhoneNumberType)
(Sensitive PhoneNumberType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumber' {Sensitive PhoneNumberType
type' :: Sensitive PhoneNumberType
$sel:type':PhoneNumber' :: PhoneNumber -> Sensitive PhoneNumberType
type'} -> Sensitive PhoneNumberType
type') (\s :: PhoneNumber
s@PhoneNumber' {} Sensitive PhoneNumberType
a -> PhoneNumber
s {$sel:type':PhoneNumber' :: Sensitive PhoneNumberType
type' = Sensitive PhoneNumberType
a} :: PhoneNumber) ((Sensitive PhoneNumberType -> f (Sensitive PhoneNumberType))
-> PhoneNumber -> f PhoneNumber)
-> ((PhoneNumberType -> f PhoneNumberType)
-> Sensitive PhoneNumberType -> f (Sensitive PhoneNumberType))
-> (PhoneNumberType -> f PhoneNumberType)
-> PhoneNumber
-> f PhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (PhoneNumberType -> f PhoneNumberType)
-> Sensitive PhoneNumberType -> f (Sensitive PhoneNumberType)
forall a. Iso' (Sensitive a) a
Core._Sensitive
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 ->
Sensitive Text -> Sensitive PhoneNumberType -> PhoneNumber
PhoneNumber'
(Sensitive Text -> Sensitive PhoneNumberType -> PhoneNumber)
-> Parser (Sensitive Text)
-> Parser (Sensitive PhoneNumberType -> PhoneNumber)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Number") Parser (Sensitive PhoneNumberType -> PhoneNumber)
-> Parser (Sensitive PhoneNumberType) -> Parser PhoneNumber
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive PhoneNumberType)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable PhoneNumber
instance Prelude.NFData PhoneNumber
instance Core.ToJSON PhoneNumber where
toJSON :: PhoneNumber -> Value
toJSON PhoneNumber' {Sensitive Text
Sensitive PhoneNumberType
type' :: Sensitive PhoneNumberType
number :: Sensitive Text
$sel:type':PhoneNumber' :: PhoneNumber -> Sensitive PhoneNumberType
$sel:number:PhoneNumber' :: PhoneNumber -> Sensitive Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Number" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
number),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> Sensitive PhoneNumberType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive PhoneNumberType
type')
]
)