{-# 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.Textract.Types.IdentityDocumentField
-- 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.Textract.Types.IdentityDocumentField where

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
import Amazonka.Textract.Types.AnalyzeIDDetections

-- | Structure containing both the normalized type of the extracted
-- information and the text associated with it. These are extracted as Type
-- and Value respectively.
--
-- /See:/ 'newIdentityDocumentField' smart constructor.
data IdentityDocumentField = IdentityDocumentField'
  { IdentityDocumentField -> Maybe AnalyzeIDDetections
type' :: Prelude.Maybe AnalyzeIDDetections,
    IdentityDocumentField -> Maybe AnalyzeIDDetections
valueDetection :: Prelude.Maybe AnalyzeIDDetections
  }
  deriving (IdentityDocumentField -> IdentityDocumentField -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityDocumentField -> IdentityDocumentField -> Bool
$c/= :: IdentityDocumentField -> IdentityDocumentField -> Bool
== :: IdentityDocumentField -> IdentityDocumentField -> Bool
$c== :: IdentityDocumentField -> IdentityDocumentField -> Bool
Prelude.Eq, ReadPrec [IdentityDocumentField]
ReadPrec IdentityDocumentField
Int -> ReadS IdentityDocumentField
ReadS [IdentityDocumentField]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityDocumentField]
$creadListPrec :: ReadPrec [IdentityDocumentField]
readPrec :: ReadPrec IdentityDocumentField
$creadPrec :: ReadPrec IdentityDocumentField
readList :: ReadS [IdentityDocumentField]
$creadList :: ReadS [IdentityDocumentField]
readsPrec :: Int -> ReadS IdentityDocumentField
$creadsPrec :: Int -> ReadS IdentityDocumentField
Prelude.Read, Int -> IdentityDocumentField -> ShowS
[IdentityDocumentField] -> ShowS
IdentityDocumentField -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityDocumentField] -> ShowS
$cshowList :: [IdentityDocumentField] -> ShowS
show :: IdentityDocumentField -> String
$cshow :: IdentityDocumentField -> String
showsPrec :: Int -> IdentityDocumentField -> ShowS
$cshowsPrec :: Int -> IdentityDocumentField -> ShowS
Prelude.Show, forall x. Rep IdentityDocumentField x -> IdentityDocumentField
forall x. IdentityDocumentField -> Rep IdentityDocumentField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityDocumentField x -> IdentityDocumentField
$cfrom :: forall x. IdentityDocumentField -> Rep IdentityDocumentField x
Prelude.Generic)

-- |
-- Create a value of 'IdentityDocumentField' 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:
--
-- 'type'', 'identityDocumentField_type' - Undocumented member.
--
-- 'valueDetection', 'identityDocumentField_valueDetection' - Undocumented member.
newIdentityDocumentField ::
  IdentityDocumentField
newIdentityDocumentField :: IdentityDocumentField
newIdentityDocumentField =
  IdentityDocumentField'
    { $sel:type':IdentityDocumentField' :: Maybe AnalyzeIDDetections
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:valueDetection:IdentityDocumentField' :: Maybe AnalyzeIDDetections
valueDetection = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
identityDocumentField_type :: Lens.Lens' IdentityDocumentField (Prelude.Maybe AnalyzeIDDetections)
identityDocumentField_type :: Lens' IdentityDocumentField (Maybe AnalyzeIDDetections)
identityDocumentField_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityDocumentField' {Maybe AnalyzeIDDetections
type' :: Maybe AnalyzeIDDetections
$sel:type':IdentityDocumentField' :: IdentityDocumentField -> Maybe AnalyzeIDDetections
type'} -> Maybe AnalyzeIDDetections
type') (\s :: IdentityDocumentField
s@IdentityDocumentField' {} Maybe AnalyzeIDDetections
a -> IdentityDocumentField
s {$sel:type':IdentityDocumentField' :: Maybe AnalyzeIDDetections
type' = Maybe AnalyzeIDDetections
a} :: IdentityDocumentField)

-- | Undocumented member.
identityDocumentField_valueDetection :: Lens.Lens' IdentityDocumentField (Prelude.Maybe AnalyzeIDDetections)
identityDocumentField_valueDetection :: Lens' IdentityDocumentField (Maybe AnalyzeIDDetections)
identityDocumentField_valueDetection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityDocumentField' {Maybe AnalyzeIDDetections
valueDetection :: Maybe AnalyzeIDDetections
$sel:valueDetection:IdentityDocumentField' :: IdentityDocumentField -> Maybe AnalyzeIDDetections
valueDetection} -> Maybe AnalyzeIDDetections
valueDetection) (\s :: IdentityDocumentField
s@IdentityDocumentField' {} Maybe AnalyzeIDDetections
a -> IdentityDocumentField
s {$sel:valueDetection:IdentityDocumentField' :: Maybe AnalyzeIDDetections
valueDetection = Maybe AnalyzeIDDetections
a} :: IdentityDocumentField)

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

instance Prelude.Hashable IdentityDocumentField where
  hashWithSalt :: Int -> IdentityDocumentField -> Int
hashWithSalt Int
_salt IdentityDocumentField' {Maybe AnalyzeIDDetections
valueDetection :: Maybe AnalyzeIDDetections
type' :: Maybe AnalyzeIDDetections
$sel:valueDetection:IdentityDocumentField' :: IdentityDocumentField -> Maybe AnalyzeIDDetections
$sel:type':IdentityDocumentField' :: IdentityDocumentField -> Maybe AnalyzeIDDetections
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnalyzeIDDetections
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnalyzeIDDetections
valueDetection

instance Prelude.NFData IdentityDocumentField where
  rnf :: IdentityDocumentField -> ()
rnf IdentityDocumentField' {Maybe AnalyzeIDDetections
valueDetection :: Maybe AnalyzeIDDetections
type' :: Maybe AnalyzeIDDetections
$sel:valueDetection:IdentityDocumentField' :: IdentityDocumentField -> Maybe AnalyzeIDDetections
$sel:type':IdentityDocumentField' :: IdentityDocumentField -> Maybe AnalyzeIDDetections
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AnalyzeIDDetections
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AnalyzeIDDetections
valueDetection