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

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

-- |
-- Create a value of 'BatchDetectDominantLanguageItemResult' 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:
--
-- 'languages', 'batchDetectDominantLanguageItemResult_languages' - One or more DominantLanguage objects describing the dominant languages
-- in the document.
--
-- 'index', 'batchDetectDominantLanguageItemResult_index' - The zero-based index of the document in the input list.
newBatchDetectDominantLanguageItemResult ::
  BatchDetectDominantLanguageItemResult
newBatchDetectDominantLanguageItemResult :: BatchDetectDominantLanguageItemResult
newBatchDetectDominantLanguageItemResult =
  BatchDetectDominantLanguageItemResult' :: Maybe [DominantLanguage]
-> Maybe Int -> BatchDetectDominantLanguageItemResult
BatchDetectDominantLanguageItemResult'
    { $sel:languages:BatchDetectDominantLanguageItemResult' :: Maybe [DominantLanguage]
languages =
        Maybe [DominantLanguage]
forall a. Maybe a
Prelude.Nothing,
      $sel:index:BatchDetectDominantLanguageItemResult' :: Maybe Int
index = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | One or more DominantLanguage objects describing the dominant languages
-- in the document.
batchDetectDominantLanguageItemResult_languages :: Lens.Lens' BatchDetectDominantLanguageItemResult (Prelude.Maybe [DominantLanguage])
batchDetectDominantLanguageItemResult_languages :: (Maybe [DominantLanguage] -> f (Maybe [DominantLanguage]))
-> BatchDetectDominantLanguageItemResult
-> f BatchDetectDominantLanguageItemResult
batchDetectDominantLanguageItemResult_languages = (BatchDetectDominantLanguageItemResult -> Maybe [DominantLanguage])
-> (BatchDetectDominantLanguageItemResult
    -> Maybe [DominantLanguage]
    -> BatchDetectDominantLanguageItemResult)
-> Lens
     BatchDetectDominantLanguageItemResult
     BatchDetectDominantLanguageItemResult
     (Maybe [DominantLanguage])
     (Maybe [DominantLanguage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectDominantLanguageItemResult' {Maybe [DominantLanguage]
languages :: Maybe [DominantLanguage]
$sel:languages:BatchDetectDominantLanguageItemResult' :: BatchDetectDominantLanguageItemResult -> Maybe [DominantLanguage]
languages} -> Maybe [DominantLanguage]
languages) (\s :: BatchDetectDominantLanguageItemResult
s@BatchDetectDominantLanguageItemResult' {} Maybe [DominantLanguage]
a -> BatchDetectDominantLanguageItemResult
s {$sel:languages:BatchDetectDominantLanguageItemResult' :: Maybe [DominantLanguage]
languages = Maybe [DominantLanguage]
a} :: BatchDetectDominantLanguageItemResult) ((Maybe [DominantLanguage] -> f (Maybe [DominantLanguage]))
 -> BatchDetectDominantLanguageItemResult
 -> f BatchDetectDominantLanguageItemResult)
-> ((Maybe [DominantLanguage] -> f (Maybe [DominantLanguage]))
    -> Maybe [DominantLanguage] -> f (Maybe [DominantLanguage]))
-> (Maybe [DominantLanguage] -> f (Maybe [DominantLanguage]))
-> BatchDetectDominantLanguageItemResult
-> f BatchDetectDominantLanguageItemResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DominantLanguage]
  [DominantLanguage]
  [DominantLanguage]
  [DominantLanguage]
-> Iso
     (Maybe [DominantLanguage])
     (Maybe [DominantLanguage])
     (Maybe [DominantLanguage])
     (Maybe [DominantLanguage])
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
  [DominantLanguage]
  [DominantLanguage]
  [DominantLanguage]
  [DominantLanguage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    BatchDetectDominantLanguageItemResult