{-# 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.DocumentLocation
-- 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.DocumentLocation 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.S3Object

-- | The Amazon S3 bucket that contains the document to be processed. It\'s
-- used by asynchronous operations.
--
-- The input document can be an image file in JPEG or PNG format. It can
-- also be a file in PDF format.
--
-- /See:/ 'newDocumentLocation' smart constructor.
data DocumentLocation = DocumentLocation'
  { -- | The Amazon S3 bucket that contains the input document.
    DocumentLocation -> Maybe S3Object
s3Object :: Prelude.Maybe S3Object
  }
  deriving (DocumentLocation -> DocumentLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentLocation -> DocumentLocation -> Bool
$c/= :: DocumentLocation -> DocumentLocation -> Bool
== :: DocumentLocation -> DocumentLocation -> Bool
$c== :: DocumentLocation -> DocumentLocation -> Bool
Prelude.Eq, ReadPrec [DocumentLocation]
ReadPrec DocumentLocation
Int -> ReadS DocumentLocation
ReadS [DocumentLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentLocation]
$creadListPrec :: ReadPrec [DocumentLocation]
readPrec :: ReadPrec DocumentLocation
$creadPrec :: ReadPrec DocumentLocation
readList :: ReadS [DocumentLocation]
$creadList :: ReadS [DocumentLocation]
readsPrec :: Int -> ReadS DocumentLocation
$creadsPrec :: Int -> ReadS DocumentLocation
Prelude.Read, Int -> DocumentLocation -> ShowS
[DocumentLocation] -> ShowS
DocumentLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentLocation] -> ShowS
$cshowList :: [DocumentLocation] -> ShowS
show :: DocumentLocation -> String
$cshow :: DocumentLocation -> String
showsPrec :: Int -> DocumentLocation -> ShowS
$cshowsPrec :: Int -> DocumentLocation -> ShowS
Prelude.Show, forall x. Rep DocumentLocation x -> DocumentLocation
forall x. DocumentLocation -> Rep DocumentLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentLocation x -> DocumentLocation
$cfrom :: forall x. DocumentLocation -> Rep DocumentLocation x
Prelude.Generic)

-- |
-- Create a value of 'DocumentLocation' 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:
--
-- 's3Object', 'documentLocation_s3Object' - The Amazon S3 bucket that contains the input document.
newDocumentLocation ::
  DocumentLocation
newDocumentLocation :: DocumentLocation
newDocumentLocation =
  DocumentLocation' {$sel:s3Object:DocumentLocation' :: Maybe S3Object
s3Object = forall a. Maybe a
Prelude.Nothing}

-- | The Amazon S3 bucket that contains the input document.
documentLocation_s3Object :: Lens.Lens' DocumentLocation (Prelude.Maybe S3Object)
documentLocation_s3Object :: Lens' DocumentLocation (Maybe S3Object)
documentLocation_s3Object = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentLocation' {Maybe S3Object
s3Object :: Maybe S3Object
$sel:s3Object:DocumentLocation' :: DocumentLocation -> Maybe S3Object
s3Object} -> Maybe S3Object
s3Object) (\s :: DocumentLocation
s@DocumentLocation' {} Maybe S3Object
a -> DocumentLocation
s {$sel:s3Object:DocumentLocation' :: Maybe S3Object
s3Object = Maybe S3Object
a} :: DocumentLocation)

instance Prelude.Hashable DocumentLocation where
  hashWithSalt :: Int -> DocumentLocation -> Int
hashWithSalt Int
_salt DocumentLocation' {Maybe S3Object
s3Object :: Maybe S3Object
$sel:s3Object:DocumentLocation' :: DocumentLocation -> Maybe S3Object
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Object
s3Object

instance Prelude.NFData DocumentLocation where
  rnf :: DocumentLocation -> ()
rnf DocumentLocation' {Maybe S3Object
s3Object :: Maybe S3Object
$sel:s3Object:DocumentLocation' :: DocumentLocation -> Maybe S3Object
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Object
s3Object

instance Data.ToJSON DocumentLocation where
  toJSON :: DocumentLocation -> Value
toJSON DocumentLocation' {Maybe S3Object
s3Object :: Maybe S3Object
$sel:s3Object:DocumentLocation' :: DocumentLocation -> Maybe S3Object
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"S3Object" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Object
s3Object]
      )