{-# 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.DocumentTypeListItem
-- 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.Comprehend.Types.DocumentTypeListItem where

import Amazonka.Comprehend.Types.DocumentType
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

-- | Document type for each page in the document.
--
-- /See:/ 'newDocumentTypeListItem' smart constructor.
data DocumentTypeListItem = DocumentTypeListItem'
  { -- | Page number.
    DocumentTypeListItem -> Maybe Int
page :: Prelude.Maybe Prelude.Int,
    -- | Document type.
    DocumentTypeListItem -> Maybe DocumentType
type' :: Prelude.Maybe DocumentType
  }
  deriving (DocumentTypeListItem -> DocumentTypeListItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentTypeListItem -> DocumentTypeListItem -> Bool
$c/= :: DocumentTypeListItem -> DocumentTypeListItem -> Bool
== :: DocumentTypeListItem -> DocumentTypeListItem -> Bool
$c== :: DocumentTypeListItem -> DocumentTypeListItem -> Bool
Prelude.Eq, ReadPrec [DocumentTypeListItem]
ReadPrec DocumentTypeListItem
Int -> ReadS DocumentTypeListItem
ReadS [DocumentTypeListItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentTypeListItem]
$creadListPrec :: ReadPrec [DocumentTypeListItem]
readPrec :: ReadPrec DocumentTypeListItem
$creadPrec :: ReadPrec DocumentTypeListItem
readList :: ReadS [DocumentTypeListItem]
$creadList :: ReadS [DocumentTypeListItem]
readsPrec :: Int -> ReadS DocumentTypeListItem
$creadsPrec :: Int -> ReadS DocumentTypeListItem
Prelude.Read, Int -> DocumentTypeListItem -> ShowS
[DocumentTypeListItem] -> ShowS
DocumentTypeListItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentTypeListItem] -> ShowS
$cshowList :: [DocumentTypeListItem] -> ShowS
show :: DocumentTypeListItem -> String
$cshow :: DocumentTypeListItem -> String
showsPrec :: Int -> DocumentTypeListItem -> ShowS
$cshowsPrec :: Int -> DocumentTypeListItem -> ShowS
Prelude.Show, forall x. Rep DocumentTypeListItem x -> DocumentTypeListItem
forall x. DocumentTypeListItem -> Rep DocumentTypeListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentTypeListItem x -> DocumentTypeListItem
$cfrom :: forall x. DocumentTypeListItem -> Rep DocumentTypeListItem x
Prelude.Generic)

-- |
-- Create a value of 'DocumentTypeListItem' 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:
--
-- 'page', 'documentTypeListItem_page' - Page number.
--
-- 'type'', 'documentTypeListItem_type' - Document type.
newDocumentTypeListItem ::
  DocumentTypeListItem
newDocumentTypeListItem :: DocumentTypeListItem
newDocumentTypeListItem =
  DocumentTypeListItem'
    { $sel:page:DocumentTypeListItem' :: Maybe Int
page = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DocumentTypeListItem' :: Maybe DocumentType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | Page number.
documentTypeListItem_page :: Lens.Lens' DocumentTypeListItem (Prelude.Maybe Prelude.Int)
documentTypeListItem_page :: Lens' DocumentTypeListItem (Maybe Int)
documentTypeListItem_page = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentTypeListItem' {Maybe Int
page :: Maybe Int
$sel:page:DocumentTypeListItem' :: DocumentTypeListItem -> Maybe Int
page} -> Maybe Int
page) (\s :: DocumentTypeListItem
s@DocumentTypeListItem' {} Maybe Int
a -> DocumentTypeListItem
s {$sel:page:DocumentTypeListItem' :: Maybe Int
page = Maybe Int
a} :: DocumentTypeListItem)

-- | Document type.
documentTypeListItem_type :: Lens.Lens' DocumentTypeListItem (Prelude.Maybe DocumentType)
documentTypeListItem_type :: Lens' DocumentTypeListItem (Maybe DocumentType)
documentTypeListItem_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentTypeListItem' {Maybe DocumentType
type' :: Maybe DocumentType
$sel:type':DocumentTypeListItem' :: DocumentTypeListItem -> Maybe DocumentType
type'} -> Maybe DocumentType
type') (\s :: DocumentTypeListItem
s@DocumentTypeListItem' {} Maybe DocumentType
a -> DocumentTypeListItem
s {$sel:type':DocumentTypeListItem' :: Maybe DocumentType
type' = Maybe DocumentType
a} :: DocumentTypeListItem)

instance Data.FromJSON DocumentTypeListItem where
  parseJSON :: Value -> Parser DocumentTypeListItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DocumentTypeListItem"
      ( \Object
x ->
          Maybe Int -> Maybe DocumentType -> DocumentTypeListItem
DocumentTypeListItem'
            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
"Page")
            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
"Type")
      )

instance Prelude.Hashable DocumentTypeListItem where
  hashWithSalt :: Int -> DocumentTypeListItem -> Int
hashWithSalt Int
_salt DocumentTypeListItem' {Maybe Int
Maybe DocumentType
type' :: Maybe DocumentType
page :: Maybe Int
$sel:type':DocumentTypeListItem' :: DocumentTypeListItem -> Maybe DocumentType
$sel:page:DocumentTypeListItem' :: DocumentTypeListItem -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
page
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DocumentType
type'

instance Prelude.NFData DocumentTypeListItem where
  rnf :: DocumentTypeListItem -> ()
rnf DocumentTypeListItem' {Maybe Int
Maybe DocumentType
type' :: Maybe DocumentType
page :: Maybe Int
$sel:type':DocumentTypeListItem' :: DocumentTypeListItem -> Maybe DocumentType
$sel:page:DocumentTypeListItem' :: DocumentTypeListItem -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
page seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentType
type'