{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Textract.Types.DocumentLocation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 such as StartDocumentTextDetection.
--
-- 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
(DocumentLocation -> DocumentLocation -> Bool)
-> (DocumentLocation -> DocumentLocation -> Bool)
-> Eq DocumentLocation
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]
(Int -> ReadS DocumentLocation)
-> ReadS [DocumentLocation]
-> ReadPrec DocumentLocation
-> ReadPrec [DocumentLocation]
-> Read 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
(Int -> DocumentLocation -> ShowS)
-> (DocumentLocation -> String)
-> ([DocumentLocation] -> ShowS)
-> Show DocumentLocation
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. DocumentLocation -> Rep DocumentLocation x)
-> (forall x. Rep DocumentLocation x -> DocumentLocation)
-> Generic DocumentLocation
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' :: Maybe S3Object -> DocumentLocation
DocumentLocation' {$sel:s3Object:DocumentLocation' :: Maybe S3Object
s3Object = Maybe 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 :: (Maybe S3Object -> f (Maybe S3Object))
-> DocumentLocation -> f DocumentLocation
documentLocation_s3Object = (DocumentLocation -> Maybe S3Object)
-> (DocumentLocation -> Maybe S3Object -> DocumentLocation)
-> Lens
     DocumentLocation DocumentLocation (Maybe S3Object) (Maybe 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

instance Prelude.NFData DocumentLocation

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