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

import Amazonka.Comprehend.Types.InputFormat
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool)
-> (EntityRecognizerDocuments -> EntityRecognizerDocuments -> Bool)
-> Eq EntityRecognizerDocuments
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]
(Int -> ReadS EntityRecognizerDocuments)
-> ReadS [EntityRecognizerDocuments]
-> ReadPrec EntityRecognizerDocuments
-> ReadPrec [EntityRecognizerDocuments]
-> Read 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
(Int -> EntityRecognizerDocuments -> ShowS)
-> (EntityRecognizerDocuments -> String)
-> ([EntityRecognizerDocuments] -> ShowS)
-> Show EntityRecognizerDocuments
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.
 EntityRecognizerDocuments -> Rep EntityRecognizerDocuments x)
-> (forall x.
    Rep EntityRecognizerDocuments x -> EntityRecognizerDocuments)
-> Generic EntityRecognizerDocuments
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' :: Maybe InputFormat
-> Maybe Text -> Text -> EntityRecognizerDocuments
EntityRecognizerDocuments'
    { $sel:inputFormat:EntityRecognizerDocuments' :: Maybe InputFormat
inputFormat =
        Maybe InputFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:testS3Uri:EntityRecognizerDocuments' :: Maybe Text
testS3Uri = Maybe Text
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 :: (Maybe InputFormat -> f (Maybe InputFormat))
-> EntityRecognizerDocuments -> f EntityRecognizerDocuments
entityRecognizerDocuments_inputFormat = (EntityRecognizerDocuments -> Maybe InputFormat)
-> (EntityRecognizerDocuments
    -> Maybe InputFormat -> EntityRecognizerDocuments)
-> Lens
     EntityRecognizerDocuments
     EntityRecognizerDocuments
     (Maybe InputFormat)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> EntityRecognizerDocuments -> f EntityRecognizerDocuments
entityRecognizerDocuments_testS3Uri = (EntityRecognizerDocuments -> Maybe Text)
-> (EntityRecognizerDocuments
    -> Maybe Text -> EntityRecognizerDocuments)
-> Lens
     EntityRecognizerDocuments
     EntityRecognizerDocuments
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> EntityRecognizerDocuments -> f EntityRecognizerDocuments
entityRecognizerDocuments_s3Uri = (EntityRecognizerDocuments -> Text)
-> (EntityRecognizerDocuments -> Text -> EntityRecognizerDocuments)
-> Lens
     EntityRecognizerDocuments EntityRecognizerDocuments Text Text
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 Core.FromJSON EntityRecognizerDocuments where
  parseJSON :: Value -> Parser EntityRecognizerDocuments
parseJSON =
    String
-> (Object -> Parser EntityRecognizerDocuments)
-> Value
-> Parser EntityRecognizerDocuments
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EntityRecognizerDocuments"
      ( \Object
x ->
          Maybe InputFormat
-> Maybe Text -> Text -> EntityRecognizerDocuments
EntityRecognizerDocuments'
            (Maybe InputFormat
 -> Maybe Text -> Text -> EntityRecognizerDocuments)
-> Parser (Maybe InputFormat)
-> Parser (Maybe Text -> Text -> EntityRecognizerDocuments)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InputFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InputFormat")
            Parser (Maybe Text -> Text -> EntityRecognizerDocuments)
-> Parser (Maybe Text)
-> Parser (Text -> EntityRecognizerDocuments)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TestS3Uri")
            Parser (Text -> EntityRecognizerDocuments)
-> Parser Text -> Parser EntityRecognizerDocuments
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Uri")
      )

instance Prelude.Hashable EntityRecognizerDocuments

instance Prelude.NFData EntityRecognizerDocuments

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InputFormat" Text -> InputFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InputFormat -> Pair) -> Maybe InputFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputFormat
inputFormat,
            (Text
"TestS3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
testS3Uri,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Uri)
          ]
      )