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

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

-- | Information about the agent who accepted the contact.
--
-- /See:/ 'newAgentInfo' smart constructor.
data AgentInfo = AgentInfo'
  { -- | The timestamp when the contact was connected to the agent.
    AgentInfo -> Maybe POSIX
connectedToAgentTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The identifier of the agent who accepted the contact.
    AgentInfo -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (AgentInfo -> AgentInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AgentInfo -> AgentInfo -> Bool
$c/= :: AgentInfo -> AgentInfo -> Bool
== :: AgentInfo -> AgentInfo -> Bool
$c== :: AgentInfo -> AgentInfo -> Bool
Prelude.Eq, ReadPrec [AgentInfo]
ReadPrec AgentInfo
Int -> ReadS AgentInfo
ReadS [AgentInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AgentInfo]
$creadListPrec :: ReadPrec [AgentInfo]
readPrec :: ReadPrec AgentInfo
$creadPrec :: ReadPrec AgentInfo
readList :: ReadS [AgentInfo]
$creadList :: ReadS [AgentInfo]
readsPrec :: Int -> ReadS AgentInfo
$creadsPrec :: Int -> ReadS AgentInfo
Prelude.Read, Int -> AgentInfo -> ShowS
[AgentInfo] -> ShowS
AgentInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AgentInfo] -> ShowS
$cshowList :: [AgentInfo] -> ShowS
show :: AgentInfo -> String
$cshow :: AgentInfo -> String
showsPrec :: Int -> AgentInfo -> ShowS
$cshowsPrec :: Int -> AgentInfo -> ShowS
Prelude.Show, forall x. Rep AgentInfo x -> AgentInfo
forall x. AgentInfo -> Rep AgentInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AgentInfo x -> AgentInfo
$cfrom :: forall x. AgentInfo -> Rep AgentInfo x
Prelude.Generic)

-- |
-- Create a value of 'AgentInfo' 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:
--
-- 'connectedToAgentTimestamp', 'agentInfo_connectedToAgentTimestamp' - The timestamp when the contact was connected to the agent.
--
-- 'id', 'agentInfo_id' - The identifier of the agent who accepted the contact.
newAgentInfo ::
  AgentInfo
newAgentInfo :: AgentInfo
newAgentInfo =
  AgentInfo'
    { $sel:connectedToAgentTimestamp:AgentInfo' :: Maybe POSIX
connectedToAgentTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:id:AgentInfo' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp when the contact was connected to the agent.
agentInfo_connectedToAgentTimestamp :: Lens.Lens' AgentInfo (Prelude.Maybe Prelude.UTCTime)
agentInfo_connectedToAgentTimestamp :: Lens' AgentInfo (Maybe UTCTime)
agentInfo_connectedToAgentTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentInfo' {Maybe POSIX
connectedToAgentTimestamp :: Maybe POSIX
$sel:connectedToAgentTimestamp:AgentInfo' :: AgentInfo -> Maybe POSIX
connectedToAgentTimestamp} -> Maybe POSIX
connectedToAgentTimestamp) (\s :: AgentInfo
s@AgentInfo' {} Maybe POSIX
a -> AgentInfo
s {$sel:connectedToAgentTimestamp:AgentInfo' :: Maybe POSIX
connectedToAgentTimestamp = Maybe POSIX
a} :: AgentInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The identifier of the agent who accepted the contact.
agentInfo_id :: Lens.Lens' AgentInfo (Prelude.Maybe Prelude.Text)
agentInfo_id :: Lens' AgentInfo (Maybe Text)
agentInfo_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentInfo' {Maybe Text
id :: Maybe Text
$sel:id:AgentInfo' :: AgentInfo -> Maybe Text
id} -> Maybe Text
id) (\s :: AgentInfo
s@AgentInfo' {} Maybe Text
a -> AgentInfo
s {$sel:id:AgentInfo' :: Maybe Text
id = Maybe Text
a} :: AgentInfo)

instance Data.FromJSON AgentInfo where
  parseJSON :: Value -> Parser AgentInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AgentInfo"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> AgentInfo
AgentInfo'
            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
"ConnectedToAgentTimestamp")
            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
"Id")
      )

instance Prelude.Hashable AgentInfo where
  hashWithSalt :: Int -> AgentInfo -> Int
hashWithSalt Int
_salt AgentInfo' {Maybe Text
Maybe POSIX
id :: Maybe Text
connectedToAgentTimestamp :: Maybe POSIX
$sel:id:AgentInfo' :: AgentInfo -> Maybe Text
$sel:connectedToAgentTimestamp:AgentInfo' :: AgentInfo -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
connectedToAgentTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance Prelude.NFData AgentInfo where
  rnf :: AgentInfo -> ()
rnf AgentInfo' {Maybe Text
Maybe POSIX
id :: Maybe Text
connectedToAgentTimestamp :: Maybe POSIX
$sel:id:AgentInfo' :: AgentInfo -> Maybe Text
$sel:connectedToAgentTimestamp:AgentInfo' :: AgentInfo -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
connectedToAgentTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id