{-# 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.UserPhoneConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Connect.Types.UserPhoneConfig where

import Amazonka.Connect.Types.PhoneType
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the phone configuration settings for a user.
--
-- /See:/ 'newUserPhoneConfig' smart constructor.
data UserPhoneConfig = UserPhoneConfig'
  { -- | The After Call Work (ACW) timeout setting, in seconds.
    --
    -- When returned by a @SearchUsers@ call, @AfterContactWorkTimeLimit@ is
    -- returned in milliseconds.
    UserPhoneConfig -> Maybe Natural
afterContactWorkTimeLimit :: Prelude.Maybe Prelude.Natural,
    -- | The Auto accept setting.
    UserPhoneConfig -> Maybe Bool
autoAccept :: Prelude.Maybe Prelude.Bool,
    -- | The phone number for the user\'s desk phone.
    UserPhoneConfig -> Maybe Text
deskPhoneNumber :: Prelude.Maybe Prelude.Text,
    -- | The phone type.
    UserPhoneConfig -> PhoneType
phoneType :: PhoneType
  }
  deriving (UserPhoneConfig -> UserPhoneConfig -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'UserPhoneConfig' 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:
--
-- 'afterContactWorkTimeLimit', 'userPhoneConfig_afterContactWorkTimeLimit' - The After Call Work (ACW) timeout setting, in seconds.
--
-- When returned by a @SearchUsers@ call, @AfterContactWorkTimeLimit@ is
-- returned in milliseconds.
--
-- 'autoAccept', 'userPhoneConfig_autoAccept' - The Auto accept setting.
--
-- 'deskPhoneNumber', 'userPhoneConfig_deskPhoneNumber' - The phone number for the user\'s desk phone.
--
-- 'phoneType', 'userPhoneConfig_phoneType' - The phone type.
newUserPhoneConfig ::
  -- | 'phoneType'
  PhoneType ->
  UserPhoneConfig
newUserPhoneConfig :: PhoneType -> UserPhoneConfig
newUserPhoneConfig PhoneType
pPhoneType_ =
  UserPhoneConfig'
    { $sel:afterContactWorkTimeLimit:UserPhoneConfig' :: Maybe Natural
afterContactWorkTimeLimit =
        forall a. Maybe a
Prelude.Nothing,
      $sel:autoAccept:UserPhoneConfig' :: Maybe Bool
autoAccept = forall a. Maybe a
Prelude.Nothing,
      $sel:deskPhoneNumber:UserPhoneConfig' :: Maybe Text
deskPhoneNumber = forall a. Maybe a
Prelude.Nothing,
      $sel:phoneType:UserPhoneConfig' :: PhoneType
phoneType = PhoneType
pPhoneType_
    }

-- | The After Call Work (ACW) timeout setting, in seconds.
--
-- When returned by a @SearchUsers@ call, @AfterContactWorkTimeLimit@ is
-- returned in milliseconds.
userPhoneConfig_afterContactWorkTimeLimit :: Lens.Lens' UserPhoneConfig (Prelude.Maybe Prelude.Natural)
userPhoneConfig_afterContactWorkTimeLimit :: Lens' UserPhoneConfig (Maybe Natural)
userPhoneConfig_afterContactWorkTimeLimit = 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)

-- | The Auto accept setting.
userPhoneConfig_autoAccept :: Lens.Lens' UserPhoneConfig (Prelude.Maybe Prelude.Bool)
userPhoneConfig_autoAccept :: Lens' UserPhoneConfig (Maybe Bool)
userPhoneConfig_autoAccept = 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)

-- | The phone number for the user\'s desk phone.
userPhoneConfig_deskPhoneNumber :: Lens.Lens' UserPhoneConfig (Prelude.Maybe Prelude.Text)
userPhoneConfig_deskPhoneNumber :: Lens' UserPhoneConfig (Maybe Text)
userPhoneConfig_deskPhoneNumber = 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)

-- | The phone type.
userPhoneConfig_phoneType :: Lens.Lens' UserPhoneConfig PhoneType
userPhoneConfig_phoneType :: Lens' UserPhoneConfig PhoneType
userPhoneConfig_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 Data.FromJSON UserPhoneConfig where
  parseJSON :: Value -> Parser UserPhoneConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UserPhoneConfig"
      ( \Object
x ->
          Maybe Natural
-> Maybe Bool -> Maybe Text -> PhoneType -> UserPhoneConfig
UserPhoneConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AfterContactWorkTimeLimit")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AutoAccept")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeskPhoneNumber")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"PhoneType")
      )

instance Prelude.Hashable UserPhoneConfig where
  hashWithSalt :: Int -> UserPhoneConfig -> Int
hashWithSalt Int
_salt UserPhoneConfig' {Maybe Bool
Maybe Natural
Maybe Text
PhoneType
phoneType :: PhoneType
deskPhoneNumber :: Maybe Text
autoAccept :: Maybe Bool
afterContactWorkTimeLimit :: Maybe Natural
$sel:phoneType:UserPhoneConfig' :: UserPhoneConfig -> PhoneType
$sel:deskPhoneNumber:UserPhoneConfig' :: UserPhoneConfig -> Maybe Text
$sel:autoAccept:UserPhoneConfig' :: UserPhoneConfig -> Maybe Bool
$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: UserPhoneConfig -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
afterContactWorkTimeLimit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
autoAccept
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deskPhoneNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PhoneType
phoneType

instance Prelude.NFData UserPhoneConfig where
  rnf :: UserPhoneConfig -> ()
rnf UserPhoneConfig' {Maybe Bool
Maybe Natural
Maybe Text
PhoneType
phoneType :: PhoneType
deskPhoneNumber :: Maybe Text
autoAccept :: Maybe Bool
afterContactWorkTimeLimit :: Maybe Natural
$sel:phoneType:UserPhoneConfig' :: UserPhoneConfig -> PhoneType
$sel:deskPhoneNumber:UserPhoneConfig' :: UserPhoneConfig -> Maybe Text
$sel:autoAccept:UserPhoneConfig' :: UserPhoneConfig -> Maybe Bool
$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: UserPhoneConfig -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
afterContactWorkTimeLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
autoAccept
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deskPhoneNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PhoneType
phoneType

instance Data.ToJSON UserPhoneConfig where
  toJSON :: UserPhoneConfig -> Value
toJSON UserPhoneConfig' {Maybe Bool
Maybe Natural
Maybe Text
PhoneType
phoneType :: PhoneType
deskPhoneNumber :: Maybe Text
autoAccept :: Maybe Bool
afterContactWorkTimeLimit :: Maybe Natural
$sel:phoneType:UserPhoneConfig' :: UserPhoneConfig -> PhoneType
$sel:deskPhoneNumber:UserPhoneConfig' :: UserPhoneConfig -> Maybe Text
$sel:autoAccept:UserPhoneConfig' :: UserPhoneConfig -> Maybe Bool
$sel:afterContactWorkTimeLimit:UserPhoneConfig' :: UserPhoneConfig -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AfterContactWorkTimeLimit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
afterContactWorkTimeLimit,
            (Key
"AutoAccept" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
autoAccept,
            (Key
"DeskPhoneNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deskPhoneNumber,
            forall a. a -> Maybe a
Prelude.Just (Key
"PhoneType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PhoneType
phoneType)
          ]
      )