{-# 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.Connect.Types.UserPhoneConfig where
import Amazonka.Connect.Types.PhoneType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UserPhoneConfig = UserPhoneConfig'
{
UserPhoneConfig -> Maybe Bool
autoAccept :: Prelude.Maybe Prelude.Bool,
UserPhoneConfig -> Maybe Natural
afterContactWorkTimeLimit :: Prelude.Maybe Prelude.Natural,
UserPhoneConfig -> Maybe Text
deskPhoneNumber :: Prelude.Maybe Prelude.Text,
UserPhoneConfig -> PhoneType
phoneType :: PhoneType
}
deriving (UserPhoneConfig -> UserPhoneConfig -> Bool
(UserPhoneConfig -> UserPhoneConfig -> Bool)
-> (UserPhoneConfig -> UserPhoneConfig -> Bool)
-> Eq UserPhoneConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserPhoneConfig -> UserPhoneConfig -> Bool
$c/= :: UserPhoneConfig -> UserPhoneConfig -> Bool
== :: UserPhoneConfig -> UserPhoneConfig -> Bool
$c== :: UserPhoneConfig -> UserPhoneConfig -> Bool
Prelude.Eq, ReadPrec [UserPhoneConfig]
ReadPrec UserPhoneConfig
Int -> ReadS UserPhoneConfig
ReadS [UserPhoneConfig]
(Int -> ReadS UserPhoneConfig)
-> ReadS [UserPhoneConfig]
-> ReadPrec UserPhoneConfig
-> ReadPrec [UserPhoneConfig]
-> Read UserPhoneConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserPhoneConfig]
$creadListPrec :: ReadPrec [UserPhoneConfig]
readPrec :: ReadPrec UserPhoneConfig
$creadPrec :: ReadPrec UserPhoneConfig
readList :: ReadS [UserPhoneConfig]
$creadList :: ReadS [UserPhoneConfig]
readsPrec :: Int -> ReadS UserPhoneConfig
$creadsPrec :: Int -> ReadS UserPhoneConfig
Prelude.Read, Int -> UserPhoneConfig -> ShowS
[UserPhoneConfig] -> ShowS
UserPhoneConfig -> String
(Int -> UserPhoneConfig -> ShowS)
-> (UserPhoneConfig -> String)
-> ([UserPhoneConfig] -> ShowS)
-> Show UserPhoneConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserPhoneConfig] -> ShowS
$cshowList :: [UserPhoneConfig] -> ShowS
show :: UserPhoneConfig -> String
$cshow :: UserPhoneConfig -> String
showsPrec :: Int -> UserPhoneConfig -> ShowS
$cshowsPrec :: Int -> UserPhoneConfig -> ShowS
Prelude.Show, (forall x. UserPhoneConfig -> Rep UserPhoneConfig x)
-> (forall x. Rep UserPhoneConfig x -> UserPhoneConfig)
-> Generic UserPhoneConfig
forall x. Rep UserPhoneConfig x -> UserPhoneConfig
forall x. UserPhoneConfig -> Rep UserPhoneConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserPhoneConfig x -> UserPhoneConfig
$cfrom :: forall x. UserPhoneConfig -> Rep UserPhoneConfig x
Prelude.Generic)
newUserPhoneConfig ::
PhoneType ->
UserPhoneConfig
newUserPhoneConfig :: PhoneType -> UserPhoneConfig
newUserPhoneConfig PhoneType
pPhoneType_ =
UserPhoneConfig' :: Maybe Bool
-> Maybe Natural -> Maybe Text -> PhoneType -> UserPhoneConfig
UserPhoneConfig'
{ $sel:autoAccept:UserPhoneConfig' :: Maybe Bool
autoAccept = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: Maybe Natural
afterContactWorkTimeLimit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:deskPhoneNumber:UserPhoneConfig' :: Maybe Text
deskPhoneNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:phoneType:UserPhoneConfig' :: PhoneType
phoneType = PhoneType
pPhoneType_
}
userPhoneConfig_autoAccept :: Lens.Lens' UserPhoneConfig (Prelude.Maybe Prelude.Bool)
userPhoneConfig_autoAccept :: (Maybe Bool -> f (Maybe Bool))
-> UserPhoneConfig -> f UserPhoneConfig
userPhoneConfig_autoAccept = (UserPhoneConfig -> Maybe Bool)
-> (UserPhoneConfig -> Maybe Bool -> UserPhoneConfig)
-> Lens UserPhoneConfig UserPhoneConfig (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPhoneConfig' {Maybe Bool
autoAccept :: Maybe Bool
$sel:autoAccept:UserPhoneConfig' :: UserPhoneConfig -> Maybe Bool
autoAccept} -> Maybe Bool
autoAccept) (\s :: UserPhoneConfig
s@UserPhoneConfig' {} Maybe Bool
a -> UserPhoneConfig
s {$sel:autoAccept:UserPhoneConfig' :: Maybe Bool
autoAccept = Maybe Bool
a} :: UserPhoneConfig)
userPhoneConfig_afterContactWorkTimeLimit :: Lens.Lens' UserPhoneConfig (Prelude.Maybe Prelude.Natural)
userPhoneConfig_afterContactWorkTimeLimit :: (Maybe Natural -> f (Maybe Natural))
-> UserPhoneConfig -> f UserPhoneConfig
userPhoneConfig_afterContactWorkTimeLimit = (UserPhoneConfig -> Maybe Natural)
-> (UserPhoneConfig -> Maybe Natural -> UserPhoneConfig)
-> Lens
UserPhoneConfig UserPhoneConfig (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPhoneConfig' {Maybe Natural
afterContactWorkTimeLimit :: Maybe Natural
$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: UserPhoneConfig -> Maybe Natural
afterContactWorkTimeLimit} -> Maybe Natural
afterContactWorkTimeLimit) (\s :: UserPhoneConfig
s@UserPhoneConfig' {} Maybe Natural
a -> UserPhoneConfig
s {$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: Maybe Natural
afterContactWorkTimeLimit = Maybe Natural
a} :: UserPhoneConfig)
userPhoneConfig_deskPhoneNumber :: Lens.Lens' UserPhoneConfig (Prelude.Maybe Prelude.Text)
userPhoneConfig_deskPhoneNumber :: (Maybe Text -> f (Maybe Text))
-> UserPhoneConfig -> f UserPhoneConfig
userPhoneConfig_deskPhoneNumber = (UserPhoneConfig -> Maybe Text)
-> (UserPhoneConfig -> Maybe Text -> UserPhoneConfig)
-> Lens UserPhoneConfig UserPhoneConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPhoneConfig' {Maybe Text
deskPhoneNumber :: Maybe Text
$sel:deskPhoneNumber:UserPhoneConfig' :: UserPhoneConfig -> Maybe Text
deskPhoneNumber} -> Maybe Text
deskPhoneNumber) (\s :: UserPhoneConfig
s@UserPhoneConfig' {} Maybe Text
a -> UserPhoneConfig
s {$sel:deskPhoneNumber:UserPhoneConfig' :: Maybe Text
deskPhoneNumber = Maybe Text
a} :: UserPhoneConfig)
userPhoneConfig_phoneType :: Lens.Lens' UserPhoneConfig PhoneType
userPhoneConfig_phoneType :: (PhoneType -> f PhoneType) -> UserPhoneConfig -> f UserPhoneConfig
userPhoneConfig_phoneType = (UserPhoneConfig -> PhoneType)
-> (UserPhoneConfig -> PhoneType -> UserPhoneConfig)
-> Lens UserPhoneConfig UserPhoneConfig PhoneType PhoneType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPhoneConfig' {PhoneType
phoneType :: PhoneType
$sel:phoneType:UserPhoneConfig' :: UserPhoneConfig -> PhoneType
phoneType} -> PhoneType
phoneType) (\s :: UserPhoneConfig
s@UserPhoneConfig' {} PhoneType
a -> UserPhoneConfig
s {$sel:phoneType:UserPhoneConfig' :: PhoneType
phoneType = PhoneType
a} :: UserPhoneConfig)
instance Core.FromJSON UserPhoneConfig where
parseJSON :: Value -> Parser UserPhoneConfig
parseJSON =
String
-> (Object -> Parser UserPhoneConfig)
-> Value
-> Parser UserPhoneConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"UserPhoneConfig"
( \Object
x ->
Maybe Bool
-> Maybe Natural -> Maybe Text -> PhoneType -> UserPhoneConfig
UserPhoneConfig'
(Maybe Bool
-> Maybe Natural -> Maybe Text -> PhoneType -> UserPhoneConfig)
-> Parser (Maybe Bool)
-> Parser
(Maybe Natural -> Maybe Text -> PhoneType -> UserPhoneConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AutoAccept")
Parser
(Maybe Natural -> Maybe Text -> PhoneType -> UserPhoneConfig)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> PhoneType -> UserPhoneConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AfterContactWorkTimeLimit")
Parser (Maybe Text -> PhoneType -> UserPhoneConfig)
-> Parser (Maybe Text) -> Parser (PhoneType -> UserPhoneConfig)
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
"DeskPhoneNumber")
Parser (PhoneType -> UserPhoneConfig)
-> Parser PhoneType -> Parser UserPhoneConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PhoneType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PhoneType")
)
instance Prelude.Hashable UserPhoneConfig
instance Prelude.NFData UserPhoneConfig
instance Core.ToJSON UserPhoneConfig where
toJSON :: UserPhoneConfig -> Value
toJSON UserPhoneConfig' {Maybe Bool
Maybe Natural
Maybe Text
PhoneType
phoneType :: PhoneType
deskPhoneNumber :: Maybe Text
afterContactWorkTimeLimit :: Maybe Natural
autoAccept :: Maybe Bool
$sel:phoneType:UserPhoneConfig' :: UserPhoneConfig -> PhoneType
$sel:deskPhoneNumber:UserPhoneConfig' :: UserPhoneConfig -> Maybe Text
$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: UserPhoneConfig -> Maybe Natural
$sel:autoAccept:UserPhoneConfig' :: UserPhoneConfig -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AutoAccept" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
autoAccept,
(Text
"AfterContactWorkTimeLimit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
afterContactWorkTimeLimit,
(Text
"DeskPhoneNumber" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deskPhoneNumber,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PhoneType" Text -> PhoneType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PhoneType
phoneType)
]
)