{-# 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.CodeGuruReviewer.Types.RecommendationFeedback
-- 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.CodeGuruReviewer.Types.RecommendationFeedback where

import Amazonka.CodeGuruReviewer.Types.Reaction
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the recommendation feedback.
--
-- /See:/ 'newRecommendationFeedback' smart constructor.
data RecommendationFeedback = RecommendationFeedback'
  { -- | The recommendation ID that can be used to track the provided
    -- recommendations. Later on it can be used to collect the feedback.
    RecommendationFeedback -> Maybe Text
recommendationId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the user that made the API call.
    --
    -- The @UserId@ is an IAM principal that can be specified as an Amazon Web
    -- Services account ID or an Amazon Resource Name (ARN). For more
    -- information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#Principal_specifying Specifying a Principal>
    -- in the /Amazon Web Services Identity and Access Management User Guide/.
    RecommendationFeedback -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
    -- | List for storing reactions. Reactions are utf-8 text code for emojis.
    -- You can send an empty list to clear off all your feedback.
    RecommendationFeedback -> Maybe [Reaction]
reactions :: Prelude.Maybe [Reaction],
    -- | The Amazon Resource Name (ARN) of the
    -- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html CodeReview>
    -- object.
    RecommendationFeedback -> Maybe Text
codeReviewArn :: Prelude.Maybe Prelude.Text,
    -- | The time at which the feedback was created.
    RecommendationFeedback -> Maybe POSIX
createdTimeStamp :: Prelude.Maybe Core.POSIX,
    -- | The time at which the feedback was last updated.
    RecommendationFeedback -> Maybe POSIX
lastUpdatedTimeStamp :: Prelude.Maybe Core.POSIX
  }
  deriving (RecommendationFeedback -> RecommendationFeedback -> Bool
(RecommendationFeedback -> RecommendationFeedback -> Bool)
-> (RecommendationFeedback -> RecommendationFeedback -> Bool)
-> Eq RecommendationFeedback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationFeedback -> RecommendationFeedback -> Bool
$c/= :: RecommendationFeedback -> RecommendationFeedback -> Bool
== :: RecommendationFeedback -> RecommendationFeedback -> Bool
$c== :: RecommendationFeedback -> RecommendationFeedback -> Bool
Prelude.Eq, ReadPrec [RecommendationFeedback]
ReadPrec RecommendationFeedback
Int -> ReadS RecommendationFeedback
ReadS [RecommendationFeedback]
(Int -> ReadS RecommendationFeedback)
-> ReadS [RecommendationFeedback]
-> ReadPrec RecommendationFeedback
-> ReadPrec [RecommendationFeedback]
-> Read RecommendationFeedback
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationFeedback]
$creadListPrec :: ReadPrec [RecommendationFeedback]
readPrec :: ReadPrec RecommendationFeedback
$creadPrec :: ReadPrec RecommendationFeedback
readList :: ReadS [RecommendationFeedback]
$creadList :: ReadS [RecommendationFeedback]
readsPrec :: Int -> ReadS RecommendationFeedback
$creadsPrec :: Int -> ReadS RecommendationFeedback
Prelude.Read, Int -> RecommendationFeedback -> ShowS
[RecommendationFeedback] -> ShowS
RecommendationFeedback -> String
(Int -> RecommendationFeedback -> ShowS)
-> (RecommendationFeedback -> String)
-> ([RecommendationFeedback] -> ShowS)
-> Show RecommendationFeedback
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationFeedback] -> ShowS
$cshowList :: [RecommendationFeedback] -> ShowS
show :: RecommendationFeedback -> String
$cshow :: RecommendationFeedback -> String
showsPrec :: Int -> RecommendationFeedback -> ShowS
$cshowsPrec :: Int -> RecommendationFeedback -> ShowS
Prelude.Show, (forall x. RecommendationFeedback -> Rep RecommendationFeedback x)
-> (forall x.
    Rep RecommendationFeedback x -> RecommendationFeedback)
-> Generic RecommendationFeedback
forall x. Rep RecommendationFeedback x -> RecommendationFeedback
forall x. RecommendationFeedback -> Rep RecommendationFeedback x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecommendationFeedback x -> RecommendationFeedback
$cfrom :: forall x. RecommendationFeedback -> Rep RecommendationFeedback x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationFeedback' 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:
--
-- 'recommendationId', 'recommendationFeedback_recommendationId' - The recommendation ID that can be used to track the provided
-- recommendations. Later on it can be used to collect the feedback.
--
-- 'userId', 'recommendationFeedback_userId' - The ID of the user that made the API call.
--
-- The @UserId@ is an IAM principal that can be specified as an Amazon Web
-- Services account ID or an Amazon Resource Name (ARN). For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#Principal_specifying Specifying a Principal>
-- in the /Amazon Web Services Identity and Access Management User Guide/.
--
-- 'reactions', 'recommendationFeedback_reactions' - List for storing reactions. Reactions are utf-8 text code for emojis.
-- You can send an empty list to clear off all your feedback.
--
-- 'codeReviewArn', 'recommendationFeedback_codeReviewArn' - The Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html CodeReview>
-- object.
--
-- 'createdTimeStamp', 'recommendationFeedback_createdTimeStamp' - The time at which the feedback was created.
--
-- 'lastUpdatedTimeStamp', 'recommendationFeedback_lastUpdatedTimeStamp' - The time at which the feedback was last updated.
newRecommendationFeedback ::
  RecommendationFeedback
newRecommendationFeedback :: RecommendationFeedback
newRecommendationFeedback =
  RecommendationFeedback' :: Maybe Text
-> Maybe Text
-> Maybe [Reaction]
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> RecommendationFeedback
RecommendationFeedback'
    { $sel:recommendationId:RecommendationFeedback' :: Maybe Text
recommendationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userId:RecommendationFeedback' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reactions:RecommendationFeedback' :: Maybe [Reaction]
reactions = Maybe [Reaction]
forall a. Maybe a
Prelude.Nothing,
      $sel:codeReviewArn:RecommendationFeedback' :: Maybe Text
codeReviewArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimeStamp:RecommendationFeedback' :: Maybe POSIX
createdTimeStamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimeStamp:RecommendationFeedback' :: Maybe POSIX
lastUpdatedTimeStamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The recommendation ID that can be used to track the provided
-- recommendations. Later on it can be used to collect the feedback.
recommendationFeedback_recommendationId :: Lens.Lens' RecommendationFeedback (Prelude.Maybe Prelude.Text)
recommendationFeedback_recommendationId :: (Maybe Text -> f (Maybe Text))
-> RecommendationFeedback -> f RecommendationFeedback
recommendationFeedback_recommendationId = (RecommendationFeedback -> Maybe Text)
-> (RecommendationFeedback -> Maybe Text -> RecommendationFeedback)
-> Lens
     RecommendationFeedback
     RecommendationFeedback
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedback' {Maybe Text
recommendationId :: Maybe Text
$sel:recommendationId:RecommendationFeedback' :: RecommendationFeedback -> Maybe Text
recommendationId} -> Maybe Text
recommendationId) (\s :: RecommendationFeedback
s@RecommendationFeedback' {} Maybe Text
a -> RecommendationFeedback
s {$sel:recommendationId:RecommendationFeedback' :: Maybe Text
recommendationId = Maybe Text
a} :: RecommendationFeedback)

-- | The ID of the user that made the API call.
--
-- The @UserId@ is an IAM principal that can be specified as an Amazon Web
-- Services account ID or an Amazon Resource Name (ARN). For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#Principal_specifying Specifying a Principal>
-- in the /Amazon Web Services Identity and Access Management User Guide/.
recommendationFeedback_userId :: Lens.Lens' RecommendationFeedback (Prelude.Maybe Prelude.Text)
recommendationFeedback_userId :: (Maybe Text -> f (Maybe Text))
-> RecommendationFeedback -> f RecommendationFeedback
recommendationFeedback_userId = (RecommendationFeedback -> Maybe Text)
-> (RecommendationFeedback -> Maybe Text -> RecommendationFeedback)
-> Lens
     RecommendationFeedback
     RecommendationFeedback
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedback' {Maybe Text
userId :: Maybe Text
$sel:userId:RecommendationFeedback' :: RecommendationFeedback -> Maybe Text
userId} -> Maybe Text
userId) (\s :: RecommendationFeedback
s@RecommendationFeedback' {} Maybe Text
a -> RecommendationFeedback
s {$sel:userId:RecommendationFeedback' :: Maybe Text
userId = Maybe Text
a} :: RecommendationFeedback)

-- | List for storing reactions. Reactions are utf-8 text code for emojis.
-- You can send an empty list to clear off all your feedback.
recommendationFeedback_reactions :: Lens.Lens' RecommendationFeedback (Prelude.Maybe [Reaction])
recommendationFeedback_reactions :: (Maybe [Reaction] -> f (Maybe [Reaction]))
-> RecommendationFeedback -> f RecommendationFeedback
recommendationFeedback_reactions = (RecommendationFeedback -> Maybe [Reaction])
-> (RecommendationFeedback
    -> Maybe [Reaction] -> RecommendationFeedback)
-> Lens
     RecommendationFeedback
     RecommendationFeedback
     (Maybe [Reaction])
     (Maybe [Reaction])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedback' {Maybe [Reaction]
reactions :: Maybe [Reaction]
$sel:reactions:RecommendationFeedback' :: RecommendationFeedback -> Maybe [Reaction]
reactions} -> Maybe [Reaction]
reactions) (\s :: RecommendationFeedback
s@RecommendationFeedback' {} Maybe [Reaction]
a -> RecommendationFeedback
s {$sel:reactions:RecommendationFeedback' :: Maybe [Reaction]
reactions = Maybe [Reaction]
a} :: RecommendationFeedback) ((Maybe [Reaction] -> f (Maybe [Reaction]))
 -> RecommendationFeedback -> f RecommendationFeedback)
-> ((Maybe [Reaction] -> f (Maybe [Reaction]))
    -> Maybe [Reaction] -> f (Maybe [Reaction]))
-> (Maybe [Reaction] -> f (Maybe [Reaction]))
-> RecommendationFeedback
-> f RecommendationFeedback
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Reaction] [Reaction] [Reaction] [Reaction]
-> Iso
     (Maybe [Reaction])
     (Maybe [Reaction])
     (Maybe [Reaction])
     (Maybe [Reaction])
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 [Reaction] [Reaction] [Reaction] [Reaction]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html CodeReview>
-- object.
recommendationFeedback_codeReviewArn :: Lens.Lens' RecommendationFeedback (Prelude.Maybe Prelude.Text)
recommendationFeedback_codeReviewArn :: (Maybe Text -> f (Maybe Text))
-> RecommendationFeedback -> f RecommendationFeedback
recommendationFeedback_codeReviewArn = (RecommendationFeedback -> Maybe Text)
-> (RecommendationFeedback -> Maybe Text -> RecommendationFeedback)
-> Lens
     RecommendationFeedback
     RecommendationFeedback
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedback' {Maybe Text
codeReviewArn :: Maybe Text
$sel:codeReviewArn:RecommendationFeedback' :: RecommendationFeedback -> Maybe Text
codeReviewArn} -> Maybe Text
codeReviewArn) (\s :: RecommendationFeedback
s@RecommendationFeedback' {} Maybe Text
a -> RecommendationFeedback
s {$sel:codeReviewArn:RecommendationFeedback' :: Maybe Text
codeReviewArn = Maybe Text
a} :: RecommendationFeedback)

-- | The time at which the feedback was created.
recommendationFeedback_createdTimeStamp :: Lens.Lens' RecommendationFeedback (Prelude.Maybe Prelude.UTCTime)
recommendationFeedback_createdTimeStamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationFeedback -> f RecommendationFeedback
recommendationFeedback_createdTimeStamp = (RecommendationFeedback -> Maybe POSIX)
-> (RecommendationFeedback
    -> Maybe POSIX -> RecommendationFeedback)
-> Lens
     RecommendationFeedback
     RecommendationFeedback
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedback' {Maybe POSIX
createdTimeStamp :: Maybe POSIX
$sel:createdTimeStamp:RecommendationFeedback' :: RecommendationFeedback -> Maybe POSIX
createdTimeStamp} -> Maybe POSIX
createdTimeStamp) (\s :: RecommendationFeedback
s@RecommendationFeedback' {} Maybe POSIX
a -> RecommendationFeedback
s {$sel:createdTimeStamp:RecommendationFeedback' :: Maybe POSIX
createdTimeStamp = Maybe POSIX
a} :: RecommendationFeedback) ((Maybe POSIX -> f (Maybe POSIX))
 -> RecommendationFeedback -> f RecommendationFeedback)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationFeedback
-> f RecommendationFeedback
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 time at which the feedback was last updated.
recommendationFeedback_lastUpdatedTimeStamp :: Lens.Lens' RecommendationFeedback (Prelude.Maybe Prelude.UTCTime)
recommendationFeedback_lastUpdatedTimeStamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationFeedback -> f RecommendationFeedback
recommendationFeedback_lastUpdatedTimeStamp = (RecommendationFeedback -> Maybe POSIX)
-> (RecommendationFeedback
    -> Maybe POSIX -> RecommendationFeedback)
-> Lens
     RecommendationFeedback
     RecommendationFeedback
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedback' {Maybe POSIX
lastUpdatedTimeStamp :: Maybe POSIX
$sel:lastUpdatedTimeStamp:RecommendationFeedback' :: RecommendationFeedback -> Maybe POSIX
lastUpdatedTimeStamp} -> Maybe POSIX
lastUpdatedTimeStamp) (\s :: RecommendationFeedback
s@RecommendationFeedback' {} Maybe POSIX
a -> RecommendationFeedback
s {$sel:lastUpdatedTimeStamp:RecommendationFeedback' :: Maybe POSIX
lastUpdatedTimeStamp = Maybe POSIX
a} :: RecommendationFeedback) ((Maybe POSIX -> f (Maybe POSIX))
 -> RecommendationFeedback -> f RecommendationFeedback)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationFeedback
-> f RecommendationFeedback
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 RecommendationFeedback where
  parseJSON :: Value -> Parser RecommendationFeedback
parseJSON =
    String
-> (Object -> Parser RecommendationFeedback)
-> Value
-> Parser RecommendationFeedback
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecommendationFeedback"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [Reaction]
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> RecommendationFeedback
RecommendationFeedback'
            (Maybe Text
 -> Maybe Text
 -> Maybe [Reaction]
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> RecommendationFeedback)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Reaction]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> RecommendationFeedback)
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
"RecommendationId")
            Parser
  (Maybe Text
   -> Maybe [Reaction]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> RecommendationFeedback)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Reaction]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> RecommendationFeedback)
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
"UserId")
            Parser
  (Maybe [Reaction]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> RecommendationFeedback)
-> Parser (Maybe [Reaction])
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe POSIX -> RecommendationFeedback)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Reaction]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Reactions" Parser (Maybe (Maybe [Reaction]))
-> Maybe [Reaction] -> Parser (Maybe [Reaction])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Reaction]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe POSIX -> RecommendationFeedback)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe POSIX -> RecommendationFeedback)
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
"CodeReviewArn")
            Parser (Maybe POSIX -> Maybe POSIX -> RecommendationFeedback)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> RecommendationFeedback)
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
"CreatedTimeStamp")
            Parser (Maybe POSIX -> RecommendationFeedback)
-> Parser (Maybe POSIX) -> Parser RecommendationFeedback
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
"LastUpdatedTimeStamp")
      )

instance Prelude.Hashable RecommendationFeedback

instance Prelude.NFData RecommendationFeedback