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

import Amazonka.ConnectCases.Types.CommentContent
import Amazonka.ConnectCases.Types.ContactContent
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

-- | Represents the content of a particular type of related item.
--
-- /See:/ 'newRelatedItemContent' smart constructor.
data RelatedItemContent = RelatedItemContent'
  { -- | Represents the content of a comment to be returned to agents.
    RelatedItemContent -> Maybe CommentContent
comment :: Prelude.Maybe CommentContent,
    -- | Represents the content of a contact to be returned to agents.
    RelatedItemContent -> Maybe ContactContent
contact :: Prelude.Maybe ContactContent
  }
  deriving (RelatedItemContent -> RelatedItemContent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelatedItemContent -> RelatedItemContent -> Bool
$c/= :: RelatedItemContent -> RelatedItemContent -> Bool
== :: RelatedItemContent -> RelatedItemContent -> Bool
$c== :: RelatedItemContent -> RelatedItemContent -> Bool
Prelude.Eq, ReadPrec [RelatedItemContent]
ReadPrec RelatedItemContent
Int -> ReadS RelatedItemContent
ReadS [RelatedItemContent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelatedItemContent]
$creadListPrec :: ReadPrec [RelatedItemContent]
readPrec :: ReadPrec RelatedItemContent
$creadPrec :: ReadPrec RelatedItemContent
readList :: ReadS [RelatedItemContent]
$creadList :: ReadS [RelatedItemContent]
readsPrec :: Int -> ReadS RelatedItemContent
$creadsPrec :: Int -> ReadS RelatedItemContent
Prelude.Read, Int -> RelatedItemContent -> ShowS
[RelatedItemContent] -> ShowS
RelatedItemContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelatedItemContent] -> ShowS
$cshowList :: [RelatedItemContent] -> ShowS
show :: RelatedItemContent -> String
$cshow :: RelatedItemContent -> String
showsPrec :: Int -> RelatedItemContent -> ShowS
$cshowsPrec :: Int -> RelatedItemContent -> ShowS
Prelude.Show, forall x. Rep RelatedItemContent x -> RelatedItemContent
forall x. RelatedItemContent -> Rep RelatedItemContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelatedItemContent x -> RelatedItemContent
$cfrom :: forall x. RelatedItemContent -> Rep RelatedItemContent x
Prelude.Generic)

-- |
-- Create a value of 'RelatedItemContent' 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:
--
-- 'comment', 'relatedItemContent_comment' - Represents the content of a comment to be returned to agents.
--
-- 'contact', 'relatedItemContent_contact' - Represents the content of a contact to be returned to agents.
newRelatedItemContent ::
  RelatedItemContent
newRelatedItemContent :: RelatedItemContent
newRelatedItemContent =
  RelatedItemContent'
    { $sel:comment:RelatedItemContent' :: Maybe CommentContent
comment = forall a. Maybe a
Prelude.Nothing,
      $sel:contact:RelatedItemContent' :: Maybe ContactContent
contact = forall a. Maybe a
Prelude.Nothing
    }

-- | Represents the content of a comment to be returned to agents.
relatedItemContent_comment :: Lens.Lens' RelatedItemContent (Prelude.Maybe CommentContent)
relatedItemContent_comment :: Lens' RelatedItemContent (Maybe CommentContent)
relatedItemContent_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedItemContent' {Maybe CommentContent
comment :: Maybe CommentContent
$sel:comment:RelatedItemContent' :: RelatedItemContent -> Maybe CommentContent
comment} -> Maybe CommentContent
comment) (\s :: RelatedItemContent
s@RelatedItemContent' {} Maybe CommentContent
a -> RelatedItemContent
s {$sel:comment:RelatedItemContent' :: Maybe CommentContent
comment = Maybe CommentContent
a} :: RelatedItemContent)

-- | Represents the content of a contact to be returned to agents.
relatedItemContent_contact :: Lens.Lens' RelatedItemContent (Prelude.Maybe ContactContent)
relatedItemContent_contact :: Lens' RelatedItemContent (Maybe ContactContent)
relatedItemContent_contact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedItemContent' {Maybe ContactContent
contact :: Maybe ContactContent
$sel:contact:RelatedItemContent' :: RelatedItemContent -> Maybe ContactContent
contact} -> Maybe ContactContent
contact) (\s :: RelatedItemContent
s@RelatedItemContent' {} Maybe ContactContent
a -> RelatedItemContent
s {$sel:contact:RelatedItemContent' :: Maybe ContactContent
contact = Maybe ContactContent
a} :: RelatedItemContent)

instance Data.FromJSON RelatedItemContent where
  parseJSON :: Value -> Parser RelatedItemContent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RelatedItemContent"
      ( \Object
x ->
          Maybe CommentContent -> Maybe ContactContent -> RelatedItemContent
RelatedItemContent'
            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
"comment")
            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
"contact")
      )

instance Prelude.Hashable RelatedItemContent where
  hashWithSalt :: Int -> RelatedItemContent -> Int
hashWithSalt Int
_salt RelatedItemContent' {Maybe CommentContent
Maybe ContactContent
contact :: Maybe ContactContent
comment :: Maybe CommentContent
$sel:contact:RelatedItemContent' :: RelatedItemContent -> Maybe ContactContent
$sel:comment:RelatedItemContent' :: RelatedItemContent -> Maybe CommentContent
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CommentContent
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContactContent
contact

instance Prelude.NFData RelatedItemContent where
  rnf :: RelatedItemContent -> ()
rnf RelatedItemContent' {Maybe CommentContent
Maybe ContactContent
contact :: Maybe ContactContent
comment :: Maybe CommentContent
$sel:contact:RelatedItemContent' :: RelatedItemContent -> Maybe ContactContent
$sel:comment:RelatedItemContent' :: RelatedItemContent -> Maybe CommentContent
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CommentContent
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContactContent
contact