{-# 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.EntityRecognizerDocuments
-- 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.EntityRecognizerDocuments where

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

-- | Describes the training documents submitted with an entity recognizer.
--
-- /See:/ 'newEntityRecognizerDocuments' smart constructor.
data EntityRecognizerDocuments = EntityRecognizerDocuments'
  { -- | Specifies how the text in an input file should be processed. This is
    -- optional, and the default is ONE_DOC_PER_LINE. ONE_DOC_PER_FILE - Each
    -- file is considered a separate document. Use this option when you are
    -- processing large documents, such as newspaper articles or scientific
    -- papers. ONE_DOC_PER_LINE - Each line in a file is considered a separate
    -- document. Use this option when you are processing many short documents,
    -- such as text messages.
    EntityRecognizerDocuments -> Maybe InputFormat
inputFormat :: Prelude.Maybe InputFormat,
    -- | Specifies the Amazon S3 location where the test documents for an entity
    -- recognizer are located. The URI must be in the same AWS Region as the
    -- API endpoint that you are calling.
    EntityRecognizerDocuments -> Maybe Text
testS3Uri :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon S3 location where the training documents for an
    -- entity recognizer are located. The URI must be in the same region as the
    -- API endpoint that you are calling.
    EntityRecognizerDocuments -> Text
s3Uri :: Prelude.Text
  }
  deriving (EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool
$c/= :: EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool
== :: EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool
$c== :: EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool
Prelude.Eq, ReadPrec [EntityRecognizerDocuments]
ReadPrec EntityRecognizerDocuments
Int -> ReadS EntityRecognizerDocuments
ReadS [EntityRecognizerDocuments]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntityRecognizerDocuments]
$creadListPrec :: ReadPrec [EntityRecognizerDocuments]
readPrec :: ReadPrec EntityRecognizerDocuments
$creadPrec :: ReadPrec EntityRecognizerDocuments
readList :: ReadS [EntityRecognizerDocuments]
$creadList :: ReadS [EntityRecognizerDocuments]
readsPrec :: Int -> ReadS EntityRecognizerDocuments
$creadsPrec :: Int -> ReadS EntityRecognizerDocuments
Prelude.Read, Int -> EntityRecognizerDocuments -> ShowS
[EntityRecognizerDocuments] -> ShowS
EntityRecognizerDocuments -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntityRecognizerDocuments] -> ShowS
$cshowList :: [EntityRecognizerDocuments] -> ShowS
show :: EntityRecognizerDocuments -> String
$cshow :: EntityRecognizerDocuments -> String
showsPrec :: Int -> EntityRecognizerDocuments -> ShowS
$cshowsPrec :: Int -> EntityRecognizerDocuments -> ShowS
Prelude.Show, forall x.
Rep EntityRecognizerDocuments x -> EntityRecognizerDocuments
forall x.
EntityRecognizerDocuments -> Rep EntityRecognizerDocuments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EntityRecognizerDocuments x -> EntityRecognizerDocuments
$cfrom :: forall x.
EntityRecognizerDocuments -> Rep EntityRecognizerDocuments x
Prelude.Generic)

-- |
-- Create a value of 'EntityRecognizerDocuments' 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:
--
-- 'inputFormat', 'entityRecognizerDocuments_inputFormat' - Specifies how the text in an input file should be processed. This is
-- optional, and the default is ONE_DOC_PER_LINE. ONE_DOC_PER_FILE - Each
-- file is considered a separate document. Use this option when you are
-- processing large documents, such as newspaper articles or scientific
-- papers. ONE_DOC_PER_LINE - Each line in a file is considered a separate
-- document. Use this option when you are processing many short documents,
-- such as text messages.
--
-- 'testS3Uri', 'entityRecognizerDocuments_testS3Uri' - Specifies the Amazon S3 location where the test documents for an entity
-- recognizer are located. The URI must be in the same AWS Region as the
-- API endpoint that you are calling.
--
-- 's3Uri', 'entityRecognizerDocuments_s3Uri' - Specifies the Amazon S3 location where the training documents for an
-- entity recognizer are located. The URI must be in the same region as the
-- API endpoint that you are calling.
newEntityRecognizerDocuments ::
  -- | 's3Uri'
  Prelude.Text ->
  EntityRecognizerDocuments
newEntityRecognizerDocuments :: Text -> EntityRecognizerDocuments
newEntityRecognizerDocuments Text
pS3Uri_ =
  EntityRecognizerDocuments'
    { $sel:inputFormat:EntityRecognizerDocuments' :: Maybe InputFormat
inputFormat =
        forall a. Maybe a
Prelude.Nothing,
      $sel:testS3Uri:EntityRecognizerDocuments' :: Maybe Text
testS3Uri = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:EntityRecognizerDocuments' :: Text
s3Uri = Text
pS3Uri_
    }

-- | Specifies how the text in an input file should be processed. This is
-- optional, and the default is ONE_DOC_PER_LINE. ONE_DOC_PER_FILE - Each
-- file is considered a separate document. Use this option when you are
-- processing large documents, such as newspaper articles or scientific
-- papers. ONE_DOC_PER_LINE - Each line in a file is considered a separate
-- document. Use this option when you are processing many short documents,
-- such as text messages.
entityRecognizerDocuments_inputFormat :: Lens.Lens' EntityRecognizerDocuments (Prelude.Maybe InputFormat)
entityRecognizerDocuments_inputFormat :: Lens' EntityRecognizerDocuments (Maybe InputFormat)
entityRecognizerDocuments_inputFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerDocuments' {Maybe InputFormat
inputFormat :: Maybe InputFormat
$sel:inputFormat:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe InputFormat
inputFormat} -> Maybe InputFormat
inputFormat) (\s :: EntityRecognizerDocuments
s@EntityRecognizerDocuments' {} Maybe InputFormat
a -> EntityRecognizerDocuments
s {$sel:inputFormat:EntityRecognizerDocuments' :: Maybe InputFormat
inputFormat = Maybe InputFormat
a} :: EntityRecognizerDocuments)

-- | Specifies the Amazon S3 location where the test documents for an entity
-- recognizer are located. The URI must be in the same AWS Region as the
-- API endpoint that you are calling.
entityRecognizerDocuments_testS3Uri :: Lens.Lens' EntityRecognizerDocuments (Prelude.Maybe Prelude.Text)
entityRecognizerDocuments_testS3Uri :: Lens' EntityRecognizerDocuments (Maybe Text)
entityRecognizerDocuments_testS3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerDocuments' {Maybe Text
testS3Uri :: Maybe Text
$sel:testS3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe Text
testS3Uri} -> Maybe Text
testS3Uri) (\s :: EntityRecognizerDocuments
s@EntityRecognizerDocuments' {} Maybe Text
a -> EntityRecognizerDocuments
s {$sel:testS3Uri:EntityRecognizerDocuments' :: Maybe Text
testS3Uri = Maybe Text
a} :: EntityRecognizerDocuments)

-- | Specifies the Amazon S3 location where the training documents for an
-- entity recognizer are located. The URI must be in the same region as the
-- API endpoint that you are calling.
entityRecognizerDocuments_s3Uri :: Lens.Lens' EntityRecognizerDocuments Prelude.Text
entityRecognizerDocuments_s3Uri :: Lens' EntityRecognizerDocuments Text
entityRecognizerDocuments_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerDocuments' {Text
s3Uri :: Text
$sel:s3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Text
s3Uri} -> Text
s3Uri) (\s :: EntityRecognizerDocuments
s@EntityRecognizerDocuments' {} Text
a -> EntityRecognizerDocuments
s {$sel:s3Uri:EntityRecognizerDocuments' :: Text
s3Uri = Text
a} :: EntityRecognizerDocuments)

instance Data.FromJSON EntityRecognizerDocuments where
  parseJSON :: Value -> Parser EntityRecognizerDocuments
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EntityRecognizerDocuments"
      ( \Object
x ->
          Maybe InputFormat
-> Maybe Text -> Text -> EntityRecognizerDocuments
EntityRecognizerDocuments'
            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
"InputFormat")
            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
"TestS3Uri")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3Uri")
      )

instance Prelude.Hashable EntityRecognizerDocuments where
  hashWithSalt :: Int -> EntityRecognizerDocuments -> Int
hashWithSalt Int
_salt EntityRecognizerDocuments' {Maybe Text
Maybe InputFormat
Text
s3Uri :: Text
testS3Uri :: Maybe Text
inputFormat :: Maybe InputFormat
$sel:s3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Text
$sel:testS3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe Text
$sel:inputFormat:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe InputFormat
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputFormat
inputFormat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
testS3Uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri

instance Prelude.NFData EntityRecognizerDocuments where
  rnf :: EntityRecognizerDocuments -> ()
rnf EntityRecognizerDocuments' {Maybe Text
Maybe InputFormat
Text
s3Uri :: Text
testS3Uri :: Maybe Text
inputFormat :: Maybe InputFormat
$sel:s3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Text
$sel:testS3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe Text
$sel:inputFormat:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe InputFormat
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InputFormat
inputFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
testS3Uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri

instance Data.ToJSON EntityRecognizerDocuments where
  toJSON :: EntityRecognizerDocuments -> Value
toJSON EntityRecognizerDocuments' {Maybe Text
Maybe InputFormat
Text
s3Uri :: Text
testS3Uri :: Maybe Text
inputFormat :: Maybe InputFormat
$sel:s3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Text
$sel:testS3Uri:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe Text
$sel:inputFormat:EntityRecognizerDocuments' :: EntityRecognizerDocuments -> Maybe InputFormat
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"InputFormat" 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 InputFormat
inputFormat,
            (Key
"TestS3Uri" 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 Text
testS3Uri,
            forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri)
          ]
      )