{-# 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.SSM.Types.DocumentReviewerResponseSource
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SSM.Types.DocumentReviewerResponseSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.DocumentReviewCommentSource
import Amazonka.SSM.Types.ReviewStatus

-- | Information about a reviewer\'s response to a document review request.
--
-- /See:/ 'newDocumentReviewerResponseSource' smart constructor.
data DocumentReviewerResponseSource = DocumentReviewerResponseSource'
  { -- | The user in your organization assigned to review a document request.
    DocumentReviewerResponseSource -> Maybe Text
reviewer :: Prelude.Maybe Prelude.Text,
    -- | The current review status of a new custom SSM document created by a
    -- member of your organization, or of the latest version of an existing SSM
    -- document.
    --
    -- Only one version of a document can be in the APPROVED state at a time.
    -- When a new version is approved, the status of the previous version
    -- changes to REJECTED.
    --
    -- Only one version of a document can be in review, or PENDING, at a time.
    DocumentReviewerResponseSource -> Maybe ReviewStatus
reviewStatus :: Prelude.Maybe ReviewStatus,
    -- | The date and time that a reviewer last updated a response to a document
    -- review request.
    DocumentReviewerResponseSource -> Maybe POSIX
updatedTime :: Prelude.Maybe Core.POSIX,
    -- | The comment entered by a reviewer as part of their document review
    -- response.
    DocumentReviewerResponseSource
-> Maybe [DocumentReviewCommentSource]
comment :: Prelude.Maybe [DocumentReviewCommentSource],
    -- | The date and time that a reviewer entered a response to a document
    -- review request.
    DocumentReviewerResponseSource -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX
  }
  deriving (DocumentReviewerResponseSource
-> DocumentReviewerResponseSource -> Bool
(DocumentReviewerResponseSource
 -> DocumentReviewerResponseSource -> Bool)
-> (DocumentReviewerResponseSource
    -> DocumentReviewerResponseSource -> Bool)
-> Eq DocumentReviewerResponseSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentReviewerResponseSource
-> DocumentReviewerResponseSource -> Bool
$c/= :: DocumentReviewerResponseSource
-> DocumentReviewerResponseSource -> Bool
== :: DocumentReviewerResponseSource
-> DocumentReviewerResponseSource -> Bool
$c== :: DocumentReviewerResponseSource
-> DocumentReviewerResponseSource -> Bool
Prelude.Eq, ReadPrec [DocumentReviewerResponseSource]
ReadPrec DocumentReviewerResponseSource
Int -> ReadS DocumentReviewerResponseSource
ReadS [DocumentReviewerResponseSource]
(Int -> ReadS DocumentReviewerResponseSource)
-> ReadS [DocumentReviewerResponseSource]
-> ReadPrec DocumentReviewerResponseSource
-> ReadPrec [DocumentReviewerResponseSource]
-> Read DocumentReviewerResponseSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentReviewerResponseSource]
$creadListPrec :: ReadPrec [DocumentReviewerResponseSource]
readPrec :: ReadPrec DocumentReviewerResponseSource
$creadPrec :: ReadPrec DocumentReviewerResponseSource
readList :: ReadS [DocumentReviewerResponseSource]
$creadList :: ReadS [DocumentReviewerResponseSource]
readsPrec :: Int -> ReadS DocumentReviewerResponseSource
$creadsPrec :: Int -> ReadS DocumentReviewerResponseSource
Prelude.Read, Int -> DocumentReviewerResponseSource -> ShowS
[DocumentReviewerResponseSource] -> ShowS
DocumentReviewerResponseSource -> String
(Int -> DocumentReviewerResponseSource -> ShowS)
-> (DocumentReviewerResponseSource -> String)
-> ([DocumentReviewerResponseSource] -> ShowS)
-> Show DocumentReviewerResponseSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentReviewerResponseSource] -> ShowS
$cshowList :: [DocumentReviewerResponseSource] -> ShowS
show :: DocumentReviewerResponseSource -> String
$cshow :: DocumentReviewerResponseSource -> String
showsPrec :: Int -> DocumentReviewerResponseSource -> ShowS
$cshowsPrec :: Int -> DocumentReviewerResponseSource -> ShowS
Prelude.Show, (forall x.
 DocumentReviewerResponseSource
 -> Rep DocumentReviewerResponseSource x)
-> (forall x.
    Rep DocumentReviewerResponseSource x
    -> DocumentReviewerResponseSource)
-> Generic DocumentReviewerResponseSource
forall x.
Rep DocumentReviewerResponseSource x
-> DocumentReviewerResponseSource
forall x.
DocumentReviewerResponseSource
-> Rep DocumentReviewerResponseSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DocumentReviewerResponseSource x
-> DocumentReviewerResponseSource
$cfrom :: forall x.
DocumentReviewerResponseSource
-> Rep DocumentReviewerResponseSource x
Prelude.Generic)

-- |
-- Create a value of 'DocumentReviewerResponseSource' 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:
--
-- 'reviewer', 'documentReviewerResponseSource_reviewer' - The user in your organization assigned to review a document request.
--
-- 'reviewStatus', 'documentReviewerResponseSource_reviewStatus' - The current review status of a new custom SSM document created by a
-- member of your organization, or of the latest version of an existing SSM
-- document.
--
-- Only one version of a document can be in the APPROVED state at a time.
-- When a new version is approved, the status of the previous version
-- changes to REJECTED.
--
-- Only one version of a document can be in review, or PENDING, at a time.
--
-- 'updatedTime', 'documentReviewerResponseSource_updatedTime' - The date and time that a reviewer last updated a response to a document
-- review request.
--
-- 'comment', 'documentReviewerResponseSource_comment' - The comment entered by a reviewer as part of their document review
-- response.
--
-- 'createTime', 'documentReviewerResponseSource_createTime' - The date and time that a reviewer entered a response to a document
-- review request.
newDocumentReviewerResponseSource ::
  DocumentReviewerResponseSource
newDocumentReviewerResponseSource :: DocumentReviewerResponseSource
newDocumentReviewerResponseSource =
  DocumentReviewerResponseSource' :: Maybe Text
-> Maybe ReviewStatus
-> Maybe POSIX
-> Maybe [DocumentReviewCommentSource]
-> Maybe POSIX
-> DocumentReviewerResponseSource
DocumentReviewerResponseSource'
    { $sel:reviewer:DocumentReviewerResponseSource' :: Maybe Text
reviewer =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reviewStatus:DocumentReviewerResponseSource' :: Maybe ReviewStatus
reviewStatus = Maybe ReviewStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedTime:DocumentReviewerResponseSource' :: Maybe POSIX
updatedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:comment:DocumentReviewerResponseSource' :: Maybe [DocumentReviewCommentSource]
comment = Maybe [DocumentReviewCommentSource]
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:DocumentReviewerResponseSource' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The user in your organization assigned to review a document request.
documentReviewerResponseSource_reviewer :: Lens.Lens' DocumentReviewerResponseSource (Prelude.Maybe Prelude.Text)
documentReviewerResponseSource_reviewer :: (Maybe Text -> f (Maybe Text))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
documentReviewerResponseSource_reviewer = (DocumentReviewerResponseSource -> Maybe Text)
-> (DocumentReviewerResponseSource
    -> Maybe Text -> DocumentReviewerResponseSource)
-> Lens
     DocumentReviewerResponseSource
     DocumentReviewerResponseSource
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewerResponseSource' {Maybe Text
reviewer :: Maybe Text
$sel:reviewer:DocumentReviewerResponseSource' :: DocumentReviewerResponseSource -> Maybe Text
reviewer} -> Maybe Text
reviewer) (\s :: DocumentReviewerResponseSource
s@DocumentReviewerResponseSource' {} Maybe Text
a -> DocumentReviewerResponseSource
s {$sel:reviewer:DocumentReviewerResponseSource' :: Maybe Text
reviewer = Maybe Text
a} :: DocumentReviewerResponseSource)

-- | The current review status of a new custom SSM document created by a
-- member of your organization, or of the latest version of an existing SSM
-- document.
--
-- Only one version of a document can be in the APPROVED state at a time.
-- When a new version is approved, the status of the previous version
-- changes to REJECTED.
--
-- Only one version of a document can be in review, or PENDING, at a time.
documentReviewerResponseSource_reviewStatus :: Lens.Lens' DocumentReviewerResponseSource (Prelude.Maybe ReviewStatus)
documentReviewerResponseSource_reviewStatus :: (Maybe ReviewStatus -> f (Maybe ReviewStatus))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
documentReviewerResponseSource_reviewStatus = (DocumentReviewerResponseSource -> Maybe ReviewStatus)
-> (DocumentReviewerResponseSource
    -> Maybe ReviewStatus -> DocumentReviewerResponseSource)
-> Lens
     DocumentReviewerResponseSource
     DocumentReviewerResponseSource
     (Maybe ReviewStatus)
     (Maybe ReviewStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewerResponseSource' {Maybe ReviewStatus
reviewStatus :: Maybe ReviewStatus
$sel:reviewStatus:DocumentReviewerResponseSource' :: DocumentReviewerResponseSource -> Maybe ReviewStatus
reviewStatus} -> Maybe ReviewStatus
reviewStatus) (\s :: DocumentReviewerResponseSource
s@DocumentReviewerResponseSource' {} Maybe ReviewStatus
a -> DocumentReviewerResponseSource
s {$sel:reviewStatus:DocumentReviewerResponseSource' :: Maybe ReviewStatus
reviewStatus = Maybe ReviewStatus
a} :: DocumentReviewerResponseSource)

-- | The date and time that a reviewer last updated a response to a document
-- review request.
documentReviewerResponseSource_updatedTime :: Lens.Lens' DocumentReviewerResponseSource (Prelude.Maybe Prelude.UTCTime)
documentReviewerResponseSource_updatedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
documentReviewerResponseSource_updatedTime = (DocumentReviewerResponseSource -> Maybe POSIX)
-> (DocumentReviewerResponseSource
    -> Maybe POSIX -> DocumentReviewerResponseSource)
-> Lens
     DocumentReviewerResponseSource
     DocumentReviewerResponseSource
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewerResponseSource' {Maybe POSIX
updatedTime :: Maybe POSIX
$sel:updatedTime:DocumentReviewerResponseSource' :: DocumentReviewerResponseSource -> Maybe POSIX
updatedTime} -> Maybe POSIX
updatedTime) (\s :: DocumentReviewerResponseSource
s@DocumentReviewerResponseSource' {} Maybe POSIX
a -> DocumentReviewerResponseSource
s {$sel:updatedTime:DocumentReviewerResponseSource' :: Maybe POSIX
updatedTime = Maybe POSIX
a} :: DocumentReviewerResponseSource) ((Maybe POSIX -> f (Maybe POSIX))
 -> DocumentReviewerResponseSource
 -> f DocumentReviewerResponseSource)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The comment entered by a reviewer as part of their document review
-- response.
documentReviewerResponseSource_comment :: Lens.Lens' DocumentReviewerResponseSource (Prelude.Maybe [DocumentReviewCommentSource])
documentReviewerResponseSource_comment :: (Maybe [DocumentReviewCommentSource]
 -> f (Maybe [DocumentReviewCommentSource]))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
documentReviewerResponseSource_comment = (DocumentReviewerResponseSource
 -> Maybe [DocumentReviewCommentSource])
-> (DocumentReviewerResponseSource
    -> Maybe [DocumentReviewCommentSource]
    -> DocumentReviewerResponseSource)
-> Lens
     DocumentReviewerResponseSource
     DocumentReviewerResponseSource
     (Maybe [DocumentReviewCommentSource])
     (Maybe [DocumentReviewCommentSource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewerResponseSource' {Maybe [DocumentReviewCommentSource]
comment :: Maybe [DocumentReviewCommentSource]
$sel:comment:DocumentReviewerResponseSource' :: DocumentReviewerResponseSource
-> Maybe [DocumentReviewCommentSource]
comment} -> Maybe [DocumentReviewCommentSource]
comment) (\s :: DocumentReviewerResponseSource
s@DocumentReviewerResponseSource' {} Maybe [DocumentReviewCommentSource]
a -> DocumentReviewerResponseSource
s {$sel:comment:DocumentReviewerResponseSource' :: Maybe [DocumentReviewCommentSource]
comment = Maybe [DocumentReviewCommentSource]
a} :: DocumentReviewerResponseSource) ((Maybe [DocumentReviewCommentSource]
  -> f (Maybe [DocumentReviewCommentSource]))
 -> DocumentReviewerResponseSource
 -> f DocumentReviewerResponseSource)
-> ((Maybe [DocumentReviewCommentSource]
     -> f (Maybe [DocumentReviewCommentSource]))
    -> Maybe [DocumentReviewCommentSource]
    -> f (Maybe [DocumentReviewCommentSource]))
-> (Maybe [DocumentReviewCommentSource]
    -> f (Maybe [DocumentReviewCommentSource]))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DocumentReviewCommentSource]
  [DocumentReviewCommentSource]
  [DocumentReviewCommentSource]
  [DocumentReviewCommentSource]
-> Iso
     (Maybe [DocumentReviewCommentSource])
     (Maybe [DocumentReviewCommentSource])
     (Maybe [DocumentReviewCommentSource])
     (Maybe [DocumentReviewCommentSource])
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 AnIso
  [DocumentReviewCommentSource]
  [DocumentReviewCommentSource]
  [DocumentReviewCommentSource]
  [DocumentReviewCommentSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date and time that a reviewer entered a response to a document
-- review request.
documentReviewerResponseSource_createTime :: Lens.Lens' DocumentReviewerResponseSource (Prelude.Maybe Prelude.UTCTime)
documentReviewerResponseSource_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
documentReviewerResponseSource_createTime = (DocumentReviewerResponseSource -> Maybe POSIX)
-> (DocumentReviewerResponseSource
    -> Maybe POSIX -> DocumentReviewerResponseSource)
-> Lens
     DocumentReviewerResponseSource
     DocumentReviewerResponseSource
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentReviewerResponseSource' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:DocumentReviewerResponseSource' :: DocumentReviewerResponseSource -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: DocumentReviewerResponseSource
s@DocumentReviewerResponseSource' {} Maybe POSIX
a -> DocumentReviewerResponseSource
s {$sel:createTime:DocumentReviewerResponseSource' :: Maybe POSIX
createTime = Maybe POSIX
a} :: DocumentReviewerResponseSource) ((Maybe POSIX -> f (Maybe POSIX))
 -> DocumentReviewerResponseSource
 -> f DocumentReviewerResponseSource)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DocumentReviewerResponseSource
-> f DocumentReviewerResponseSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON DocumentReviewerResponseSource where
  parseJSON :: Value -> Parser DocumentReviewerResponseSource
parseJSON =
    String
-> (Object -> Parser DocumentReviewerResponseSource)
-> Value
-> Parser DocumentReviewerResponseSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DocumentReviewerResponseSource"
      ( \Object
x ->
          Maybe Text
-> Maybe ReviewStatus
-> Maybe POSIX
-> Maybe [DocumentReviewCommentSource]
-> Maybe POSIX
-> DocumentReviewerResponseSource
DocumentReviewerResponseSource'
            (Maybe Text
 -> Maybe ReviewStatus
 -> Maybe POSIX
 -> Maybe [DocumentReviewCommentSource]
 -> Maybe POSIX
 -> DocumentReviewerResponseSource)
-> Parser (Maybe Text)
-> Parser
     (Maybe ReviewStatus
      -> Maybe POSIX
      -> Maybe [DocumentReviewCommentSource]
      -> Maybe POSIX
      -> DocumentReviewerResponseSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Reviewer")
            Parser
  (Maybe ReviewStatus
   -> Maybe POSIX
   -> Maybe [DocumentReviewCommentSource]
   -> Maybe POSIX
   -> DocumentReviewerResponseSource)
-> Parser (Maybe ReviewStatus)
-> Parser
     (Maybe POSIX
      -> Maybe [DocumentReviewCommentSource]
      -> Maybe POSIX
      -> DocumentReviewerResponseSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReviewStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReviewStatus")
            Parser
  (Maybe POSIX
   -> Maybe [DocumentReviewCommentSource]
   -> Maybe POSIX
   -> DocumentReviewerResponseSource)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe [DocumentReviewCommentSource]
      -> Maybe POSIX -> DocumentReviewerResponseSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedTime")
            Parser
  (Maybe [DocumentReviewCommentSource]
   -> Maybe POSIX -> DocumentReviewerResponseSource)
-> Parser (Maybe [DocumentReviewCommentSource])
-> Parser (Maybe POSIX -> DocumentReviewerResponseSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (Maybe [DocumentReviewCommentSource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Comment" Parser (Maybe (Maybe [DocumentReviewCommentSource]))
-> Maybe [DocumentReviewCommentSource]
-> Parser (Maybe [DocumentReviewCommentSource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DocumentReviewCommentSource]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe POSIX -> DocumentReviewerResponseSource)
-> Parser (Maybe POSIX) -> Parser DocumentReviewerResponseSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateTime")
      )

instance
  Prelude.Hashable
    DocumentReviewerResponseSource

instance
  Prelude.NFData
    DocumentReviewerResponseSource