{-# 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.RecommendationFeedbackSummary
-- 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.RecommendationFeedbackSummary 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 recommendation feedback summaries.
--
-- /See:/ 'newRecommendationFeedbackSummary' smart constructor.
data RecommendationFeedbackSummary = RecommendationFeedbackSummary'
  { -- | The recommendation ID that can be used to track the provided
    -- recommendations. Later on it can be used to collect the feedback.
    RecommendationFeedbackSummary -> Maybe Text
recommendationId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the user that gave the feedback.
    --
    -- 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/.
    RecommendationFeedbackSummary -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
    -- | List for storing reactions. Reactions are utf-8 text code for emojis.
    RecommendationFeedbackSummary -> Maybe [Reaction]
reactions :: Prelude.Maybe [Reaction]
  }
  deriving (RecommendationFeedbackSummary
-> RecommendationFeedbackSummary -> Bool
(RecommendationFeedbackSummary
 -> RecommendationFeedbackSummary -> Bool)
-> (RecommendationFeedbackSummary
    -> RecommendationFeedbackSummary -> Bool)
-> Eq RecommendationFeedbackSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationFeedbackSummary
-> RecommendationFeedbackSummary -> Bool
$c/= :: RecommendationFeedbackSummary
-> RecommendationFeedbackSummary -> Bool
== :: RecommendationFeedbackSummary
-> RecommendationFeedbackSummary -> Bool
$c== :: RecommendationFeedbackSummary
-> RecommendationFeedbackSummary -> Bool
Prelude.Eq, ReadPrec [RecommendationFeedbackSummary]
ReadPrec RecommendationFeedbackSummary
Int -> ReadS RecommendationFeedbackSummary
ReadS [RecommendationFeedbackSummary]
(Int -> ReadS RecommendationFeedbackSummary)
-> ReadS [RecommendationFeedbackSummary]
-> ReadPrec RecommendationFeedbackSummary
-> ReadPrec [RecommendationFeedbackSummary]
-> Read RecommendationFeedbackSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationFeedbackSummary]
$creadListPrec :: ReadPrec [RecommendationFeedbackSummary]
readPrec :: ReadPrec RecommendationFeedbackSummary
$creadPrec :: ReadPrec RecommendationFeedbackSummary
readList :: ReadS [RecommendationFeedbackSummary]
$creadList :: ReadS [RecommendationFeedbackSummary]
readsPrec :: Int -> ReadS RecommendationFeedbackSummary
$creadsPrec :: Int -> ReadS RecommendationFeedbackSummary
Prelude.Read, Int -> RecommendationFeedbackSummary -> ShowS
[RecommendationFeedbackSummary] -> ShowS
RecommendationFeedbackSummary -> String
(Int -> RecommendationFeedbackSummary -> ShowS)
-> (RecommendationFeedbackSummary -> String)
-> ([RecommendationFeedbackSummary] -> ShowS)
-> Show RecommendationFeedbackSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationFeedbackSummary] -> ShowS
$cshowList :: [RecommendationFeedbackSummary] -> ShowS
show :: RecommendationFeedbackSummary -> String
$cshow :: RecommendationFeedbackSummary -> String
showsPrec :: Int -> RecommendationFeedbackSummary -> ShowS
$cshowsPrec :: Int -> RecommendationFeedbackSummary -> ShowS
Prelude.Show, (forall x.
 RecommendationFeedbackSummary
 -> Rep RecommendationFeedbackSummary x)
-> (forall x.
    Rep RecommendationFeedbackSummary x
    -> RecommendationFeedbackSummary)
-> Generic RecommendationFeedbackSummary
forall x.
Rep RecommendationFeedbackSummary x
-> RecommendationFeedbackSummary
forall x.
RecommendationFeedbackSummary
-> Rep RecommendationFeedbackSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecommendationFeedbackSummary x
-> RecommendationFeedbackSummary
$cfrom :: forall x.
RecommendationFeedbackSummary
-> Rep RecommendationFeedbackSummary x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationFeedbackSummary' 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', 'recommendationFeedbackSummary_recommendationId' - The recommendation ID that can be used to track the provided
-- recommendations. Later on it can be used to collect the feedback.
--
-- 'userId', 'recommendationFeedbackSummary_userId' - The ID of the user that gave the feedback.
--
-- 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', 'recommendationFeedbackSummary_reactions' - List for storing reactions. Reactions are utf-8 text code for emojis.
newRecommendationFeedbackSummary ::
  RecommendationFeedbackSummary
newRecommendationFeedbackSummary :: RecommendationFeedbackSummary
newRecommendationFeedbackSummary =
  RecommendationFeedbackSummary' :: Maybe Text
-> Maybe Text -> Maybe [Reaction] -> RecommendationFeedbackSummary
RecommendationFeedbackSummary'
    { $sel:recommendationId:RecommendationFeedbackSummary' :: Maybe Text
recommendationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userId:RecommendationFeedbackSummary' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reactions:RecommendationFeedbackSummary' :: Maybe [Reaction]
reactions = Maybe [Reaction]
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.
recommendationFeedbackSummary_recommendationId :: Lens.Lens' RecommendationFeedbackSummary (Prelude.Maybe Prelude.Text)
recommendationFeedbackSummary_recommendationId :: (Maybe Text -> f (Maybe Text))
-> RecommendationFeedbackSummary -> f RecommendationFeedbackSummary
recommendationFeedbackSummary_recommendationId = (RecommendationFeedbackSummary -> Maybe Text)
-> (RecommendationFeedbackSummary
    -> Maybe Text -> RecommendationFeedbackSummary)
-> Lens
     RecommendationFeedbackSummary
     RecommendationFeedbackSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedbackSummary' {Maybe Text
recommendationId :: Maybe Text
$sel:recommendationId:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe Text
recommendationId} -> Maybe Text
recommendationId) (\s :: RecommendationFeedbackSummary
s@RecommendationFeedbackSummary' {} Maybe Text
a -> RecommendationFeedbackSummary
s {$sel:recommendationId:RecommendationFeedbackSummary' :: Maybe Text
recommendationId = Maybe Text
a} :: RecommendationFeedbackSummary)

-- | The ID of the user that gave the feedback.
--
-- 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/.
recommendationFeedbackSummary_userId :: Lens.Lens' RecommendationFeedbackSummary (Prelude.Maybe Prelude.Text)
recommendationFeedbackSummary_userId :: (Maybe Text -> f (Maybe Text))
-> RecommendationFeedbackSummary -> f RecommendationFeedbackSummary
recommendationFeedbackSummary_userId = (RecommendationFeedbackSummary -> Maybe Text)
-> (RecommendationFeedbackSummary
    -> Maybe Text -> RecommendationFeedbackSummary)
-> Lens
     RecommendationFeedbackSummary
     RecommendationFeedbackSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedbackSummary' {Maybe Text
userId :: Maybe Text
$sel:userId:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe Text
userId} -> Maybe Text
userId) (\s :: RecommendationFeedbackSummary
s@RecommendationFeedbackSummary' {} Maybe Text
a -> RecommendationFeedbackSummary
s {$sel:userId:RecommendationFeedbackSummary' :: Maybe Text
userId = Maybe Text
a} :: RecommendationFeedbackSummary)

-- | List for storing reactions. Reactions are utf-8 text code for emojis.
recommendationFeedbackSummary_reactions :: Lens.Lens' RecommendationFeedbackSummary (Prelude.Maybe [Reaction])
recommendationFeedbackSummary_reactions :: (Maybe [Reaction] -> f (Maybe [Reaction]))
-> RecommendationFeedbackSummary -> f RecommendationFeedbackSummary
recommendationFeedbackSummary_reactions = (RecommendationFeedbackSummary -> Maybe [Reaction])
-> (RecommendationFeedbackSummary
    -> Maybe [Reaction] -> RecommendationFeedbackSummary)
-> Lens
     RecommendationFeedbackSummary
     RecommendationFeedbackSummary
     (Maybe [Reaction])
     (Maybe [Reaction])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationFeedbackSummary' {Maybe [Reaction]
reactions :: Maybe [Reaction]
$sel:reactions:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe [Reaction]
reactions} -> Maybe [Reaction]
reactions) (\s :: RecommendationFeedbackSummary
s@RecommendationFeedbackSummary' {} Maybe [Reaction]
a -> RecommendationFeedbackSummary
s {$sel:reactions:RecommendationFeedbackSummary' :: Maybe [Reaction]
reactions = Maybe [Reaction]
a} :: RecommendationFeedbackSummary) ((Maybe [Reaction] -> f (Maybe [Reaction]))
 -> RecommendationFeedbackSummary
 -> f RecommendationFeedbackSummary)
-> ((Maybe [Reaction] -> f (Maybe [Reaction]))
    -> Maybe [Reaction] -> f (Maybe [Reaction]))
-> (Maybe [Reaction] -> f (Maybe [Reaction]))
-> RecommendationFeedbackSummary
-> f RecommendationFeedbackSummary
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

instance Core.FromJSON RecommendationFeedbackSummary where
  parseJSON :: Value -> Parser RecommendationFeedbackSummary
parseJSON =
    String
-> (Object -> Parser RecommendationFeedbackSummary)
-> Value
-> Parser RecommendationFeedbackSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecommendationFeedbackSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe [Reaction] -> RecommendationFeedbackSummary
RecommendationFeedbackSummary'
            (Maybe Text
 -> Maybe Text -> Maybe [Reaction] -> RecommendationFeedbackSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe [Reaction] -> RecommendationFeedbackSummary)
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] -> RecommendationFeedbackSummary)
-> Parser (Maybe Text)
-> Parser (Maybe [Reaction] -> RecommendationFeedbackSummary)
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] -> RecommendationFeedbackSummary)
-> Parser (Maybe [Reaction])
-> Parser RecommendationFeedbackSummary
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)
      )

instance
  Prelude.Hashable
    RecommendationFeedbackSummary

instance Prelude.NFData RecommendationFeedbackSummary