{-# 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.ConnectCases.Types.ContactContent
-- 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.ConnectCases.Types.ContactContent 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

-- | An object that represents a content of an Amazon Connect contact object.
--
-- /See:/ 'newContactContent' smart constructor.
data ContactContent = ContactContent'
  { -- | A list of channels to filter on for related items of type @Contact@.
    ContactContent -> Text
channel :: Prelude.Text,
    -- | The difference between the @InitiationTimestamp@ and the
    -- @DisconnectTimestamp@ of the contact.
    ContactContent -> ISO8601
connectedToSystemTime :: Data.ISO8601,
    -- | A unique identifier of a contact in Amazon Connect.
    ContactContent -> Text
contactArn :: Prelude.Text
  }
  deriving (ContactContent -> ContactContent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContactContent -> ContactContent -> Bool
$c/= :: ContactContent -> ContactContent -> Bool
== :: ContactContent -> ContactContent -> Bool
$c== :: ContactContent -> ContactContent -> Bool
Prelude.Eq, ReadPrec [ContactContent]
ReadPrec ContactContent
Int -> ReadS ContactContent
ReadS [ContactContent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContactContent]
$creadListPrec :: ReadPrec [ContactContent]
readPrec :: ReadPrec ContactContent
$creadPrec :: ReadPrec ContactContent
readList :: ReadS [ContactContent]
$creadList :: ReadS [ContactContent]
readsPrec :: Int -> ReadS ContactContent
$creadsPrec :: Int -> ReadS ContactContent
Prelude.Read, Int -> ContactContent -> ShowS
[ContactContent] -> ShowS
ContactContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContactContent] -> ShowS
$cshowList :: [ContactContent] -> ShowS
show :: ContactContent -> String
$cshow :: ContactContent -> String
showsPrec :: Int -> ContactContent -> ShowS
$cshowsPrec :: Int -> ContactContent -> ShowS
Prelude.Show, forall x. Rep ContactContent x -> ContactContent
forall x. ContactContent -> Rep ContactContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContactContent x -> ContactContent
$cfrom :: forall x. ContactContent -> Rep ContactContent x
Prelude.Generic)

-- |
-- Create a value of 'ContactContent' 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:
--
-- 'channel', 'contactContent_channel' - A list of channels to filter on for related items of type @Contact@.
--
-- 'connectedToSystemTime', 'contactContent_connectedToSystemTime' - The difference between the @InitiationTimestamp@ and the
-- @DisconnectTimestamp@ of the contact.
--
-- 'contactArn', 'contactContent_contactArn' - A unique identifier of a contact in Amazon Connect.
newContactContent ::
  -- | 'channel'
  Prelude.Text ->
  -- | 'connectedToSystemTime'
  Prelude.UTCTime ->
  -- | 'contactArn'
  Prelude.Text ->
  ContactContent
newContactContent :: Text -> UTCTime -> Text -> ContactContent
newContactContent
  Text
pChannel_
  UTCTime
pConnectedToSystemTime_
  Text
pContactArn_ =
    ContactContent'
      { $sel:channel:ContactContent' :: Text
channel = Text
pChannel_,
        $sel:connectedToSystemTime:ContactContent' :: ISO8601
connectedToSystemTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pConnectedToSystemTime_,
        $sel:contactArn:ContactContent' :: Text
contactArn = Text
pContactArn_
      }

-- | A list of channels to filter on for related items of type @Contact@.
contactContent_channel :: Lens.Lens' ContactContent Prelude.Text
contactContent_channel :: Lens' ContactContent Text
contactContent_channel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactContent' {Text
channel :: Text
$sel:channel:ContactContent' :: ContactContent -> Text
channel} -> Text
channel) (\s :: ContactContent
s@ContactContent' {} Text
a -> ContactContent
s {$sel:channel:ContactContent' :: Text
channel = Text
a} :: ContactContent)

-- | The difference between the @InitiationTimestamp@ and the
-- @DisconnectTimestamp@ of the contact.
contactContent_connectedToSystemTime :: Lens.Lens' ContactContent Prelude.UTCTime
contactContent_connectedToSystemTime :: Lens' ContactContent UTCTime
contactContent_connectedToSystemTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactContent' {ISO8601
connectedToSystemTime :: ISO8601
$sel:connectedToSystemTime:ContactContent' :: ContactContent -> ISO8601
connectedToSystemTime} -> ISO8601
connectedToSystemTime) (\s :: ContactContent
s@ContactContent' {} ISO8601
a -> ContactContent
s {$sel:connectedToSystemTime:ContactContent' :: ISO8601
connectedToSystemTime = ISO8601
a} :: ContactContent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A unique identifier of a contact in Amazon Connect.
contactContent_contactArn :: Lens.Lens' ContactContent Prelude.Text
contactContent_contactArn :: Lens' ContactContent Text
contactContent_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactContent' {Text
contactArn :: Text
$sel:contactArn:ContactContent' :: ContactContent -> Text
contactArn} -> Text
contactArn) (\s :: ContactContent
s@ContactContent' {} Text
a -> ContactContent
s {$sel:contactArn:ContactContent' :: Text
contactArn = Text
a} :: ContactContent)

instance Data.FromJSON ContactContent where
  parseJSON :: Value -> Parser ContactContent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContactContent"
      ( \Object
x ->
          Text -> ISO8601 -> Text -> ContactContent
ContactContent'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"channel")
            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
"connectedToSystemTime")
            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
"contactArn")
      )

instance Prelude.Hashable ContactContent where
  hashWithSalt :: Int -> ContactContent -> Int
hashWithSalt Int
_salt ContactContent' {Text
ISO8601
contactArn :: Text
connectedToSystemTime :: ISO8601
channel :: Text
$sel:contactArn:ContactContent' :: ContactContent -> Text
$sel:connectedToSystemTime:ContactContent' :: ContactContent -> ISO8601
$sel:channel:ContactContent' :: ContactContent -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
connectedToSystemTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactArn

instance Prelude.NFData ContactContent where
  rnf :: ContactContent -> ()
rnf ContactContent' {Text
ISO8601
contactArn :: Text
connectedToSystemTime :: ISO8601
channel :: Text
$sel:contactArn:ContactContent' :: ContactContent -> Text
$sel:connectedToSystemTime:ContactContent' :: ContactContent -> ISO8601
$sel:channel:ContactContent' :: ContactContent -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
channel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
connectedToSystemTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contactArn