{-# 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.Comprehend.Types.BatchDetectSentimentItemResult
-- 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.Comprehend.Types.BatchDetectSentimentItemResult where

import Amazonka.Comprehend.Types.SentimentScore
import Amazonka.Comprehend.Types.SentimentType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The result of calling the operation. The operation returns one object
-- for each document that is successfully processed by the operation.
--
-- /See:/ 'newBatchDetectSentimentItemResult' smart constructor.
data BatchDetectSentimentItemResult = BatchDetectSentimentItemResult'
  { -- | The sentiment detected in the document.
    BatchDetectSentimentItemResult -> Maybe SentimentType
sentiment :: Prelude.Maybe SentimentType,
    -- | The level of confidence that Amazon Comprehend has in the accuracy of
    -- its sentiment detection.
    BatchDetectSentimentItemResult -> Maybe SentimentScore
sentimentScore :: Prelude.Maybe SentimentScore,
    -- | The zero-based index of the document in the input list.
    BatchDetectSentimentItemResult -> Maybe Int
index :: Prelude.Maybe Prelude.Int
  }
  deriving (BatchDetectSentimentItemResult
-> BatchDetectSentimentItemResult -> Bool
(BatchDetectSentimentItemResult
 -> BatchDetectSentimentItemResult -> Bool)
-> (BatchDetectSentimentItemResult
    -> BatchDetectSentimentItemResult -> Bool)
-> Eq BatchDetectSentimentItemResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectSentimentItemResult
-> BatchDetectSentimentItemResult -> Bool
$c/= :: BatchDetectSentimentItemResult
-> BatchDetectSentimentItemResult -> Bool
== :: BatchDetectSentimentItemResult
-> BatchDetectSentimentItemResult -> Bool
$c== :: BatchDetectSentimentItemResult
-> BatchDetectSentimentItemResult -> Bool
Prelude.Eq, ReadPrec [BatchDetectSentimentItemResult]
ReadPrec BatchDetectSentimentItemResult
Int -> ReadS BatchDetectSentimentItemResult
ReadS [BatchDetectSentimentItemResult]
(Int -> ReadS BatchDetectSentimentItemResult)
-> ReadS [BatchDetectSentimentItemResult]
-> ReadPrec BatchDetectSentimentItemResult
-> ReadPrec [BatchDetectSentimentItemResult]
-> Read BatchDetectSentimentItemResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDetectSentimentItemResult]
$creadListPrec :: ReadPrec [BatchDetectSentimentItemResult]
readPrec :: ReadPrec BatchDetectSentimentItemResult
$creadPrec :: ReadPrec BatchDetectSentimentItemResult
readList :: ReadS [BatchDetectSentimentItemResult]
$creadList :: ReadS [BatchDetectSentimentItemResult]
readsPrec :: Int -> ReadS BatchDetectSentimentItemResult
$creadsPrec :: Int -> ReadS BatchDetectSentimentItemResult
Prelude.Read, Int -> BatchDetectSentimentItemResult -> ShowS
[BatchDetectSentimentItemResult] -> ShowS
BatchDetectSentimentItemResult -> String
(Int -> BatchDetectSentimentItemResult -> ShowS)
-> (BatchDetectSentimentItemResult -> String)
-> ([BatchDetectSentimentItemResult] -> ShowS)
-> Show BatchDetectSentimentItemResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectSentimentItemResult] -> ShowS
$cshowList :: [BatchDetectSentimentItemResult] -> ShowS
show :: BatchDetectSentimentItemResult -> String
$cshow :: BatchDetectSentimentItemResult -> String
showsPrec :: Int -> BatchDetectSentimentItemResult -> ShowS
$cshowsPrec :: Int -> BatchDetectSentimentItemResult -> ShowS
Prelude.Show, (forall x.
 BatchDetectSentimentItemResult
 -> Rep BatchDetectSentimentItemResult x)
-> (forall x.
    Rep BatchDetectSentimentItemResult x
    -> BatchDetectSentimentItemResult)
-> Generic BatchDetectSentimentItemResult
forall x.
Rep BatchDetectSentimentItemResult x
-> BatchDetectSentimentItemResult
forall x.
BatchDetectSentimentItemResult
-> Rep BatchDetectSentimentItemResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectSentimentItemResult x
-> BatchDetectSentimentItemResult
$cfrom :: forall x.
BatchDetectSentimentItemResult
-> Rep BatchDetectSentimentItemResult x
Prelude.Generic)

-- |
-- Create a value of 'BatchDetectSentimentItemResult' 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:
--
-- 'sentiment', 'batchDetectSentimentItemResult_sentiment' - The sentiment detected in the document.
--
-- 'sentimentScore', 'batchDetectSentimentItemResult_sentimentScore' - The level of confidence that Amazon Comprehend has in the accuracy of
-- its sentiment detection.
--
-- 'index', 'batchDetectSentimentItemResult_index' - The zero-based index of the document in the input list.
newBatchDetectSentimentItemResult ::
  BatchDetectSentimentItemResult
newBatchDetectSentimentItemResult :: BatchDetectSentimentItemResult
newBatchDetectSentimentItemResult =
  BatchDetectSentimentItemResult' :: Maybe SentimentType
-> Maybe SentimentScore
-> Maybe Int
-> BatchDetectSentimentItemResult
BatchDetectSentimentItemResult'
    { $sel:sentiment:BatchDetectSentimentItemResult' :: Maybe SentimentType
sentiment =
        Maybe SentimentType
forall a. Maybe a
Prelude.Nothing,
      $sel:sentimentScore:BatchDetectSentimentItemResult' :: Maybe SentimentScore
sentimentScore = Maybe SentimentScore
forall a. Maybe a
Prelude.Nothing,
      $sel:index:BatchDetectSentimentItemResult' :: Maybe Int
index = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The sentiment detected in the document.
batchDetectSentimentItemResult_sentiment :: Lens.Lens' BatchDetectSentimentItemResult (Prelude.Maybe SentimentType)
batchDetectSentimentItemResult_sentiment :: (Maybe SentimentType -> f (Maybe SentimentType))
-> BatchDetectSentimentItemResult
-> f BatchDetectSentimentItemResult
batchDetectSentimentItemResult_sentiment = (BatchDetectSentimentItemResult -> Maybe SentimentType)
-> (BatchDetectSentimentItemResult
    -> Maybe SentimentType -> BatchDetectSentimentItemResult)
-> Lens
     BatchDetectSentimentItemResult
     BatchDetectSentimentItemResult
     (Maybe SentimentType)
     (Maybe SentimentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSentimentItemResult' {Maybe SentimentType
sentiment :: Maybe SentimentType
$sel:sentiment:BatchDetectSentimentItemResult' :: BatchDetectSentimentItemResult -> Maybe SentimentType
sentiment} -> Maybe SentimentType
sentiment) (\s :: BatchDetectSentimentItemResult
s@BatchDetectSentimentItemResult' {} Maybe SentimentType
a -> BatchDetectSentimentItemResult
s {$sel:sentiment:BatchDetectSentimentItemResult' :: Maybe SentimentType
sentiment = Maybe SentimentType
a} :: BatchDetectSentimentItemResult)

-- | The level of confidence that Amazon Comprehend has in the accuracy of
-- its sentiment detection.
batchDetectSentimentItemResult_sentimentScore :: Lens.Lens' BatchDetectSentimentItemResult (Prelude.Maybe SentimentScore)
batchDetectSentimentItemResult_sentimentScore :: (Maybe SentimentScore -> f (Maybe SentimentScore))
-> BatchDetectSentimentItemResult
-> f BatchDetectSentimentItemResult
batchDetectSentimentItemResult_sentimentScore = (BatchDetectSentimentItemResult -> Maybe SentimentScore)
-> (BatchDetectSentimentItemResult
    -> Maybe SentimentScore -> BatchDetectSentimentItemResult)
-> Lens
     BatchDetectSentimentItemResult
     BatchDetectSentimentItemResult
     (Maybe SentimentScore)
     (Maybe SentimentScore)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSentimentItemResult' {Maybe SentimentScore
sentimentScore :: Maybe SentimentScore
$sel:sentimentScore:BatchDetectSentimentItemResult' :: BatchDetectSentimentItemResult -> Maybe SentimentScore
sentimentScore} -> Maybe SentimentScore
sentimentScore) (\s :: BatchDetectSentimentItemResult
s@BatchDetectSentimentItemResult' {} Maybe SentimentScore
a -> BatchDetectSentimentItemResult
s {$sel:sentimentScore:BatchDetectSentimentItemResult' :: Maybe SentimentScore
sentimentScore = Maybe SentimentScore
a} :: BatchDetectSentimentItemResult)

-- | The zero-based index of the document in the input list.
batchDetectSentimentItemResult_index :: Lens.Lens' BatchDetectSentimentItemResult (Prelude.Maybe Prelude.Int)
batchDetectSentimentItemResult_index :: (Maybe Int -> f (Maybe Int))
-> BatchDetectSentimentItemResult
-> f BatchDetectSentimentItemResult
batchDetectSentimentItemResult_index = (BatchDetectSentimentItemResult -> Maybe Int)
-> (BatchDetectSentimentItemResult
    -> Maybe Int -> BatchDetectSentimentItemResult)
-> Lens
     BatchDetectSentimentItemResult
     BatchDetectSentimentItemResult
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSentimentItemResult' {Maybe Int
index :: Maybe Int
$sel:index:BatchDetectSentimentItemResult' :: BatchDetectSentimentItemResult -> Maybe Int
index} -> Maybe Int
index) (\s :: BatchDetectSentimentItemResult
s@BatchDetectSentimentItemResult' {} Maybe Int
a -> BatchDetectSentimentItemResult
s {$sel:index:BatchDetectSentimentItemResult' :: Maybe Int
index = Maybe Int
a} :: BatchDetectSentimentItemResult)

instance Core.FromJSON BatchDetectSentimentItemResult where
  parseJSON :: Value -> Parser BatchDetectSentimentItemResult
parseJSON =
    String
-> (Object -> Parser BatchDetectSentimentItemResult)
-> Value
-> Parser BatchDetectSentimentItemResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchDetectSentimentItemResult"
      ( \Object
x ->
          Maybe SentimentType
-> Maybe SentimentScore
-> Maybe Int
-> BatchDetectSentimentItemResult
BatchDetectSentimentItemResult'
            (Maybe SentimentType
 -> Maybe SentimentScore
 -> Maybe Int
 -> BatchDetectSentimentItemResult)
-> Parser (Maybe SentimentType)
-> Parser
     (Maybe SentimentScore
      -> Maybe Int -> BatchDetectSentimentItemResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SentimentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Sentiment")
            Parser
  (Maybe SentimentScore
   -> Maybe Int -> BatchDetectSentimentItemResult)
-> Parser (Maybe SentimentScore)
-> Parser (Maybe Int -> BatchDetectSentimentItemResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SentimentScore)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SentimentScore")
            Parser (Maybe Int -> BatchDetectSentimentItemResult)
-> Parser (Maybe Int) -> Parser BatchDetectSentimentItemResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Index")
      )

instance
  Prelude.Hashable
    BatchDetectSentimentItemResult

instance
  Prelude.NFData
    BatchDetectSentimentItemResult