{-# 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.WorkDocs.Types.CommentMetadata
-- 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.WorkDocs.Types.CommentMetadata 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
import Amazonka.WorkDocs.Types.CommentStatusType
import Amazonka.WorkDocs.Types.User

-- | Describes the metadata of a comment.
--
-- /See:/ 'newCommentMetadata' smart constructor.
data CommentMetadata = CommentMetadata'
  { -- | The ID of the comment.
    CommentMetadata -> Maybe Text
commentId :: Prelude.Maybe Prelude.Text,
    -- | The status of the comment.
    CommentMetadata -> Maybe CommentStatusType
commentStatus :: Prelude.Maybe CommentStatusType,
    -- | The user who made the comment.
    CommentMetadata -> Maybe User
contributor :: Prelude.Maybe User,
    -- | The timestamp that the comment was created.
    CommentMetadata -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The ID of the user being replied to.
    CommentMetadata -> Maybe Text
recipientId :: Prelude.Maybe Prelude.Text
  }
  deriving (CommentMetadata -> CommentMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommentMetadata -> CommentMetadata -> Bool
$c/= :: CommentMetadata -> CommentMetadata -> Bool
== :: CommentMetadata -> CommentMetadata -> Bool
$c== :: CommentMetadata -> CommentMetadata -> Bool
Prelude.Eq, Int -> CommentMetadata -> ShowS
[CommentMetadata] -> ShowS
CommentMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommentMetadata] -> ShowS
$cshowList :: [CommentMetadata] -> ShowS
show :: CommentMetadata -> String
$cshow :: CommentMetadata -> String
showsPrec :: Int -> CommentMetadata -> ShowS
$cshowsPrec :: Int -> CommentMetadata -> ShowS
Prelude.Show, forall x. Rep CommentMetadata x -> CommentMetadata
forall x. CommentMetadata -> Rep CommentMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CommentMetadata x -> CommentMetadata
$cfrom :: forall x. CommentMetadata -> Rep CommentMetadata x
Prelude.Generic)

-- |
-- Create a value of 'CommentMetadata' 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:
--
-- 'commentId', 'commentMetadata_commentId' - The ID of the comment.
--
-- 'commentStatus', 'commentMetadata_commentStatus' - The status of the comment.
--
-- 'contributor', 'commentMetadata_contributor' - The user who made the comment.
--
-- 'createdTimestamp', 'commentMetadata_createdTimestamp' - The timestamp that the comment was created.
--
-- 'recipientId', 'commentMetadata_recipientId' - The ID of the user being replied to.
newCommentMetadata ::
  CommentMetadata
newCommentMetadata :: CommentMetadata
newCommentMetadata =
  CommentMetadata'
    { $sel:commentId:CommentMetadata' :: Maybe Text
commentId = forall a. Maybe a
Prelude.Nothing,
      $sel:commentStatus:CommentMetadata' :: Maybe CommentStatusType
commentStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:contributor:CommentMetadata' :: Maybe User
contributor = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:CommentMetadata' :: Maybe POSIX
createdTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:recipientId:CommentMetadata' :: Maybe Text
recipientId = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the comment.
commentMetadata_commentId :: Lens.Lens' CommentMetadata (Prelude.Maybe Prelude.Text)
commentMetadata_commentId :: Lens' CommentMetadata (Maybe Text)
commentMetadata_commentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentMetadata' {Maybe Text
commentId :: Maybe Text
$sel:commentId:CommentMetadata' :: CommentMetadata -> Maybe Text
commentId} -> Maybe Text
commentId) (\s :: CommentMetadata
s@CommentMetadata' {} Maybe Text
a -> CommentMetadata
s {$sel:commentId:CommentMetadata' :: Maybe Text
commentId = Maybe Text
a} :: CommentMetadata)

-- | The status of the comment.
commentMetadata_commentStatus :: Lens.Lens' CommentMetadata (Prelude.Maybe CommentStatusType)
commentMetadata_commentStatus :: Lens' CommentMetadata (Maybe CommentStatusType)
commentMetadata_commentStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentMetadata' {Maybe CommentStatusType
commentStatus :: Maybe CommentStatusType
$sel:commentStatus:CommentMetadata' :: CommentMetadata -> Maybe CommentStatusType
commentStatus} -> Maybe CommentStatusType
commentStatus) (\s :: CommentMetadata
s@CommentMetadata' {} Maybe CommentStatusType
a -> CommentMetadata
s {$sel:commentStatus:CommentMetadata' :: Maybe CommentStatusType
commentStatus = Maybe CommentStatusType
a} :: CommentMetadata)

-- | The user who made the comment.
commentMetadata_contributor :: Lens.Lens' CommentMetadata (Prelude.Maybe User)
commentMetadata_contributor :: Lens' CommentMetadata (Maybe User)
commentMetadata_contributor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentMetadata' {Maybe User
contributor :: Maybe User
$sel:contributor:CommentMetadata' :: CommentMetadata -> Maybe User
contributor} -> Maybe User
contributor) (\s :: CommentMetadata
s@CommentMetadata' {} Maybe User
a -> CommentMetadata
s {$sel:contributor:CommentMetadata' :: Maybe User
contributor = Maybe User
a} :: CommentMetadata)

-- | The timestamp that the comment was created.
commentMetadata_createdTimestamp :: Lens.Lens' CommentMetadata (Prelude.Maybe Prelude.UTCTime)
commentMetadata_createdTimestamp :: Lens' CommentMetadata (Maybe UTCTime)
commentMetadata_createdTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentMetadata' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:CommentMetadata' :: CommentMetadata -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: CommentMetadata
s@CommentMetadata' {} Maybe POSIX
a -> CommentMetadata
s {$sel:createdTimestamp:CommentMetadata' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: CommentMetadata) 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 ID of the user being replied to.
commentMetadata_recipientId :: Lens.Lens' CommentMetadata (Prelude.Maybe Prelude.Text)
commentMetadata_recipientId :: Lens' CommentMetadata (Maybe Text)
commentMetadata_recipientId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommentMetadata' {Maybe Text
recipientId :: Maybe Text
$sel:recipientId:CommentMetadata' :: CommentMetadata -> Maybe Text
recipientId} -> Maybe Text
recipientId) (\s :: CommentMetadata
s@CommentMetadata' {} Maybe Text
a -> CommentMetadata
s {$sel:recipientId:CommentMetadata' :: Maybe Text
recipientId = Maybe Text
a} :: CommentMetadata)

instance Data.FromJSON CommentMetadata where
  parseJSON :: Value -> Parser CommentMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CommentMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe CommentStatusType
-> Maybe User
-> Maybe POSIX
-> Maybe Text
-> CommentMetadata
CommentMetadata'
            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
"CommentId")
            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
"CommentStatus")
            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
"Contributor")
            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
"CreatedTimestamp")
            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
"RecipientId")
      )

instance Prelude.Hashable CommentMetadata where
  hashWithSalt :: Int -> CommentMetadata -> Int
hashWithSalt Int
_salt CommentMetadata' {Maybe Text
Maybe POSIX
Maybe CommentStatusType
Maybe User
recipientId :: Maybe Text
createdTimestamp :: Maybe POSIX
contributor :: Maybe User
commentStatus :: Maybe CommentStatusType
commentId :: Maybe Text
$sel:recipientId:CommentMetadata' :: CommentMetadata -> Maybe Text
$sel:createdTimestamp:CommentMetadata' :: CommentMetadata -> Maybe POSIX
$sel:contributor:CommentMetadata' :: CommentMetadata -> Maybe User
$sel:commentStatus:CommentMetadata' :: CommentMetadata -> Maybe CommentStatusType
$sel:commentId:CommentMetadata' :: CommentMetadata -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
commentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CommentStatusType
commentStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe User
contributor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recipientId

instance Prelude.NFData CommentMetadata where
  rnf :: CommentMetadata -> ()
rnf CommentMetadata' {Maybe Text
Maybe POSIX
Maybe CommentStatusType
Maybe User
recipientId :: Maybe Text
createdTimestamp :: Maybe POSIX
contributor :: Maybe User
commentStatus :: Maybe CommentStatusType
commentId :: Maybe Text
$sel:recipientId:CommentMetadata' :: CommentMetadata -> Maybe Text
$sel:createdTimestamp:CommentMetadata' :: CommentMetadata -> Maybe POSIX
$sel:contributor:CommentMetadata' :: CommentMetadata -> Maybe User
$sel:commentStatus:CommentMetadata' :: CommentMetadata -> Maybe CommentStatusType
$sel:commentId:CommentMetadata' :: CommentMetadata -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
commentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CommentStatusType
commentStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe User
contributor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recipientId