{-# 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.CloudDirectory.Types.BatchListIndexResponse
-- 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.CloudDirectory.Types.BatchListIndexResponse where

import Amazonka.CloudDirectory.Types.IndexAttachment
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents the output of a ListIndex response operation.
--
-- /See:/ 'newBatchListIndexResponse' smart constructor.
data BatchListIndexResponse = BatchListIndexResponse'
  { -- | The objects and indexed values attached to the index.
    BatchListIndexResponse -> Maybe [IndexAttachment]
indexAttachments :: Prelude.Maybe [IndexAttachment],
    -- | The pagination token.
    BatchListIndexResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchListIndexResponse -> BatchListIndexResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
$c/= :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
== :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
$c== :: BatchListIndexResponse -> BatchListIndexResponse -> Bool
Prelude.Eq, ReadPrec [BatchListIndexResponse]
ReadPrec BatchListIndexResponse
Int -> ReadS BatchListIndexResponse
ReadS [BatchListIndexResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchListIndexResponse]
$creadListPrec :: ReadPrec [BatchListIndexResponse]
readPrec :: ReadPrec BatchListIndexResponse
$creadPrec :: ReadPrec BatchListIndexResponse
readList :: ReadS [BatchListIndexResponse]
$creadList :: ReadS [BatchListIndexResponse]
readsPrec :: Int -> ReadS BatchListIndexResponse
$creadsPrec :: Int -> ReadS BatchListIndexResponse
Prelude.Read, Int -> BatchListIndexResponse -> ShowS
[BatchListIndexResponse] -> ShowS
BatchListIndexResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchListIndexResponse] -> ShowS
$cshowList :: [BatchListIndexResponse] -> ShowS
show :: BatchListIndexResponse -> String
$cshow :: BatchListIndexResponse -> String
showsPrec :: Int -> BatchListIndexResponse -> ShowS
$cshowsPrec :: Int -> BatchListIndexResponse -> ShowS
Prelude.Show, forall x. Rep BatchListIndexResponse x -> BatchListIndexResponse
forall x. BatchListIndexResponse -> Rep BatchListIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchListIndexResponse x -> BatchListIndexResponse
$cfrom :: forall x. BatchListIndexResponse -> Rep BatchListIndexResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchListIndexResponse' 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:
--
-- 'indexAttachments', 'batchListIndexResponse_indexAttachments' - The objects and indexed values attached to the index.
--
-- 'nextToken', 'batchListIndexResponse_nextToken' - The pagination token.
newBatchListIndexResponse ::
  BatchListIndexResponse
newBatchListIndexResponse :: BatchListIndexResponse
newBatchListIndexResponse =
  BatchListIndexResponse'
    { $sel:indexAttachments:BatchListIndexResponse' :: Maybe [IndexAttachment]
indexAttachments =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:BatchListIndexResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The objects and indexed values attached to the index.
batchListIndexResponse_indexAttachments :: Lens.Lens' BatchListIndexResponse (Prelude.Maybe [IndexAttachment])
batchListIndexResponse_indexAttachments :: Lens' BatchListIndexResponse (Maybe [IndexAttachment])
batchListIndexResponse_indexAttachments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListIndexResponse' {Maybe [IndexAttachment]
indexAttachments :: Maybe [IndexAttachment]
$sel:indexAttachments:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe [IndexAttachment]
indexAttachments} -> Maybe [IndexAttachment]
indexAttachments) (\s :: BatchListIndexResponse
s@BatchListIndexResponse' {} Maybe [IndexAttachment]
a -> BatchListIndexResponse
s {$sel:indexAttachments:BatchListIndexResponse' :: Maybe [IndexAttachment]
indexAttachments = Maybe [IndexAttachment]
a} :: BatchListIndexResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pagination token.
batchListIndexResponse_nextToken :: Lens.Lens' BatchListIndexResponse (Prelude.Maybe Prelude.Text)
batchListIndexResponse_nextToken :: Lens' BatchListIndexResponse (Maybe Text)
batchListIndexResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchListIndexResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: BatchListIndexResponse
s@BatchListIndexResponse' {} Maybe Text
a -> BatchListIndexResponse
s {$sel:nextToken:BatchListIndexResponse' :: Maybe Text
nextToken = Maybe Text
a} :: BatchListIndexResponse)

instance Data.FromJSON BatchListIndexResponse where
  parseJSON :: Value -> Parser BatchListIndexResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchListIndexResponse"
      ( \Object
x ->
          Maybe [IndexAttachment] -> Maybe Text -> BatchListIndexResponse
BatchListIndexResponse'
            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
"IndexAttachments"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"NextToken")
      )

instance Prelude.Hashable BatchListIndexResponse where
  hashWithSalt :: Int -> BatchListIndexResponse -> Int
hashWithSalt Int
_salt BatchListIndexResponse' {Maybe [IndexAttachment]
Maybe Text
nextToken :: Maybe Text
indexAttachments :: Maybe [IndexAttachment]
$sel:nextToken:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe Text
$sel:indexAttachments:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe [IndexAttachment]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [IndexAttachment]
indexAttachments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData BatchListIndexResponse where
  rnf :: BatchListIndexResponse -> ()
rnf BatchListIndexResponse' {Maybe [IndexAttachment]
Maybe Text
nextToken :: Maybe Text
indexAttachments :: Maybe [IndexAttachment]
$sel:nextToken:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe Text
$sel:indexAttachments:BatchListIndexResponse' :: BatchListIndexResponse -> Maybe [IndexAttachment]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [IndexAttachment]
indexAttachments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken