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

import Amazonka.Connect.Types.ParticipantTimerType
import Amazonka.Connect.Types.ParticipantTimerValue
import Amazonka.Connect.Types.TimerEligibleParticipantRoles
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

-- | Configuration information for the timer. After the timer configuration
-- is set, it persists for the duration of the chat. It persists across new
-- contacts in the chain, for example, transfer contacts.
--
-- For more information about how chat timeouts work, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/setup-chat-timeouts.html Set up chat timeouts for human participants>.
--
-- /See:/ 'newParticipantTimerConfiguration' smart constructor.
data ParticipantTimerConfiguration = ParticipantTimerConfiguration'
  { -- | The role of the participant in the chat conversation.
    ParticipantTimerConfiguration -> TimerEligibleParticipantRoles
participantRole :: TimerEligibleParticipantRoles,
    -- | The type of timer. @IDLE@ indicates the timer applies for considering a
    -- human chat participant as idle. @DISCONNECT_NONCUSTOMER@ indicates the
    -- timer applies to automatically disconnecting a chat participant due to
    -- idleness.
    ParticipantTimerConfiguration -> ParticipantTimerType
timerType :: ParticipantTimerType,
    -- | The value of the timer. Either the timer action (Unset to delete the
    -- timer), or the duration of the timer in minutes. Only one value can be
    -- set.
    ParticipantTimerConfiguration -> ParticipantTimerValue
timerValue :: ParticipantTimerValue
  }
  deriving (ParticipantTimerConfiguration
-> ParticipantTimerConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParticipantTimerConfiguration
-> ParticipantTimerConfiguration -> Bool
$c/= :: ParticipantTimerConfiguration
-> ParticipantTimerConfiguration -> Bool
== :: ParticipantTimerConfiguration
-> ParticipantTimerConfiguration -> Bool
$c== :: ParticipantTimerConfiguration
-> ParticipantTimerConfiguration -> Bool
Prelude.Eq, ReadPrec [ParticipantTimerConfiguration]
ReadPrec ParticipantTimerConfiguration
Int -> ReadS ParticipantTimerConfiguration
ReadS [ParticipantTimerConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParticipantTimerConfiguration]
$creadListPrec :: ReadPrec [ParticipantTimerConfiguration]
readPrec :: ReadPrec ParticipantTimerConfiguration
$creadPrec :: ReadPrec ParticipantTimerConfiguration
readList :: ReadS [ParticipantTimerConfiguration]
$creadList :: ReadS [ParticipantTimerConfiguration]
readsPrec :: Int -> ReadS ParticipantTimerConfiguration
$creadsPrec :: Int -> ReadS ParticipantTimerConfiguration
Prelude.Read, Int -> ParticipantTimerConfiguration -> ShowS
[ParticipantTimerConfiguration] -> ShowS
ParticipantTimerConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParticipantTimerConfiguration] -> ShowS
$cshowList :: [ParticipantTimerConfiguration] -> ShowS
show :: ParticipantTimerConfiguration -> String
$cshow :: ParticipantTimerConfiguration -> String
showsPrec :: Int -> ParticipantTimerConfiguration -> ShowS
$cshowsPrec :: Int -> ParticipantTimerConfiguration -> ShowS
Prelude.Show, forall x.
Rep ParticipantTimerConfiguration x
-> ParticipantTimerConfiguration
forall x.
ParticipantTimerConfiguration
-> Rep ParticipantTimerConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ParticipantTimerConfiguration x
-> ParticipantTimerConfiguration
$cfrom :: forall x.
ParticipantTimerConfiguration
-> Rep ParticipantTimerConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ParticipantTimerConfiguration' 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:
--
-- 'participantRole', 'participantTimerConfiguration_participantRole' - The role of the participant in the chat conversation.
--
-- 'timerType', 'participantTimerConfiguration_timerType' - The type of timer. @IDLE@ indicates the timer applies for considering a
-- human chat participant as idle. @DISCONNECT_NONCUSTOMER@ indicates the
-- timer applies to automatically disconnecting a chat participant due to
-- idleness.
--
-- 'timerValue', 'participantTimerConfiguration_timerValue' - The value of the timer. Either the timer action (Unset to delete the
-- timer), or the duration of the timer in minutes. Only one value can be
-- set.
newParticipantTimerConfiguration ::
  -- | 'participantRole'
  TimerEligibleParticipantRoles ->
  -- | 'timerType'
  ParticipantTimerType ->
  -- | 'timerValue'
  ParticipantTimerValue ->
  ParticipantTimerConfiguration
newParticipantTimerConfiguration :: TimerEligibleParticipantRoles
-> ParticipantTimerType
-> ParticipantTimerValue
-> ParticipantTimerConfiguration
newParticipantTimerConfiguration
  TimerEligibleParticipantRoles
pParticipantRole_
  ParticipantTimerType
pTimerType_
  ParticipantTimerValue
pTimerValue_ =
    ParticipantTimerConfiguration'
      { $sel:participantRole:ParticipantTimerConfiguration' :: TimerEligibleParticipantRoles
participantRole =
          TimerEligibleParticipantRoles
pParticipantRole_,
        $sel:timerType:ParticipantTimerConfiguration' :: ParticipantTimerType
timerType = ParticipantTimerType
pTimerType_,
        $sel:timerValue:ParticipantTimerConfiguration' :: ParticipantTimerValue
timerValue = ParticipantTimerValue
pTimerValue_
      }

-- | The role of the participant in the chat conversation.
participantTimerConfiguration_participantRole :: Lens.Lens' ParticipantTimerConfiguration TimerEligibleParticipantRoles
participantTimerConfiguration_participantRole :: Lens' ParticipantTimerConfiguration TimerEligibleParticipantRoles
participantTimerConfiguration_participantRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipantTimerConfiguration' {TimerEligibleParticipantRoles
participantRole :: TimerEligibleParticipantRoles
$sel:participantRole:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> TimerEligibleParticipantRoles
participantRole} -> TimerEligibleParticipantRoles
participantRole) (\s :: ParticipantTimerConfiguration
s@ParticipantTimerConfiguration' {} TimerEligibleParticipantRoles
a -> ParticipantTimerConfiguration
s {$sel:participantRole:ParticipantTimerConfiguration' :: TimerEligibleParticipantRoles
participantRole = TimerEligibleParticipantRoles
a} :: ParticipantTimerConfiguration)

-- | The type of timer. @IDLE@ indicates the timer applies for considering a
-- human chat participant as idle. @DISCONNECT_NONCUSTOMER@ indicates the
-- timer applies to automatically disconnecting a chat participant due to
-- idleness.
participantTimerConfiguration_timerType :: Lens.Lens' ParticipantTimerConfiguration ParticipantTimerType
participantTimerConfiguration_timerType :: Lens' ParticipantTimerConfiguration ParticipantTimerType
participantTimerConfiguration_timerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipantTimerConfiguration' {ParticipantTimerType
timerType :: ParticipantTimerType
$sel:timerType:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerType
timerType} -> ParticipantTimerType
timerType) (\s :: ParticipantTimerConfiguration
s@ParticipantTimerConfiguration' {} ParticipantTimerType
a -> ParticipantTimerConfiguration
s {$sel:timerType:ParticipantTimerConfiguration' :: ParticipantTimerType
timerType = ParticipantTimerType
a} :: ParticipantTimerConfiguration)

-- | The value of the timer. Either the timer action (Unset to delete the
-- timer), or the duration of the timer in minutes. Only one value can be
-- set.
participantTimerConfiguration_timerValue :: Lens.Lens' ParticipantTimerConfiguration ParticipantTimerValue
participantTimerConfiguration_timerValue :: Lens' ParticipantTimerConfiguration ParticipantTimerValue
participantTimerConfiguration_timerValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipantTimerConfiguration' {ParticipantTimerValue
timerValue :: ParticipantTimerValue
$sel:timerValue:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerValue
timerValue} -> ParticipantTimerValue
timerValue) (\s :: ParticipantTimerConfiguration
s@ParticipantTimerConfiguration' {} ParticipantTimerValue
a -> ParticipantTimerConfiguration
s {$sel:timerValue:ParticipantTimerConfiguration' :: ParticipantTimerValue
timerValue = ParticipantTimerValue
a} :: ParticipantTimerConfiguration)

instance
  Prelude.Hashable
    ParticipantTimerConfiguration
  where
  hashWithSalt :: Int -> ParticipantTimerConfiguration -> Int
hashWithSalt Int
_salt ParticipantTimerConfiguration' {ParticipantTimerType
ParticipantTimerValue
TimerEligibleParticipantRoles
timerValue :: ParticipantTimerValue
timerType :: ParticipantTimerType
participantRole :: TimerEligibleParticipantRoles
$sel:timerValue:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerValue
$sel:timerType:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerType
$sel:participantRole:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> TimerEligibleParticipantRoles
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TimerEligibleParticipantRoles
participantRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ParticipantTimerType
timerType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ParticipantTimerValue
timerValue

instance Prelude.NFData ParticipantTimerConfiguration where
  rnf :: ParticipantTimerConfiguration -> ()
rnf ParticipantTimerConfiguration' {ParticipantTimerType
ParticipantTimerValue
TimerEligibleParticipantRoles
timerValue :: ParticipantTimerValue
timerType :: ParticipantTimerType
participantRole :: TimerEligibleParticipantRoles
$sel:timerValue:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerValue
$sel:timerType:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerType
$sel:participantRole:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> TimerEligibleParticipantRoles
..} =
    forall a. NFData a => a -> ()
Prelude.rnf TimerEligibleParticipantRoles
participantRole
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ParticipantTimerType
timerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ParticipantTimerValue
timerValue

instance Data.ToJSON ParticipantTimerConfiguration where
  toJSON :: ParticipantTimerConfiguration -> Value
toJSON ParticipantTimerConfiguration' {ParticipantTimerType
ParticipantTimerValue
TimerEligibleParticipantRoles
timerValue :: ParticipantTimerValue
timerType :: ParticipantTimerType
participantRole :: TimerEligibleParticipantRoles
$sel:timerValue:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerValue
$sel:timerType:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> ParticipantTimerType
$sel:participantRole:ParticipantTimerConfiguration' :: ParticipantTimerConfiguration -> TimerEligibleParticipantRoles
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ParticipantRole" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TimerEligibleParticipantRoles
participantRole),
            forall a. a -> Maybe a
Prelude.Just (Key
"TimerType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ParticipantTimerType
timerType),
            forall a. a -> Maybe a
Prelude.Just (Key
"TimerValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ParticipantTimerValue
timerValue)
          ]
      )