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

import Amazonka.Comprehend.Types.SyntaxToken
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
-- that is successfully processed by the operation.
--
-- /See:/ 'newBatchDetectSyntaxItemResult' smart constructor.
data BatchDetectSyntaxItemResult = BatchDetectSyntaxItemResult'
  { -- | The zero-based index of the document in the input list.
    BatchDetectSyntaxItemResult -> Maybe Int
index :: Prelude.Maybe Prelude.Int,
    -- | The syntax tokens for the words in the document, one token for each
    -- word.
    BatchDetectSyntaxItemResult -> Maybe [SyntaxToken]
syntaxTokens :: Prelude.Maybe [SyntaxToken]
  }
  deriving (BatchDetectSyntaxItemResult -> BatchDetectSyntaxItemResult -> Bool
(BatchDetectSyntaxItemResult
 -> BatchDetectSyntaxItemResult -> Bool)
-> (BatchDetectSyntaxItemResult
    -> BatchDetectSyntaxItemResult -> Bool)
-> Eq BatchDetectSyntaxItemResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectSyntaxItemResult -> BatchDetectSyntaxItemResult -> Bool
$c/= :: BatchDetectSyntaxItemResult -> BatchDetectSyntaxItemResult -> Bool
== :: BatchDetectSyntaxItemResult -> BatchDetectSyntaxItemResult -> Bool
$c== :: BatchDetectSyntaxItemResult -> BatchDetectSyntaxItemResult -> Bool
Prelude.Eq, ReadPrec [BatchDetectSyntaxItemResult]
ReadPrec BatchDetectSyntaxItemResult
Int -> ReadS BatchDetectSyntaxItemResult
ReadS [BatchDetectSyntaxItemResult]
(Int -> ReadS BatchDetectSyntaxItemResult)
-> ReadS [BatchDetectSyntaxItemResult]
-> ReadPrec BatchDetectSyntaxItemResult
-> ReadPrec [BatchDetectSyntaxItemResult]
-> Read BatchDetectSyntaxItemResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDetectSyntaxItemResult]
$creadListPrec :: ReadPrec [BatchDetectSyntaxItemResult]
readPrec :: ReadPrec BatchDetectSyntaxItemResult
$creadPrec :: ReadPrec BatchDetectSyntaxItemResult
readList :: ReadS [BatchDetectSyntaxItemResult]
$creadList :: ReadS [BatchDetectSyntaxItemResult]
readsPrec :: Int -> ReadS BatchDetectSyntaxItemResult
$creadsPrec :: Int -> ReadS BatchDetectSyntaxItemResult
Prelude.Read, Int -> BatchDetectSyntaxItemResult -> ShowS
[BatchDetectSyntaxItemResult] -> ShowS
BatchDetectSyntaxItemResult -> String
(Int -> BatchDetectSyntaxItemResult -> ShowS)
-> (BatchDetectSyntaxItemResult -> String)
-> ([BatchDetectSyntaxItemResult] -> ShowS)
-> Show BatchDetectSyntaxItemResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectSyntaxItemResult] -> ShowS
$cshowList :: [BatchDetectSyntaxItemResult] -> ShowS
show :: BatchDetectSyntaxItemResult -> String
$cshow :: BatchDetectSyntaxItemResult -> String
showsPrec :: Int -> BatchDetectSyntaxItemResult -> ShowS
$cshowsPrec :: Int -> BatchDetectSyntaxItemResult -> ShowS
Prelude.Show, (forall x.
 BatchDetectSyntaxItemResult -> Rep BatchDetectSyntaxItemResult x)
-> (forall x.
    Rep BatchDetectSyntaxItemResult x -> BatchDetectSyntaxItemResult)
-> Generic BatchDetectSyntaxItemResult
forall x.
Rep BatchDetectSyntaxItemResult x -> BatchDetectSyntaxItemResult
forall x.
BatchDetectSyntaxItemResult -> Rep BatchDetectSyntaxItemResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectSyntaxItemResult x -> BatchDetectSyntaxItemResult
$cfrom :: forall x.
BatchDetectSyntaxItemResult -> Rep BatchDetectSyntaxItemResult x
Prelude.Generic)

-- |
-- Create a value of 'BatchDetectSyntaxItemResult' 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', 'batchDetectSyntaxItemResult_index' - The zero-based index of the document in the input list.
--
-- 'syntaxTokens', 'batchDetectSyntaxItemResult_syntaxTokens' - The syntax tokens for the words in the document, one token for each
-- word.
newBatchDetectSyntaxItemResult ::
  BatchDetectSyntaxItemResult
newBatchDetectSyntaxItemResult :: BatchDetectSyntaxItemResult
newBatchDetectSyntaxItemResult =
  BatchDetectSyntaxItemResult' :: Maybe Int -> Maybe [SyntaxToken] -> BatchDetectSyntaxItemResult
BatchDetectSyntaxItemResult'
    { $sel:index:BatchDetectSyntaxItemResult' :: Maybe Int
index =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:syntaxTokens:BatchDetectSyntaxItemResult' :: Maybe [SyntaxToken]
syntaxTokens = Maybe [SyntaxToken]
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The syntax tokens for the words in the document, one token for each
-- word.
batchDetectSyntaxItemResult_syntaxTokens :: Lens.Lens' BatchDetectSyntaxItemResult (Prelude.Maybe [SyntaxToken])
batchDetectSyntaxItemResult_syntaxTokens :: (Maybe [SyntaxToken] -> f (Maybe [SyntaxToken]))
-> BatchDetectSyntaxItemResult -> f BatchDetectSyntaxItemResult
batchDetectSyntaxItemResult_syntaxTokens = (BatchDetectSyntaxItemResult -> Maybe [SyntaxToken])
-> (BatchDetectSyntaxItemResult
    -> Maybe [SyntaxToken] -> BatchDetectSyntaxItemResult)
-> Lens
     BatchDetectSyntaxItemResult
     BatchDetectSyntaxItemResult
     (Maybe [SyntaxToken])
     (Maybe [SyntaxToken])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSyntaxItemResult' {Maybe [SyntaxToken]
syntaxTokens :: Maybe [SyntaxToken]
$sel:syntaxTokens:BatchDetectSyntaxItemResult' :: BatchDetectSyntaxItemResult -> Maybe [SyntaxToken]
syntaxTokens} -> Maybe [SyntaxToken]
syntaxTokens) (\s :: BatchDetectSyntaxItemResult
s@BatchDetectSyntaxItemResult' {} Maybe [SyntaxToken]
a -> BatchDetectSyntaxItemResult
s {$sel:syntaxTokens:BatchDetectSyntaxItemResult' :: Maybe [SyntaxToken]
syntaxTokens = Maybe [SyntaxToken]
a} :: BatchDetectSyntaxItemResult) ((Maybe [SyntaxToken] -> f (Maybe [SyntaxToken]))
 -> BatchDetectSyntaxItemResult -> f BatchDetectSyntaxItemResult)
-> ((Maybe [SyntaxToken] -> f (Maybe [SyntaxToken]))
    -> Maybe [SyntaxToken] -> f (Maybe [SyntaxToken]))
-> (Maybe [SyntaxToken] -> f (Maybe [SyntaxToken]))
-> BatchDetectSyntaxItemResult
-> f BatchDetectSyntaxItemResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SyntaxToken] [SyntaxToken] [SyntaxToken] [SyntaxToken]
-> Iso
     (Maybe [SyntaxToken])
     (Maybe [SyntaxToken])
     (Maybe [SyntaxToken])
     (Maybe [SyntaxToken])
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 [SyntaxToken] [SyntaxToken] [SyntaxToken] [SyntaxToken]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable BatchDetectSyntaxItemResult

instance Prelude.NFData BatchDetectSyntaxItemResult