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

import Amazonka.Connect.Types.ParticipantTimerAction
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

-- | 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.
--
-- 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:/ 'newParticipantTimerValue' smart constructor.
data ParticipantTimerValue = ParticipantTimerValue'
  { -- | The timer action. Currently only one value is allowed: @Unset@. It
    -- deletes a timer.
    ParticipantTimerValue -> Maybe ParticipantTimerAction
participantTimerAction :: Prelude.Maybe ParticipantTimerAction,
    -- | The duration of a timer, in minutes.
    ParticipantTimerValue -> Maybe Natural
participantTimerDurationInMinutes :: Prelude.Maybe Prelude.Natural
  }
  deriving (ParticipantTimerValue -> ParticipantTimerValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParticipantTimerValue -> ParticipantTimerValue -> Bool
$c/= :: ParticipantTimerValue -> ParticipantTimerValue -> Bool
== :: ParticipantTimerValue -> ParticipantTimerValue -> Bool
$c== :: ParticipantTimerValue -> ParticipantTimerValue -> Bool
Prelude.Eq, ReadPrec [ParticipantTimerValue]
ReadPrec ParticipantTimerValue
Int -> ReadS ParticipantTimerValue
ReadS [ParticipantTimerValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParticipantTimerValue]
$creadListPrec :: ReadPrec [ParticipantTimerValue]
readPrec :: ReadPrec ParticipantTimerValue
$creadPrec :: ReadPrec ParticipantTimerValue
readList :: ReadS [ParticipantTimerValue]
$creadList :: ReadS [ParticipantTimerValue]
readsPrec :: Int -> ReadS ParticipantTimerValue
$creadsPrec :: Int -> ReadS ParticipantTimerValue
Prelude.Read, Int -> ParticipantTimerValue -> ShowS
[ParticipantTimerValue] -> ShowS
ParticipantTimerValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParticipantTimerValue] -> ShowS
$cshowList :: [ParticipantTimerValue] -> ShowS
show :: ParticipantTimerValue -> String
$cshow :: ParticipantTimerValue -> String
showsPrec :: Int -> ParticipantTimerValue -> ShowS
$cshowsPrec :: Int -> ParticipantTimerValue -> ShowS
Prelude.Show, forall x. Rep ParticipantTimerValue x -> ParticipantTimerValue
forall x. ParticipantTimerValue -> Rep ParticipantTimerValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParticipantTimerValue x -> ParticipantTimerValue
$cfrom :: forall x. ParticipantTimerValue -> Rep ParticipantTimerValue x
Prelude.Generic)

-- |
-- Create a value of 'ParticipantTimerValue' 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:
--
-- 'participantTimerAction', 'participantTimerValue_participantTimerAction' - The timer action. Currently only one value is allowed: @Unset@. It
-- deletes a timer.
--
-- 'participantTimerDurationInMinutes', 'participantTimerValue_participantTimerDurationInMinutes' - The duration of a timer, in minutes.
newParticipantTimerValue ::
  ParticipantTimerValue
newParticipantTimerValue :: ParticipantTimerValue
newParticipantTimerValue =
  ParticipantTimerValue'
    { $sel:participantTimerAction:ParticipantTimerValue' :: Maybe ParticipantTimerAction
participantTimerAction =
        forall a. Maybe a
Prelude.Nothing,
      $sel:participantTimerDurationInMinutes:ParticipantTimerValue' :: Maybe Natural
participantTimerDurationInMinutes = forall a. Maybe a
Prelude.Nothing
    }

-- | The timer action. Currently only one value is allowed: @Unset@. It
-- deletes a timer.
participantTimerValue_participantTimerAction :: Lens.Lens' ParticipantTimerValue (Prelude.Maybe ParticipantTimerAction)
participantTimerValue_participantTimerAction :: Lens' ParticipantTimerValue (Maybe ParticipantTimerAction)
participantTimerValue_participantTimerAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipantTimerValue' {Maybe ParticipantTimerAction
participantTimerAction :: Maybe ParticipantTimerAction
$sel:participantTimerAction:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe ParticipantTimerAction
participantTimerAction} -> Maybe ParticipantTimerAction
participantTimerAction) (\s :: ParticipantTimerValue
s@ParticipantTimerValue' {} Maybe ParticipantTimerAction
a -> ParticipantTimerValue
s {$sel:participantTimerAction:ParticipantTimerValue' :: Maybe ParticipantTimerAction
participantTimerAction = Maybe ParticipantTimerAction
a} :: ParticipantTimerValue)

-- | The duration of a timer, in minutes.
participantTimerValue_participantTimerDurationInMinutes :: Lens.Lens' ParticipantTimerValue (Prelude.Maybe Prelude.Natural)
participantTimerValue_participantTimerDurationInMinutes :: Lens' ParticipantTimerValue (Maybe Natural)
participantTimerValue_participantTimerDurationInMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipantTimerValue' {Maybe Natural
participantTimerDurationInMinutes :: Maybe Natural
$sel:participantTimerDurationInMinutes:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe Natural
participantTimerDurationInMinutes} -> Maybe Natural
participantTimerDurationInMinutes) (\s :: ParticipantTimerValue
s@ParticipantTimerValue' {} Maybe Natural
a -> ParticipantTimerValue
s {$sel:participantTimerDurationInMinutes:ParticipantTimerValue' :: Maybe Natural
participantTimerDurationInMinutes = Maybe Natural
a} :: ParticipantTimerValue)

instance Prelude.Hashable ParticipantTimerValue where
  hashWithSalt :: Int -> ParticipantTimerValue -> Int
hashWithSalt Int
_salt ParticipantTimerValue' {Maybe Natural
Maybe ParticipantTimerAction
participantTimerDurationInMinutes :: Maybe Natural
participantTimerAction :: Maybe ParticipantTimerAction
$sel:participantTimerDurationInMinutes:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe Natural
$sel:participantTimerAction:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe ParticipantTimerAction
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ParticipantTimerAction
participantTimerAction
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
participantTimerDurationInMinutes

instance Prelude.NFData ParticipantTimerValue where
  rnf :: ParticipantTimerValue -> ()
rnf ParticipantTimerValue' {Maybe Natural
Maybe ParticipantTimerAction
participantTimerDurationInMinutes :: Maybe Natural
participantTimerAction :: Maybe ParticipantTimerAction
$sel:participantTimerDurationInMinutes:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe Natural
$sel:participantTimerAction:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe ParticipantTimerAction
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ParticipantTimerAction
participantTimerAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
participantTimerDurationInMinutes

instance Data.ToJSON ParticipantTimerValue where
  toJSON :: ParticipantTimerValue -> Value
toJSON ParticipantTimerValue' {Maybe Natural
Maybe ParticipantTimerAction
participantTimerDurationInMinutes :: Maybe Natural
participantTimerAction :: Maybe ParticipantTimerAction
$sel:participantTimerDurationInMinutes:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe Natural
$sel:participantTimerAction:ParticipantTimerValue' :: ParticipantTimerValue -> Maybe ParticipantTimerAction
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ParticipantTimerAction" 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 ParticipantTimerAction
participantTimerAction,
            (Key
"ParticipantTimerDurationInMinutes" 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
participantTimerDurationInMinutes
          ]
      )