{-# 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.Translate.Types.InputDataConfig
-- 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.Translate.Types.InputDataConfig 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

-- | The input configuration properties for requesting a batch translation
-- job.
--
-- /See:/ 'newInputDataConfig' smart constructor.
data InputDataConfig = InputDataConfig'
  { -- | The URI of the AWS S3 folder that contains the input files. Amazon
    -- Translate translates all the files in the folder and all its
    -- sub-folders. The folder must be in the same Region as the API endpoint
    -- you are calling.
    InputDataConfig -> Text
s3Uri :: Prelude.Text,
    -- | Describes the format of the data that you submit to Amazon Translate as
    -- input. You can specify one of the following multipurpose internet mail
    -- extension (MIME) types:
    --
    -- -   @text\/html@: The input data consists of one or more HTML files.
    --     Amazon Translate translates only the text that resides in the @html@
    --     element in each file.
    --
    -- -   @text\/plain@: The input data consists of one or more unformatted
    --     text files. Amazon Translate translates every character in this type
    --     of input.
    --
    -- -   @application\/vnd.openxmlformats-officedocument.wordprocessingml.document@:
    --     The input data consists of one or more Word documents (.docx).
    --
    -- -   @application\/vnd.openxmlformats-officedocument.presentationml.presentation@:
    --     The input data consists of one or more PowerPoint Presentation files
    --     (.pptx).
    --
    -- -   @application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet@:
    --     The input data consists of one or more Excel Workbook files (.xlsx).
    --
    -- -   @application\/x-xliff+xml@: The input data consists of one or more
    --     XML Localization Interchange File Format (XLIFF) files (.xlf).
    --     Amazon Translate supports only XLIFF version 1.2.
    --
    -- If you structure your input data as HTML, ensure that you set this
    -- parameter to @text\/html@. By doing so, you cut costs by limiting the
    -- translation to the contents of the @html@ element in each file.
    -- Otherwise, if you set this parameter to @text\/plain@, your costs will
    -- cover the translation of every character.
    InputDataConfig -> Text
contentType :: Prelude.Text
  }
  deriving (InputDataConfig -> InputDataConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputDataConfig -> InputDataConfig -> Bool
$c/= :: InputDataConfig -> InputDataConfig -> Bool
== :: InputDataConfig -> InputDataConfig -> Bool
$c== :: InputDataConfig -> InputDataConfig -> Bool
Prelude.Eq, ReadPrec [InputDataConfig]
ReadPrec InputDataConfig
Int -> ReadS InputDataConfig
ReadS [InputDataConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputDataConfig]
$creadListPrec :: ReadPrec [InputDataConfig]
readPrec :: ReadPrec InputDataConfig
$creadPrec :: ReadPrec InputDataConfig
readList :: ReadS [InputDataConfig]
$creadList :: ReadS [InputDataConfig]
readsPrec :: Int -> ReadS InputDataConfig
$creadsPrec :: Int -> ReadS InputDataConfig
Prelude.Read, Int -> InputDataConfig -> ShowS
[InputDataConfig] -> ShowS
InputDataConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputDataConfig] -> ShowS
$cshowList :: [InputDataConfig] -> ShowS
show :: InputDataConfig -> String
$cshow :: InputDataConfig -> String
showsPrec :: Int -> InputDataConfig -> ShowS
$cshowsPrec :: Int -> InputDataConfig -> ShowS
Prelude.Show, forall x. Rep InputDataConfig x -> InputDataConfig
forall x. InputDataConfig -> Rep InputDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputDataConfig x -> InputDataConfig
$cfrom :: forall x. InputDataConfig -> Rep InputDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'InputDataConfig' 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:
--
-- 's3Uri', 'inputDataConfig_s3Uri' - The URI of the AWS S3 folder that contains the input files. Amazon
-- Translate translates all the files in the folder and all its
-- sub-folders. The folder must be in the same Region as the API endpoint
-- you are calling.
--
-- 'contentType', 'inputDataConfig_contentType' - Describes the format of the data that you submit to Amazon Translate as
-- input. You can specify one of the following multipurpose internet mail
-- extension (MIME) types:
--
-- -   @text\/html@: The input data consists of one or more HTML files.
--     Amazon Translate translates only the text that resides in the @html@
--     element in each file.
--
-- -   @text\/plain@: The input data consists of one or more unformatted
--     text files. Amazon Translate translates every character in this type
--     of input.
--
-- -   @application\/vnd.openxmlformats-officedocument.wordprocessingml.document@:
--     The input data consists of one or more Word documents (.docx).
--
-- -   @application\/vnd.openxmlformats-officedocument.presentationml.presentation@:
--     The input data consists of one or more PowerPoint Presentation files
--     (.pptx).
--
-- -   @application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet@:
--     The input data consists of one or more Excel Workbook files (.xlsx).
--
-- -   @application\/x-xliff+xml@: The input data consists of one or more
--     XML Localization Interchange File Format (XLIFF) files (.xlf).
--     Amazon Translate supports only XLIFF version 1.2.
--
-- If you structure your input data as HTML, ensure that you set this
-- parameter to @text\/html@. By doing so, you cut costs by limiting the
-- translation to the contents of the @html@ element in each file.
-- Otherwise, if you set this parameter to @text\/plain@, your costs will
-- cover the translation of every character.
newInputDataConfig ::
  -- | 's3Uri'
  Prelude.Text ->
  -- | 'contentType'
  Prelude.Text ->
  InputDataConfig
newInputDataConfig :: Text -> Text -> InputDataConfig
newInputDataConfig Text
pS3Uri_ Text
pContentType_ =
  InputDataConfig'
    { $sel:s3Uri:InputDataConfig' :: Text
s3Uri = Text
pS3Uri_,
      $sel:contentType:InputDataConfig' :: Text
contentType = Text
pContentType_
    }

-- | The URI of the AWS S3 folder that contains the input files. Amazon
-- Translate translates all the files in the folder and all its
-- sub-folders. The folder must be in the same Region as the API endpoint
-- you are calling.
inputDataConfig_s3Uri :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_s3Uri :: Lens' InputDataConfig Text
inputDataConfig_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
s3Uri :: Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
s3Uri} -> Text
s3Uri) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:s3Uri:InputDataConfig' :: Text
s3Uri = Text
a} :: InputDataConfig)

-- | Describes the format of the data that you submit to Amazon Translate as
-- input. You can specify one of the following multipurpose internet mail
-- extension (MIME) types:
--
-- -   @text\/html@: The input data consists of one or more HTML files.
--     Amazon Translate translates only the text that resides in the @html@
--     element in each file.
--
-- -   @text\/plain@: The input data consists of one or more unformatted
--     text files. Amazon Translate translates every character in this type
--     of input.
--
-- -   @application\/vnd.openxmlformats-officedocument.wordprocessingml.document@:
--     The input data consists of one or more Word documents (.docx).
--
-- -   @application\/vnd.openxmlformats-officedocument.presentationml.presentation@:
--     The input data consists of one or more PowerPoint Presentation files
--     (.pptx).
--
-- -   @application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet@:
--     The input data consists of one or more Excel Workbook files (.xlsx).
--
-- -   @application\/x-xliff+xml@: The input data consists of one or more
--     XML Localization Interchange File Format (XLIFF) files (.xlf).
--     Amazon Translate supports only XLIFF version 1.2.
--
-- If you structure your input data as HTML, ensure that you set this
-- parameter to @text\/html@. By doing so, you cut costs by limiting the
-- translation to the contents of the @html@ element in each file.
-- Otherwise, if you set this parameter to @text\/plain@, your costs will
-- cover the translation of every character.
inputDataConfig_contentType :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_contentType :: Lens' InputDataConfig Text
inputDataConfig_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
contentType :: Text
$sel:contentType:InputDataConfig' :: InputDataConfig -> Text
contentType} -> Text
contentType) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:contentType:InputDataConfig' :: Text
contentType = Text
a} :: InputDataConfig)

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

instance Prelude.Hashable InputDataConfig where
  hashWithSalt :: Int -> InputDataConfig -> Int
hashWithSalt Int
_salt InputDataConfig' {Text
contentType :: Text
s3Uri :: Text
$sel:contentType:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contentType

instance Prelude.NFData InputDataConfig where
  rnf :: InputDataConfig -> ()
rnf InputDataConfig' {Text
contentType :: Text
s3Uri :: Text
$sel:contentType:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contentType

instance Data.ToJSON InputDataConfig where
  toJSON :: InputDataConfig -> Value
toJSON InputDataConfig' {Text
contentType :: Text
s3Uri :: Text
$sel:contentType:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri),
            forall a. a -> Maybe a
Prelude.Just (Key
"ContentType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contentType)
          ]
      )