{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information about recommendation feedback summaries.
--
-- /See:/ 'newRecommendationFeedbackSummary' smart constructor.
data RecommendationFeedbackSummary = RecommendationFeedbackSummary'
  { -- | List for storing reactions. Reactions are utf-8 text code for emojis.
    RecommendationFeedbackSummary -> Maybe [Reaction]
reactions :: Prelude.Maybe [Reaction],
    -- | 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
  }
  deriving (RecommendationFeedbackSummary
-> RecommendationFeedbackSummary -> Bool
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]
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
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.
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:
--
-- 'reactions', 'recommendationFeedbackSummary_reactions' - List for storing reactions. Reactions are utf-8 text code for emojis.
--
-- '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/.
newRecommendationFeedbackSummary ::
  RecommendationFeedbackSummary
newRecommendationFeedbackSummary :: RecommendationFeedbackSummary
newRecommendationFeedbackSummary =
  RecommendationFeedbackSummary'
    { $sel:reactions:RecommendationFeedbackSummary' :: Maybe [Reaction]
reactions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recommendationId:RecommendationFeedbackSummary' :: Maybe Text
recommendationId = forall a. Maybe a
Prelude.Nothing,
      $sel:userId:RecommendationFeedbackSummary' :: Maybe Text
userId = forall a. Maybe a
Prelude.Nothing
    }

-- | List for storing reactions. Reactions are utf-8 text code for emojis.
recommendationFeedbackSummary_reactions :: Lens.Lens' RecommendationFeedbackSummary (Prelude.Maybe [Reaction])
recommendationFeedbackSummary_reactions :: Lens' RecommendationFeedbackSummary (Maybe [Reaction])
recommendationFeedbackSummary_reactions = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' RecommendationFeedbackSummary (Maybe Text)
recommendationFeedbackSummary_recommendationId = 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 :: Lens' RecommendationFeedbackSummary (Maybe Text)
recommendationFeedbackSummary_userId = 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)

instance Data.FromJSON RecommendationFeedbackSummary where
  parseJSON :: Value -> Parser RecommendationFeedbackSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecommendationFeedbackSummary"
      ( \Object
x ->
          Maybe [Reaction]
-> Maybe Text -> Maybe Text -> RecommendationFeedbackSummary
RecommendationFeedbackSummary'
            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
"Reactions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"RecommendationId")
            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
"UserId")
      )

instance
  Prelude.Hashable
    RecommendationFeedbackSummary
  where
  hashWithSalt :: Int -> RecommendationFeedbackSummary -> Int
hashWithSalt Int
_salt RecommendationFeedbackSummary' {Maybe [Reaction]
Maybe Text
userId :: Maybe Text
recommendationId :: Maybe Text
reactions :: Maybe [Reaction]
$sel:userId:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe Text
$sel:recommendationId:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe Text
$sel:reactions:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe [Reaction]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Reaction]
reactions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recommendationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
userId

instance Prelude.NFData RecommendationFeedbackSummary where
  rnf :: RecommendationFeedbackSummary -> ()
rnf RecommendationFeedbackSummary' {Maybe [Reaction]
Maybe Text
userId :: Maybe Text
recommendationId :: Maybe Text
reactions :: Maybe [Reaction]
$sel:userId:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe Text
$sel:recommendationId:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe Text
$sel:reactions:RecommendationFeedbackSummary' :: RecommendationFeedbackSummary -> Maybe [Reaction]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Reaction]
reactions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recommendationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userId