{-# 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 #-}
module Amazonka.ConnectCases.Types.CommentContent where
import Amazonka.ConnectCases.Types.CommentBodyTextType
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
data =
{
CommentContent -> Text
body :: Prelude.Text,
:: CommentBodyTextType
}
deriving (CommentContent -> CommentContent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommentContent -> CommentContent -> Bool
$c/= :: CommentContent -> CommentContent -> Bool
== :: CommentContent -> CommentContent -> Bool
$c== :: CommentContent -> CommentContent -> Bool
Prelude.Eq, ReadPrec [CommentContent]
ReadPrec CommentContent
Int -> ReadS CommentContent
ReadS [CommentContent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CommentContent]
$creadListPrec :: ReadPrec [CommentContent]
readPrec :: ReadPrec CommentContent
$creadPrec :: ReadPrec CommentContent
readList :: ReadS [CommentContent]
$creadList :: ReadS [CommentContent]
readsPrec :: Int -> ReadS CommentContent
$creadsPrec :: Int -> ReadS CommentContent
Prelude.Read, Int -> CommentContent -> ShowS
[CommentContent] -> ShowS
CommentContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommentContent] -> ShowS
$cshowList :: [CommentContent] -> ShowS
show :: CommentContent -> String
$cshow :: CommentContent -> String
showsPrec :: Int -> CommentContent -> ShowS
$cshowsPrec :: Int -> CommentContent -> ShowS
Prelude.Show, forall x. Rep CommentContent x -> CommentContent
forall x. CommentContent -> Rep CommentContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CommentContent x -> CommentContent
$cfrom :: forall x. CommentContent -> Rep CommentContent x
Prelude.Generic)
newCommentContent ::
Prelude.Text ->
CommentBodyTextType ->
CommentContent
Text
pBody_ CommentBodyTextType
pContentType_ =
CommentContent'
{ $sel:body:CommentContent' :: Text
body = Text
pBody_,
$sel:contentType:CommentContent' :: CommentBodyTextType
contentType = CommentBodyTextType
pContentType_
}
commentContent_body :: Lens.Lens' CommentContent Prelude.Text
commentContent_body :: Lens' CommentContent Text
commentContent_body = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentContent' {Text
body :: Text
$sel:body:CommentContent' :: CommentContent -> Text
body} -> Text
body) (\s :: CommentContent
s@CommentContent' {} Text
a -> CommentContent
s {$sel:body:CommentContent' :: Text
body = Text
a} :: CommentContent)
commentContent_contentType :: Lens.Lens' CommentContent CommentBodyTextType
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentContent' {CommentBodyTextType
contentType :: CommentBodyTextType
$sel:contentType:CommentContent' :: CommentContent -> CommentBodyTextType
contentType} -> CommentBodyTextType
contentType) (\s :: CommentContent
s@CommentContent' {} CommentBodyTextType
a -> CommentContent
s {$sel:contentType:CommentContent' :: CommentBodyTextType
contentType = CommentBodyTextType
a} :: CommentContent)
instance Data.FromJSON CommentContent where
parseJSON :: Value -> Parser CommentContent
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CommentContent"
( \Object
x ->
Text -> CommentBodyTextType -> CommentContent
CommentContent'
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
"body")
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
"contentType")
)
instance Prelude.Hashable CommentContent where
hashWithSalt :: Int -> CommentContent -> Int
hashWithSalt Int
_salt CommentContent' {Text
CommentBodyTextType
contentType :: CommentBodyTextType
body :: Text
$sel:contentType:CommentContent' :: CommentContent -> CommentBodyTextType
$sel:body:CommentContent' :: CommentContent -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
body
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CommentBodyTextType
contentType
instance Prelude.NFData CommentContent where
rnf :: CommentContent -> ()
rnf CommentContent' {Text
CommentBodyTextType
contentType :: CommentBodyTextType
body :: Text
$sel:contentType:CommentContent' :: CommentContent -> CommentBodyTextType
$sel:body:CommentContent' :: CommentContent -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
body
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CommentBodyTextType
contentType
instance Data.ToJSON CommentContent where
toJSON :: CommentContent -> Value
toJSON CommentContent' {Text
CommentBodyTextType
contentType :: CommentBodyTextType
body :: Text
$sel:contentType:CommentContent' :: CommentContent -> CommentBodyTextType
$sel:body:CommentContent' :: CommentContent -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"body" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
body),
forall a. a -> Maybe a
Prelude.Just (Key
"contentType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CommentBodyTextType
contentType)
]
)