{-# 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.Kendra.Types.BatchPutDocumentResponseFailedDocument
-- 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.Kendra.Types.BatchPutDocumentResponseFailedDocument where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.ErrorCode
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a document that could not be indexed.
--
-- /See:/ 'newBatchPutDocumentResponseFailedDocument' smart constructor.
data BatchPutDocumentResponseFailedDocument = BatchPutDocumentResponseFailedDocument'
  { -- | The type of error that caused the document to fail to be indexed.
    BatchPutDocumentResponseFailedDocument -> Maybe ErrorCode
errorCode :: Prelude.Maybe ErrorCode,
    -- | A description of the reason why the document could not be indexed.
    BatchPutDocumentResponseFailedDocument -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the document.
    BatchPutDocumentResponseFailedDocument -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchPutDocumentResponseFailedDocument
-> BatchPutDocumentResponseFailedDocument -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPutDocumentResponseFailedDocument
-> BatchPutDocumentResponseFailedDocument -> Bool
$c/= :: BatchPutDocumentResponseFailedDocument
-> BatchPutDocumentResponseFailedDocument -> Bool
== :: BatchPutDocumentResponseFailedDocument
-> BatchPutDocumentResponseFailedDocument -> Bool
$c== :: BatchPutDocumentResponseFailedDocument
-> BatchPutDocumentResponseFailedDocument -> Bool
Prelude.Eq, ReadPrec [BatchPutDocumentResponseFailedDocument]
ReadPrec BatchPutDocumentResponseFailedDocument
Int -> ReadS BatchPutDocumentResponseFailedDocument
ReadS [BatchPutDocumentResponseFailedDocument]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchPutDocumentResponseFailedDocument]
$creadListPrec :: ReadPrec [BatchPutDocumentResponseFailedDocument]
readPrec :: ReadPrec BatchPutDocumentResponseFailedDocument
$creadPrec :: ReadPrec BatchPutDocumentResponseFailedDocument
readList :: ReadS [BatchPutDocumentResponseFailedDocument]
$creadList :: ReadS [BatchPutDocumentResponseFailedDocument]
readsPrec :: Int -> ReadS BatchPutDocumentResponseFailedDocument
$creadsPrec :: Int -> ReadS BatchPutDocumentResponseFailedDocument
Prelude.Read, Int -> BatchPutDocumentResponseFailedDocument -> ShowS
[BatchPutDocumentResponseFailedDocument] -> ShowS
BatchPutDocumentResponseFailedDocument -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPutDocumentResponseFailedDocument] -> ShowS
$cshowList :: [BatchPutDocumentResponseFailedDocument] -> ShowS
show :: BatchPutDocumentResponseFailedDocument -> String
$cshow :: BatchPutDocumentResponseFailedDocument -> String
showsPrec :: Int -> BatchPutDocumentResponseFailedDocument -> ShowS
$cshowsPrec :: Int -> BatchPutDocumentResponseFailedDocument -> ShowS
Prelude.Show, forall x.
Rep BatchPutDocumentResponseFailedDocument x
-> BatchPutDocumentResponseFailedDocument
forall x.
BatchPutDocumentResponseFailedDocument
-> Rep BatchPutDocumentResponseFailedDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchPutDocumentResponseFailedDocument x
-> BatchPutDocumentResponseFailedDocument
$cfrom :: forall x.
BatchPutDocumentResponseFailedDocument
-> Rep BatchPutDocumentResponseFailedDocument x
Prelude.Generic)

-- |
-- Create a value of 'BatchPutDocumentResponseFailedDocument' 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:
--
-- 'errorCode', 'batchPutDocumentResponseFailedDocument_errorCode' - The type of error that caused the document to fail to be indexed.
--
-- 'errorMessage', 'batchPutDocumentResponseFailedDocument_errorMessage' - A description of the reason why the document could not be indexed.
--
-- 'id', 'batchPutDocumentResponseFailedDocument_id' - The identifier of the document.
newBatchPutDocumentResponseFailedDocument ::
  BatchPutDocumentResponseFailedDocument
newBatchPutDocumentResponseFailedDocument :: BatchPutDocumentResponseFailedDocument
newBatchPutDocumentResponseFailedDocument =
  BatchPutDocumentResponseFailedDocument'
    { $sel:errorCode:BatchPutDocumentResponseFailedDocument' :: Maybe ErrorCode
errorCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchPutDocumentResponseFailedDocument' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:id:BatchPutDocumentResponseFailedDocument' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of error that caused the document to fail to be indexed.
batchPutDocumentResponseFailedDocument_errorCode :: Lens.Lens' BatchPutDocumentResponseFailedDocument (Prelude.Maybe ErrorCode)
batchPutDocumentResponseFailedDocument_errorCode :: Lens' BatchPutDocumentResponseFailedDocument (Maybe ErrorCode)
batchPutDocumentResponseFailedDocument_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutDocumentResponseFailedDocument' {Maybe ErrorCode
errorCode :: Maybe ErrorCode
$sel:errorCode:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe ErrorCode
errorCode} -> Maybe ErrorCode
errorCode) (\s :: BatchPutDocumentResponseFailedDocument
s@BatchPutDocumentResponseFailedDocument' {} Maybe ErrorCode
a -> BatchPutDocumentResponseFailedDocument
s {$sel:errorCode:BatchPutDocumentResponseFailedDocument' :: Maybe ErrorCode
errorCode = Maybe ErrorCode
a} :: BatchPutDocumentResponseFailedDocument)

-- | A description of the reason why the document could not be indexed.
batchPutDocumentResponseFailedDocument_errorMessage :: Lens.Lens' BatchPutDocumentResponseFailedDocument (Prelude.Maybe Prelude.Text)
batchPutDocumentResponseFailedDocument_errorMessage :: Lens' BatchPutDocumentResponseFailedDocument (Maybe Text)
batchPutDocumentResponseFailedDocument_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutDocumentResponseFailedDocument' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: BatchPutDocumentResponseFailedDocument
s@BatchPutDocumentResponseFailedDocument' {} Maybe Text
a -> BatchPutDocumentResponseFailedDocument
s {$sel:errorMessage:BatchPutDocumentResponseFailedDocument' :: Maybe Text
errorMessage = Maybe Text
a} :: BatchPutDocumentResponseFailedDocument)

-- | The identifier of the document.
batchPutDocumentResponseFailedDocument_id :: Lens.Lens' BatchPutDocumentResponseFailedDocument (Prelude.Maybe Prelude.Text)
batchPutDocumentResponseFailedDocument_id :: Lens' BatchPutDocumentResponseFailedDocument (Maybe Text)
batchPutDocumentResponseFailedDocument_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutDocumentResponseFailedDocument' {Maybe Text
id :: Maybe Text
$sel:id:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe Text
id} -> Maybe Text
id) (\s :: BatchPutDocumentResponseFailedDocument
s@BatchPutDocumentResponseFailedDocument' {} Maybe Text
a -> BatchPutDocumentResponseFailedDocument
s {$sel:id:BatchPutDocumentResponseFailedDocument' :: Maybe Text
id = Maybe Text
a} :: BatchPutDocumentResponseFailedDocument)

instance
  Data.FromJSON
    BatchPutDocumentResponseFailedDocument
  where
  parseJSON :: Value -> Parser BatchPutDocumentResponseFailedDocument
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchPutDocumentResponseFailedDocument"
      ( \Object
x ->
          Maybe ErrorCode
-> Maybe Text
-> Maybe Text
-> BatchPutDocumentResponseFailedDocument
BatchPutDocumentResponseFailedDocument'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ErrorCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ErrorMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
      )

instance
  Prelude.Hashable
    BatchPutDocumentResponseFailedDocument
  where
  hashWithSalt :: Int -> BatchPutDocumentResponseFailedDocument -> Int
hashWithSalt
    Int
_salt
    BatchPutDocumentResponseFailedDocument' {Maybe Text
Maybe ErrorCode
id :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe ErrorCode
$sel:id:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe Text
$sel:errorMessage:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe Text
$sel:errorCode:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe ErrorCode
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorCode
errorCode
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance
  Prelude.NFData
    BatchPutDocumentResponseFailedDocument
  where
  rnf :: BatchPutDocumentResponseFailedDocument -> ()
rnf BatchPutDocumentResponseFailedDocument' {Maybe Text
Maybe ErrorCode
id :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe ErrorCode
$sel:id:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe Text
$sel:errorMessage:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe Text
$sel:errorCode:BatchPutDocumentResponseFailedDocument' :: BatchPutDocumentResponseFailedDocument -> Maybe ErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id