{-# 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.BatchDetectKeyPhrasesItemResult
-- 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.BatchDetectKeyPhrasesItemResult where

import Amazonka.Comprehend.Types.KeyPhrase
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:/ 'newBatchDetectKeyPhrasesItemResult' smart constructor.
data BatchDetectKeyPhrasesItemResult = BatchDetectKeyPhrasesItemResult'
  { -- | The zero-based index of the document in the input list.
    BatchDetectKeyPhrasesItemResult -> Maybe Int
index :: Prelude.Maybe Prelude.Int,
    -- | One or more KeyPhrase objects, one for each key phrase detected in the
    -- document.
    BatchDetectKeyPhrasesItemResult -> Maybe [KeyPhrase]
keyPhrases :: Prelude.Maybe [KeyPhrase]
  }
  deriving (BatchDetectKeyPhrasesItemResult
-> BatchDetectKeyPhrasesItemResult -> Bool
(BatchDetectKeyPhrasesItemResult
 -> BatchDetectKeyPhrasesItemResult -> Bool)
-> (BatchDetectKeyPhrasesItemResult
    -> BatchDetectKeyPhrasesItemResult -> Bool)
-> Eq BatchDetectKeyPhrasesItemResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectKeyPhrasesItemResult
-> BatchDetectKeyPhrasesItemResult -> Bool
$c/= :: BatchDetectKeyPhrasesItemResult
-> BatchDetectKeyPhrasesItemResult -> Bool
== :: BatchDetectKeyPhrasesItemResult
-> BatchDetectKeyPhrasesItemResult -> Bool
$c== :: BatchDetectKeyPhrasesItemResult
-> BatchDetectKeyPhrasesItemResult -> Bool
Prelude.Eq, ReadPrec [BatchDetectKeyPhrasesItemResult]
ReadPrec BatchDetectKeyPhrasesItemResult
Int -> ReadS BatchDetectKeyPhrasesItemResult
ReadS [BatchDetectKeyPhrasesItemResult]
(Int -> ReadS BatchDetectKeyPhrasesItemResult)
-> ReadS [BatchDetectKeyPhrasesItemResult]
-> ReadPrec BatchDetectKeyPhrasesItemResult
-> ReadPrec [BatchDetectKeyPhrasesItemResult]
-> Read BatchDetectKeyPhrasesItemResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDetectKeyPhrasesItemResult]
$creadListPrec :: ReadPrec [BatchDetectKeyPhrasesItemResult]
readPrec :: ReadPrec BatchDetectKeyPhrasesItemResult
$creadPrec :: ReadPrec BatchDetectKeyPhrasesItemResult
readList :: ReadS [BatchDetectKeyPhrasesItemResult]
$creadList :: ReadS [BatchDetectKeyPhrasesItemResult]
readsPrec :: Int -> ReadS BatchDetectKeyPhrasesItemResult
$creadsPrec :: Int -> ReadS BatchDetectKeyPhrasesItemResult
Prelude.Read, Int -> BatchDetectKeyPhrasesItemResult -> ShowS
[BatchDetectKeyPhrasesItemResult] -> ShowS
BatchDetectKeyPhrasesItemResult -> String
(Int -> BatchDetectKeyPhrasesItemResult -> ShowS)
-> (BatchDetectKeyPhrasesItemResult -> String)
-> ([BatchDetectKeyPhrasesItemResult] -> ShowS)
-> Show BatchDetectKeyPhrasesItemResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectKeyPhrasesItemResult] -> ShowS
$cshowList :: [BatchDetectKeyPhrasesItemResult] -> ShowS
show :: BatchDetectKeyPhrasesItemResult -> String
$cshow :: BatchDetectKeyPhrasesItemResult -> String
showsPrec :: Int -> BatchDetectKeyPhrasesItemResult -> ShowS
$cshowsPrec :: Int -> BatchDetectKeyPhrasesItemResult -> ShowS
Prelude.Show, (forall x.
 BatchDetectKeyPhrasesItemResult
 -> Rep BatchDetectKeyPhrasesItemResult x)
-> (forall x.
    Rep BatchDetectKeyPhrasesItemResult x
    -> BatchDetectKeyPhrasesItemResult)
-> Generic BatchDetectKeyPhrasesItemResult
forall x.
Rep BatchDetectKeyPhrasesItemResult x
-> BatchDetectKeyPhrasesItemResult
forall x.
BatchDetectKeyPhrasesItemResult
-> Rep BatchDetectKeyPhrasesItemResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectKeyPhrasesItemResult x
-> BatchDetectKeyPhrasesItemResult
$cfrom :: forall x.
BatchDetectKeyPhrasesItemResult
-> Rep BatchDetectKeyPhrasesItemResult x
Prelude.Generic)

-- |
-- Create a value of 'BatchDetectKeyPhrasesItemResult' 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:
--
-- 'index', 'batchDetectKeyPhrasesItemResult_index' - The zero-based index of the document in the input list.
--
-- 'keyPhrases', 'batchDetectKeyPhrasesItemResult_keyPhrases' - One or more KeyPhrase objects, one for each key phrase detected in the
-- document.
newBatchDetectKeyPhrasesItemResult ::
  BatchDetectKeyPhrasesItemResult
newBatchDetectKeyPhrasesItemResult :: BatchDetectKeyPhrasesItemResult
newBatchDetectKeyPhrasesItemResult =
  BatchDetectKeyPhrasesItemResult' :: Maybe Int -> Maybe [KeyPhrase] -> BatchDetectKeyPhrasesItemResult
BatchDetectKeyPhrasesItemResult'
    { $sel:index:BatchDetectKeyPhrasesItemResult' :: Maybe Int
index =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:keyPhrases:BatchDetectKeyPhrasesItemResult' :: Maybe [KeyPhrase]
keyPhrases = Maybe [KeyPhrase]
forall a. Maybe a
Prelude.Nothing
    }

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

-- | One or more KeyPhrase objects, one for each key phrase detected in the
-- document.
batchDetectKeyPhrasesItemResult_keyPhrases :: Lens.Lens' BatchDetectKeyPhrasesItemResult (Prelude.Maybe [KeyPhrase])
batchDetectKeyPhrasesItemResult_keyPhrases :: (Maybe [KeyPhrase] -> f (Maybe [KeyPhrase]))
-> BatchDetectKeyPhrasesItemResult
-> f BatchDetectKeyPhrasesItemResult
batchDetectKeyPhrasesItemResult_keyPhrases = (BatchDetectKeyPhrasesItemResult -> Maybe [KeyPhrase])
-> (BatchDetectKeyPhrasesItemResult
    -> Maybe [KeyPhrase] -> BatchDetectKeyPhrasesItemResult)
-> Lens
     BatchDetectKeyPhrasesItemResult
     BatchDetectKeyPhrasesItemResult
     (Maybe [KeyPhrase])
     (Maybe [KeyPhrase])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectKeyPhrasesItemResult' {Maybe [KeyPhrase]
keyPhrases :: Maybe [KeyPhrase]
$sel:keyPhrases:BatchDetectKeyPhrasesItemResult' :: BatchDetectKeyPhrasesItemResult -> Maybe [KeyPhrase]
keyPhrases} -> Maybe [KeyPhrase]
keyPhrases) (\s :: BatchDetectKeyPhrasesItemResult
s@BatchDetectKeyPhrasesItemResult' {} Maybe [KeyPhrase]
a -> BatchDetectKeyPhrasesItemResult
s {$sel:keyPhrases:BatchDetectKeyPhrasesItemResult' :: Maybe [KeyPhrase]
keyPhrases = Maybe [KeyPhrase]
a} :: BatchDetectKeyPhrasesItemResult) ((Maybe [KeyPhrase] -> f (Maybe [KeyPhrase]))
 -> BatchDetectKeyPhrasesItemResult
 -> f BatchDetectKeyPhrasesItemResult)
-> ((Maybe [KeyPhrase] -> f (Maybe [KeyPhrase]))
    -> Maybe [KeyPhrase] -> f (Maybe [KeyPhrase]))
-> (Maybe [KeyPhrase] -> f (Maybe [KeyPhrase]))
-> BatchDetectKeyPhrasesItemResult
-> f BatchDetectKeyPhrasesItemResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [KeyPhrase] [KeyPhrase] [KeyPhrase] [KeyPhrase]
-> Iso
     (Maybe [KeyPhrase])
     (Maybe [KeyPhrase])
     (Maybe [KeyPhrase])
     (Maybe [KeyPhrase])
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 [KeyPhrase] [KeyPhrase] [KeyPhrase] [KeyPhrase]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    BatchDetectKeyPhrasesItemResult
  where
  parseJSON :: Value -> Parser BatchDetectKeyPhrasesItemResult
parseJSON =
    String
-> (Object -> Parser BatchDetectKeyPhrasesItemResult)
-> Value
-> Parser BatchDetectKeyPhrasesItemResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchDetectKeyPhrasesItemResult"
      ( \Object
x ->
          Maybe Int -> Maybe [KeyPhrase] -> BatchDetectKeyPhrasesItemResult
BatchDetectKeyPhrasesItemResult'
            (Maybe Int -> Maybe [KeyPhrase] -> BatchDetectKeyPhrasesItemResult)
-> Parser (Maybe Int)
-> Parser (Maybe [KeyPhrase] -> BatchDetectKeyPhrasesItemResult)
forall (f :: * -> *) a b. Functor 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")
            Parser (Maybe [KeyPhrase] -> BatchDetectKeyPhrasesItemResult)
-> Parser (Maybe [KeyPhrase])
-> Parser BatchDetectKeyPhrasesItemResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [KeyPhrase]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeyPhrases" Parser (Maybe (Maybe [KeyPhrase]))
-> Maybe [KeyPhrase] -> Parser (Maybe [KeyPhrase])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [KeyPhrase]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    BatchDetectKeyPhrasesItemResult

instance
  Prelude.NFData
    BatchDetectKeyPhrasesItemResult