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

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

-- | Information about the result of a document review request.
--
-- /See:/ 'newReviewInformation' smart constructor.
data ReviewInformation = ReviewInformation'
  { -- | The current status of the document review request.
    ReviewInformation -> Maybe ReviewStatus
status :: Prelude.Maybe ReviewStatus,
    -- | The reviewer assigned to take action on the document review request.
    ReviewInformation -> Maybe Text
reviewer :: Prelude.Maybe Prelude.Text,
    -- | The time that the reviewer took action on the document review request.
    ReviewInformation -> Maybe POSIX
reviewedTime :: Prelude.Maybe Core.POSIX
  }
  deriving (ReviewInformation -> ReviewInformation -> Bool
(ReviewInformation -> ReviewInformation -> Bool)
-> (ReviewInformation -> ReviewInformation -> Bool)
-> Eq ReviewInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReviewInformation -> ReviewInformation -> Bool
$c/= :: ReviewInformation -> ReviewInformation -> Bool
== :: ReviewInformation -> ReviewInformation -> Bool
$c== :: ReviewInformation -> ReviewInformation -> Bool
Prelude.Eq, ReadPrec [ReviewInformation]
ReadPrec ReviewInformation
Int -> ReadS ReviewInformation
ReadS [ReviewInformation]
(Int -> ReadS ReviewInformation)
-> ReadS [ReviewInformation]
-> ReadPrec ReviewInformation
-> ReadPrec [ReviewInformation]
-> Read ReviewInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReviewInformation]
$creadListPrec :: ReadPrec [ReviewInformation]
readPrec :: ReadPrec ReviewInformation
$creadPrec :: ReadPrec ReviewInformation
readList :: ReadS [ReviewInformation]
$creadList :: ReadS [ReviewInformation]
readsPrec :: Int -> ReadS ReviewInformation
$creadsPrec :: Int -> ReadS ReviewInformation
Prelude.Read, Int -> ReviewInformation -> ShowS
[ReviewInformation] -> ShowS
ReviewInformation -> String
(Int -> ReviewInformation -> ShowS)
-> (ReviewInformation -> String)
-> ([ReviewInformation] -> ShowS)
-> Show ReviewInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReviewInformation] -> ShowS
$cshowList :: [ReviewInformation] -> ShowS
show :: ReviewInformation -> String
$cshow :: ReviewInformation -> String
showsPrec :: Int -> ReviewInformation -> ShowS
$cshowsPrec :: Int -> ReviewInformation -> ShowS
Prelude.Show, (forall x. ReviewInformation -> Rep ReviewInformation x)
-> (forall x. Rep ReviewInformation x -> ReviewInformation)
-> Generic ReviewInformation
forall x. Rep ReviewInformation x -> ReviewInformation
forall x. ReviewInformation -> Rep ReviewInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReviewInformation x -> ReviewInformation
$cfrom :: forall x. ReviewInformation -> Rep ReviewInformation x
Prelude.Generic)

-- |
-- Create a value of 'ReviewInformation' 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:
--
-- 'status', 'reviewInformation_status' - The current status of the document review request.
--
-- 'reviewer', 'reviewInformation_reviewer' - The reviewer assigned to take action on the document review request.
--
-- 'reviewedTime', 'reviewInformation_reviewedTime' - The time that the reviewer took action on the document review request.
newReviewInformation ::
  ReviewInformation
newReviewInformation :: ReviewInformation
newReviewInformation =
  ReviewInformation' :: Maybe ReviewStatus
-> Maybe Text -> Maybe POSIX -> ReviewInformation
ReviewInformation'
    { $sel:status:ReviewInformation' :: Maybe ReviewStatus
status = Maybe ReviewStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:reviewer:ReviewInformation' :: Maybe Text
reviewer = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reviewedTime:ReviewInformation' :: Maybe POSIX
reviewedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The current status of the document review request.
reviewInformation_status :: Lens.Lens' ReviewInformation (Prelude.Maybe ReviewStatus)
reviewInformation_status :: (Maybe ReviewStatus -> f (Maybe ReviewStatus))
-> ReviewInformation -> f ReviewInformation
reviewInformation_status = (ReviewInformation -> Maybe ReviewStatus)
-> (ReviewInformation -> Maybe ReviewStatus -> ReviewInformation)
-> Lens
     ReviewInformation
     ReviewInformation
     (Maybe ReviewStatus)
     (Maybe ReviewStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewInformation' {Maybe ReviewStatus
status :: Maybe ReviewStatus
$sel:status:ReviewInformation' :: ReviewInformation -> Maybe ReviewStatus
status} -> Maybe ReviewStatus
status) (\s :: ReviewInformation
s@ReviewInformation' {} Maybe ReviewStatus
a -> ReviewInformation
s {$sel:status:ReviewInformation' :: Maybe ReviewStatus
status = Maybe ReviewStatus
a} :: ReviewInformation)

-- | The reviewer assigned to take action on the document review request.
reviewInformation_reviewer :: Lens.Lens' ReviewInformation (Prelude.Maybe Prelude.Text)
reviewInformation_reviewer :: (Maybe Text -> f (Maybe Text))
-> ReviewInformation -> f ReviewInformation
reviewInformation_reviewer = (ReviewInformation -> Maybe Text)
-> (ReviewInformation -> Maybe Text -> ReviewInformation)
-> Lens
     ReviewInformation ReviewInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewInformation' {Maybe Text
reviewer :: Maybe Text
$sel:reviewer:ReviewInformation' :: ReviewInformation -> Maybe Text
reviewer} -> Maybe Text
reviewer) (\s :: ReviewInformation
s@ReviewInformation' {} Maybe Text
a -> ReviewInformation
s {$sel:reviewer:ReviewInformation' :: Maybe Text
reviewer = Maybe Text
a} :: ReviewInformation)

-- | The time that the reviewer took action on the document review request.
reviewInformation_reviewedTime :: Lens.Lens' ReviewInformation (Prelude.Maybe Prelude.UTCTime)
reviewInformation_reviewedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReviewInformation -> f ReviewInformation
reviewInformation_reviewedTime = (ReviewInformation -> Maybe POSIX)
-> (ReviewInformation -> Maybe POSIX -> ReviewInformation)
-> Lens
     ReviewInformation ReviewInformation (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewInformation' {Maybe POSIX
reviewedTime :: Maybe POSIX
$sel:reviewedTime:ReviewInformation' :: ReviewInformation -> Maybe POSIX
reviewedTime} -> Maybe POSIX
reviewedTime) (\s :: ReviewInformation
s@ReviewInformation' {} Maybe POSIX
a -> ReviewInformation
s {$sel:reviewedTime:ReviewInformation' :: Maybe POSIX
reviewedTime = Maybe POSIX
a} :: ReviewInformation) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReviewInformation -> f ReviewInformation)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReviewInformation
-> f ReviewInformation
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 ReviewInformation where
  parseJSON :: Value -> Parser ReviewInformation
parseJSON =
    String
-> (Object -> Parser ReviewInformation)
-> Value
-> Parser ReviewInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReviewInformation"
      ( \Object
x ->
          Maybe ReviewStatus
-> Maybe Text -> Maybe POSIX -> ReviewInformation
ReviewInformation'
            (Maybe ReviewStatus
 -> Maybe Text -> Maybe POSIX -> ReviewInformation)
-> Parser (Maybe ReviewStatus)
-> Parser (Maybe Text -> Maybe POSIX -> ReviewInformation)
forall (f :: * -> *) a b. Functor 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
"Status")
            Parser (Maybe Text -> Maybe POSIX -> ReviewInformation)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> ReviewInformation)
forall (f :: * -> *) a b. Applicative f => 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 POSIX -> ReviewInformation)
-> Parser (Maybe POSIX) -> Parser ReviewInformation
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
"ReviewedTime")
      )

instance Prelude.Hashable ReviewInformation

instance Prelude.NFData ReviewInformation