{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateParticipantRoleConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates timeouts for when human chat participants are to be considered
-- idle, and when agents are automatically disconnected from a chat due to
-- idleness. You can set four timers:
--
-- -   Customer idle timeout
--
-- -   Customer auto-disconnect timeout
--
-- -   Agent idle timeout
--
-- -   Agent auto-disconnect timeout
--
-- 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>.
module Amazonka.Connect.UpdateParticipantRoleConfig
  ( -- * Creating a Request
    UpdateParticipantRoleConfig (..),
    newUpdateParticipantRoleConfig,

    -- * Request Lenses
    updateParticipantRoleConfig_instanceId,
    updateParticipantRoleConfig_contactId,
    updateParticipantRoleConfig_channelConfiguration,

    -- * Destructuring the Response
    UpdateParticipantRoleConfigResponse (..),
    newUpdateParticipantRoleConfigResponse,

    -- * Response Lenses
    updateParticipantRoleConfigResponse_httpStatus,
  )
where

import Amazonka.Connect.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateParticipantRoleConfig' smart constructor.
data UpdateParticipantRoleConfig = UpdateParticipantRoleConfig'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateParticipantRoleConfig -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the contact in this instance of Amazon Connect.
    UpdateParticipantRoleConfig -> Text
contactId :: Prelude.Text,
    -- | The Amazon Connect channel you want to configure.
    UpdateParticipantRoleConfig
-> UpdateParticipantRoleConfigChannelInfo
channelConfiguration :: UpdateParticipantRoleConfigChannelInfo
  }
  deriving (UpdateParticipantRoleConfig -> UpdateParticipantRoleConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateParticipantRoleConfig -> UpdateParticipantRoleConfig -> Bool
$c/= :: UpdateParticipantRoleConfig -> UpdateParticipantRoleConfig -> Bool
== :: UpdateParticipantRoleConfig -> UpdateParticipantRoleConfig -> Bool
$c== :: UpdateParticipantRoleConfig -> UpdateParticipantRoleConfig -> Bool
Prelude.Eq, ReadPrec [UpdateParticipantRoleConfig]
ReadPrec UpdateParticipantRoleConfig
Int -> ReadS UpdateParticipantRoleConfig
ReadS [UpdateParticipantRoleConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateParticipantRoleConfig]
$creadListPrec :: ReadPrec [UpdateParticipantRoleConfig]
readPrec :: ReadPrec UpdateParticipantRoleConfig
$creadPrec :: ReadPrec UpdateParticipantRoleConfig
readList :: ReadS [UpdateParticipantRoleConfig]
$creadList :: ReadS [UpdateParticipantRoleConfig]
readsPrec :: Int -> ReadS UpdateParticipantRoleConfig
$creadsPrec :: Int -> ReadS UpdateParticipantRoleConfig
Prelude.Read, Int -> UpdateParticipantRoleConfig -> ShowS
[UpdateParticipantRoleConfig] -> ShowS
UpdateParticipantRoleConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateParticipantRoleConfig] -> ShowS
$cshowList :: [UpdateParticipantRoleConfig] -> ShowS
show :: UpdateParticipantRoleConfig -> String
$cshow :: UpdateParticipantRoleConfig -> String
showsPrec :: Int -> UpdateParticipantRoleConfig -> ShowS
$cshowsPrec :: Int -> UpdateParticipantRoleConfig -> ShowS
Prelude.Show, forall x.
Rep UpdateParticipantRoleConfig x -> UpdateParticipantRoleConfig
forall x.
UpdateParticipantRoleConfig -> Rep UpdateParticipantRoleConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateParticipantRoleConfig x -> UpdateParticipantRoleConfig
$cfrom :: forall x.
UpdateParticipantRoleConfig -> Rep UpdateParticipantRoleConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateParticipantRoleConfig' 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:
--
-- 'instanceId', 'updateParticipantRoleConfig_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'contactId', 'updateParticipantRoleConfig_contactId' - The identifier of the contact in this instance of Amazon Connect.
--
-- 'channelConfiguration', 'updateParticipantRoleConfig_channelConfiguration' - The Amazon Connect channel you want to configure.
newUpdateParticipantRoleConfig ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactId'
  Prelude.Text ->
  -- | 'channelConfiguration'
  UpdateParticipantRoleConfigChannelInfo ->
  UpdateParticipantRoleConfig
newUpdateParticipantRoleConfig :: Text
-> Text
-> UpdateParticipantRoleConfigChannelInfo
-> UpdateParticipantRoleConfig
newUpdateParticipantRoleConfig
  Text
pInstanceId_
  Text
pContactId_
  UpdateParticipantRoleConfigChannelInfo
pChannelConfiguration_ =
    UpdateParticipantRoleConfig'
      { $sel:instanceId:UpdateParticipantRoleConfig' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:contactId:UpdateParticipantRoleConfig' :: Text
contactId = Text
pContactId_,
        $sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfigChannelInfo
channelConfiguration = UpdateParticipantRoleConfigChannelInfo
pChannelConfiguration_
      }

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
updateParticipantRoleConfig_instanceId :: Lens.Lens' UpdateParticipantRoleConfig Prelude.Text
updateParticipantRoleConfig_instanceId :: Lens' UpdateParticipantRoleConfig Text
updateParticipantRoleConfig_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateParticipantRoleConfig' {Text
instanceId :: Text
$sel:instanceId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
instanceId} -> Text
instanceId) (\s :: UpdateParticipantRoleConfig
s@UpdateParticipantRoleConfig' {} Text
a -> UpdateParticipantRoleConfig
s {$sel:instanceId:UpdateParticipantRoleConfig' :: Text
instanceId = Text
a} :: UpdateParticipantRoleConfig)

-- | The identifier of the contact in this instance of Amazon Connect.
updateParticipantRoleConfig_contactId :: Lens.Lens' UpdateParticipantRoleConfig Prelude.Text
updateParticipantRoleConfig_contactId :: Lens' UpdateParticipantRoleConfig Text
updateParticipantRoleConfig_contactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateParticipantRoleConfig' {Text
contactId :: Text
$sel:contactId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
contactId} -> Text
contactId) (\s :: UpdateParticipantRoleConfig
s@UpdateParticipantRoleConfig' {} Text
a -> UpdateParticipantRoleConfig
s {$sel:contactId:UpdateParticipantRoleConfig' :: Text
contactId = Text
a} :: UpdateParticipantRoleConfig)

-- | The Amazon Connect channel you want to configure.
updateParticipantRoleConfig_channelConfiguration :: Lens.Lens' UpdateParticipantRoleConfig UpdateParticipantRoleConfigChannelInfo
updateParticipantRoleConfig_channelConfiguration :: Lens'
  UpdateParticipantRoleConfig UpdateParticipantRoleConfigChannelInfo
updateParticipantRoleConfig_channelConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateParticipantRoleConfig' {UpdateParticipantRoleConfigChannelInfo
channelConfiguration :: UpdateParticipantRoleConfigChannelInfo
$sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig
-> UpdateParticipantRoleConfigChannelInfo
channelConfiguration} -> UpdateParticipantRoleConfigChannelInfo
channelConfiguration) (\s :: UpdateParticipantRoleConfig
s@UpdateParticipantRoleConfig' {} UpdateParticipantRoleConfigChannelInfo
a -> UpdateParticipantRoleConfig
s {$sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfigChannelInfo
channelConfiguration = UpdateParticipantRoleConfigChannelInfo
a} :: UpdateParticipantRoleConfig)

instance Core.AWSRequest UpdateParticipantRoleConfig where
  type
    AWSResponse UpdateParticipantRoleConfig =
      UpdateParticipantRoleConfigResponse
  request :: (Service -> Service)
-> UpdateParticipantRoleConfig
-> Request UpdateParticipantRoleConfig
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateParticipantRoleConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateParticipantRoleConfig)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateParticipantRoleConfigResponse
UpdateParticipantRoleConfigResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateParticipantRoleConfig where
  hashWithSalt :: Int -> UpdateParticipantRoleConfig -> Int
hashWithSalt Int
_salt UpdateParticipantRoleConfig' {Text
UpdateParticipantRoleConfigChannelInfo
channelConfiguration :: UpdateParticipantRoleConfigChannelInfo
contactId :: Text
instanceId :: Text
$sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig
-> UpdateParticipantRoleConfigChannelInfo
$sel:contactId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
$sel:instanceId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` UpdateParticipantRoleConfigChannelInfo
channelConfiguration

instance Prelude.NFData UpdateParticipantRoleConfig where
  rnf :: UpdateParticipantRoleConfig -> ()
rnf UpdateParticipantRoleConfig' {Text
UpdateParticipantRoleConfigChannelInfo
channelConfiguration :: UpdateParticipantRoleConfigChannelInfo
contactId :: Text
instanceId :: Text
$sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig
-> UpdateParticipantRoleConfigChannelInfo
$sel:contactId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
$sel:instanceId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contactId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf UpdateParticipantRoleConfigChannelInfo
channelConfiguration

instance Data.ToHeaders UpdateParticipantRoleConfig where
  toHeaders :: UpdateParticipantRoleConfig -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateParticipantRoleConfig where
  toJSON :: UpdateParticipantRoleConfig -> Value
toJSON UpdateParticipantRoleConfig' {Text
UpdateParticipantRoleConfigChannelInfo
channelConfiguration :: UpdateParticipantRoleConfigChannelInfo
contactId :: Text
instanceId :: Text
$sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig
-> UpdateParticipantRoleConfigChannelInfo
$sel:contactId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
$sel:instanceId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ChannelConfiguration"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= UpdateParticipantRoleConfigChannelInfo
channelConfiguration
              )
          ]
      )

instance Data.ToPath UpdateParticipantRoleConfig where
  toPath :: UpdateParticipantRoleConfig -> ByteString
toPath UpdateParticipantRoleConfig' {Text
UpdateParticipantRoleConfigChannelInfo
channelConfiguration :: UpdateParticipantRoleConfigChannelInfo
contactId :: Text
instanceId :: Text
$sel:channelConfiguration:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig
-> UpdateParticipantRoleConfigChannelInfo
$sel:contactId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
$sel:instanceId:UpdateParticipantRoleConfig' :: UpdateParticipantRoleConfig -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/contact/participant-role-config/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
contactId
      ]

instance Data.ToQuery UpdateParticipantRoleConfig where
  toQuery :: UpdateParticipantRoleConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateParticipantRoleConfigResponse' smart constructor.
data UpdateParticipantRoleConfigResponse = UpdateParticipantRoleConfigResponse'
  { -- | The response's http status code.
    UpdateParticipantRoleConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateParticipantRoleConfigResponse
-> UpdateParticipantRoleConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateParticipantRoleConfigResponse
-> UpdateParticipantRoleConfigResponse -> Bool
$c/= :: UpdateParticipantRoleConfigResponse
-> UpdateParticipantRoleConfigResponse -> Bool
== :: UpdateParticipantRoleConfigResponse
-> UpdateParticipantRoleConfigResponse -> Bool
$c== :: UpdateParticipantRoleConfigResponse
-> UpdateParticipantRoleConfigResponse -> Bool
Prelude.Eq, ReadPrec [UpdateParticipantRoleConfigResponse]
ReadPrec UpdateParticipantRoleConfigResponse
Int -> ReadS UpdateParticipantRoleConfigResponse
ReadS [UpdateParticipantRoleConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateParticipantRoleConfigResponse]
$creadListPrec :: ReadPrec [UpdateParticipantRoleConfigResponse]
readPrec :: ReadPrec UpdateParticipantRoleConfigResponse
$creadPrec :: ReadPrec UpdateParticipantRoleConfigResponse
readList :: ReadS [UpdateParticipantRoleConfigResponse]
$creadList :: ReadS [UpdateParticipantRoleConfigResponse]
readsPrec :: Int -> ReadS UpdateParticipantRoleConfigResponse
$creadsPrec :: Int -> ReadS UpdateParticipantRoleConfigResponse
Prelude.Read, Int -> UpdateParticipantRoleConfigResponse -> ShowS
[UpdateParticipantRoleConfigResponse] -> ShowS
UpdateParticipantRoleConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateParticipantRoleConfigResponse] -> ShowS
$cshowList :: [UpdateParticipantRoleConfigResponse] -> ShowS
show :: UpdateParticipantRoleConfigResponse -> String
$cshow :: UpdateParticipantRoleConfigResponse -> String
showsPrec :: Int -> UpdateParticipantRoleConfigResponse -> ShowS
$cshowsPrec :: Int -> UpdateParticipantRoleConfigResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateParticipantRoleConfigResponse x
-> UpdateParticipantRoleConfigResponse
forall x.
UpdateParticipantRoleConfigResponse
-> Rep UpdateParticipantRoleConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateParticipantRoleConfigResponse x
-> UpdateParticipantRoleConfigResponse
$cfrom :: forall x.
UpdateParticipantRoleConfigResponse
-> Rep UpdateParticipantRoleConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateParticipantRoleConfigResponse' 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:
--
-- 'httpStatus', 'updateParticipantRoleConfigResponse_httpStatus' - The response's http status code.
newUpdateParticipantRoleConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateParticipantRoleConfigResponse
newUpdateParticipantRoleConfigResponse :: Int -> UpdateParticipantRoleConfigResponse
newUpdateParticipantRoleConfigResponse Int
pHttpStatus_ =
  UpdateParticipantRoleConfigResponse'
    { $sel:httpStatus:UpdateParticipantRoleConfigResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
updateParticipantRoleConfigResponse_httpStatus :: Lens.Lens' UpdateParticipantRoleConfigResponse Prelude.Int
updateParticipantRoleConfigResponse_httpStatus :: Lens' UpdateParticipantRoleConfigResponse Int
updateParticipantRoleConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateParticipantRoleConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateParticipantRoleConfigResponse' :: UpdateParticipantRoleConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateParticipantRoleConfigResponse
s@UpdateParticipantRoleConfigResponse' {} Int
a -> UpdateParticipantRoleConfigResponse
s {$sel:httpStatus:UpdateParticipantRoleConfigResponse' :: Int
httpStatus = Int
a} :: UpdateParticipantRoleConfigResponse)

instance
  Prelude.NFData
    UpdateParticipantRoleConfigResponse
  where
  rnf :: UpdateParticipantRoleConfigResponse -> ()
rnf UpdateParticipantRoleConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateParticipantRoleConfigResponse' :: UpdateParticipantRoleConfigResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus