{-# 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.LexV2Models.Types.SentimentAnalysisSettings
-- 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.LexV2Models.Types.SentimentAnalysisSettings where

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

-- | Determines whether Amazon Lex will use Amazon Comprehend to detect the
-- sentiment of user utterances.
--
-- /See:/ 'newSentimentAnalysisSettings' smart constructor.
data SentimentAnalysisSettings = SentimentAnalysisSettings'
  { -- | Sets whether Amazon Lex uses Amazon Comprehend to detect the sentiment
    -- of user utterances.
    SentimentAnalysisSettings -> Bool
detectSentiment :: Prelude.Bool
  }
  deriving (SentimentAnalysisSettings -> SentimentAnalysisSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SentimentAnalysisSettings -> SentimentAnalysisSettings -> Bool
$c/= :: SentimentAnalysisSettings -> SentimentAnalysisSettings -> Bool
== :: SentimentAnalysisSettings -> SentimentAnalysisSettings -> Bool
$c== :: SentimentAnalysisSettings -> SentimentAnalysisSettings -> Bool
Prelude.Eq, ReadPrec [SentimentAnalysisSettings]
ReadPrec SentimentAnalysisSettings
Int -> ReadS SentimentAnalysisSettings
ReadS [SentimentAnalysisSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SentimentAnalysisSettings]
$creadListPrec :: ReadPrec [SentimentAnalysisSettings]
readPrec :: ReadPrec SentimentAnalysisSettings
$creadPrec :: ReadPrec SentimentAnalysisSettings
readList :: ReadS [SentimentAnalysisSettings]
$creadList :: ReadS [SentimentAnalysisSettings]
readsPrec :: Int -> ReadS SentimentAnalysisSettings
$creadsPrec :: Int -> ReadS SentimentAnalysisSettings
Prelude.Read, Int -> SentimentAnalysisSettings -> ShowS
[SentimentAnalysisSettings] -> ShowS
SentimentAnalysisSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SentimentAnalysisSettings] -> ShowS
$cshowList :: [SentimentAnalysisSettings] -> ShowS
show :: SentimentAnalysisSettings -> String
$cshow :: SentimentAnalysisSettings -> String
showsPrec :: Int -> SentimentAnalysisSettings -> ShowS
$cshowsPrec :: Int -> SentimentAnalysisSettings -> ShowS
Prelude.Show, forall x.
Rep SentimentAnalysisSettings x -> SentimentAnalysisSettings
forall x.
SentimentAnalysisSettings -> Rep SentimentAnalysisSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SentimentAnalysisSettings x -> SentimentAnalysisSettings
$cfrom :: forall x.
SentimentAnalysisSettings -> Rep SentimentAnalysisSettings x
Prelude.Generic)

-- |
-- Create a value of 'SentimentAnalysisSettings' 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:
--
-- 'detectSentiment', 'sentimentAnalysisSettings_detectSentiment' - Sets whether Amazon Lex uses Amazon Comprehend to detect the sentiment
-- of user utterances.
newSentimentAnalysisSettings ::
  -- | 'detectSentiment'
  Prelude.Bool ->
  SentimentAnalysisSettings
newSentimentAnalysisSettings :: Bool -> SentimentAnalysisSettings
newSentimentAnalysisSettings Bool
pDetectSentiment_ =
  SentimentAnalysisSettings'
    { $sel:detectSentiment:SentimentAnalysisSettings' :: Bool
detectSentiment =
        Bool
pDetectSentiment_
    }

-- | Sets whether Amazon Lex uses Amazon Comprehend to detect the sentiment
-- of user utterances.
sentimentAnalysisSettings_detectSentiment :: Lens.Lens' SentimentAnalysisSettings Prelude.Bool
sentimentAnalysisSettings_detectSentiment :: Lens' SentimentAnalysisSettings Bool
sentimentAnalysisSettings_detectSentiment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentAnalysisSettings' {Bool
detectSentiment :: Bool
$sel:detectSentiment:SentimentAnalysisSettings' :: SentimentAnalysisSettings -> Bool
detectSentiment} -> Bool
detectSentiment) (\s :: SentimentAnalysisSettings
s@SentimentAnalysisSettings' {} Bool
a -> SentimentAnalysisSettings
s {$sel:detectSentiment:SentimentAnalysisSettings' :: Bool
detectSentiment = Bool
a} :: SentimentAnalysisSettings)

instance Data.FromJSON SentimentAnalysisSettings where
  parseJSON :: Value -> Parser SentimentAnalysisSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SentimentAnalysisSettings"
      ( \Object
x ->
          Bool -> SentimentAnalysisSettings
SentimentAnalysisSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"detectSentiment")
      )

instance Prelude.Hashable SentimentAnalysisSettings where
  hashWithSalt :: Int -> SentimentAnalysisSettings -> Int
hashWithSalt Int
_salt SentimentAnalysisSettings' {Bool
detectSentiment :: Bool
$sel:detectSentiment:SentimentAnalysisSettings' :: SentimentAnalysisSettings -> Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
detectSentiment

instance Prelude.NFData SentimentAnalysisSettings where
  rnf :: SentimentAnalysisSettings -> ()
rnf SentimentAnalysisSettings' {Bool
detectSentiment :: Bool
$sel:detectSentiment:SentimentAnalysisSettings' :: SentimentAnalysisSettings -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
detectSentiment

instance Data.ToJSON SentimentAnalysisSettings where
  toJSON :: SentimentAnalysisSettings -> Value
toJSON SentimentAnalysisSettings' {Bool
detectSentiment :: Bool
$sel:detectSentiment:SentimentAnalysisSettings' :: SentimentAnalysisSettings -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"detectSentiment" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
detectSentiment)
          ]
      )