{-# 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.CodeGuruProfiler.Types.UserFeedback
-- 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.CodeGuruProfiler.Types.UserFeedback where

import Amazonka.CodeGuruProfiler.Types.FeedbackType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Feedback that can be submitted for each instance of an anomaly by the
-- user. Feedback is be used for improvements in generating recommendations
-- for the application.
--
-- /See:/ 'newUserFeedback' smart constructor.
data UserFeedback = UserFeedback'
  { -- | Optional @Positive@ or @Negative@ feedback submitted by the user about
    -- whether the recommendation is useful or not.
    UserFeedback -> FeedbackType
type' :: FeedbackType
  }
  deriving (UserFeedback -> UserFeedback -> Bool
(UserFeedback -> UserFeedback -> Bool)
-> (UserFeedback -> UserFeedback -> Bool) -> Eq UserFeedback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserFeedback -> UserFeedback -> Bool
$c/= :: UserFeedback -> UserFeedback -> Bool
== :: UserFeedback -> UserFeedback -> Bool
$c== :: UserFeedback -> UserFeedback -> Bool
Prelude.Eq, ReadPrec [UserFeedback]
ReadPrec UserFeedback
Int -> ReadS UserFeedback
ReadS [UserFeedback]
(Int -> ReadS UserFeedback)
-> ReadS [UserFeedback]
-> ReadPrec UserFeedback
-> ReadPrec [UserFeedback]
-> Read UserFeedback
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserFeedback]
$creadListPrec :: ReadPrec [UserFeedback]
readPrec :: ReadPrec UserFeedback
$creadPrec :: ReadPrec UserFeedback
readList :: ReadS [UserFeedback]
$creadList :: ReadS [UserFeedback]
readsPrec :: Int -> ReadS UserFeedback
$creadsPrec :: Int -> ReadS UserFeedback
Prelude.Read, Int -> UserFeedback -> ShowS
[UserFeedback] -> ShowS
UserFeedback -> String
(Int -> UserFeedback -> ShowS)
-> (UserFeedback -> String)
-> ([UserFeedback] -> ShowS)
-> Show UserFeedback
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserFeedback] -> ShowS
$cshowList :: [UserFeedback] -> ShowS
show :: UserFeedback -> String
$cshow :: UserFeedback -> String
showsPrec :: Int -> UserFeedback -> ShowS
$cshowsPrec :: Int -> UserFeedback -> ShowS
Prelude.Show, (forall x. UserFeedback -> Rep UserFeedback x)
-> (forall x. Rep UserFeedback x -> UserFeedback)
-> Generic UserFeedback
forall x. Rep UserFeedback x -> UserFeedback
forall x. UserFeedback -> Rep UserFeedback x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserFeedback x -> UserFeedback
$cfrom :: forall x. UserFeedback -> Rep UserFeedback x
Prelude.Generic)

-- |
-- Create a value of 'UserFeedback' 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:
--
-- 'type'', 'userFeedback_type' - Optional @Positive@ or @Negative@ feedback submitted by the user about
-- whether the recommendation is useful or not.
newUserFeedback ::
  -- | 'type''
  FeedbackType ->
  UserFeedback
newUserFeedback :: FeedbackType -> UserFeedback
newUserFeedback FeedbackType
pType_ =
  UserFeedback' :: FeedbackType -> UserFeedback
UserFeedback' {$sel:type':UserFeedback' :: FeedbackType
type' = FeedbackType
pType_}

-- | Optional @Positive@ or @Negative@ feedback submitted by the user about
-- whether the recommendation is useful or not.
userFeedback_type :: Lens.Lens' UserFeedback FeedbackType
userFeedback_type :: (FeedbackType -> f FeedbackType) -> UserFeedback -> f UserFeedback
userFeedback_type = (UserFeedback -> FeedbackType)
-> (UserFeedback -> FeedbackType -> UserFeedback)
-> Lens UserFeedback UserFeedback FeedbackType FeedbackType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserFeedback' {FeedbackType
type' :: FeedbackType
$sel:type':UserFeedback' :: UserFeedback -> FeedbackType
type'} -> FeedbackType
type') (\s :: UserFeedback
s@UserFeedback' {} FeedbackType
a -> UserFeedback
s {$sel:type':UserFeedback' :: FeedbackType
type' = FeedbackType
a} :: UserFeedback)

instance Core.FromJSON UserFeedback where
  parseJSON :: Value -> Parser UserFeedback
parseJSON =
    String
-> (Object -> Parser UserFeedback) -> Value -> Parser UserFeedback
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserFeedback"
      (\Object
x -> FeedbackType -> UserFeedback
UserFeedback' (FeedbackType -> UserFeedback)
-> Parser FeedbackType -> Parser UserFeedback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser FeedbackType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type"))

instance Prelude.Hashable UserFeedback

instance Prelude.NFData UserFeedback