{-# 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.Transcribe.Types.ContentRedaction
-- 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.Transcribe.Types.ContentRedaction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transcribe.Types.RedactionOutput
import Amazonka.Transcribe.Types.RedactionType

-- | Settings for content redaction within a transcription job.
--
-- /See:/ 'newContentRedaction' smart constructor.
data ContentRedaction = ContentRedaction'
  { -- | Request parameter that defines the entities to be redacted. The only
    -- accepted value is @PII@.
    ContentRedaction -> RedactionType
redactionType :: RedactionType,
    -- | The output transcript file stored in either the default S3 bucket or in
    -- a bucket you specify.
    --
    -- When you choose @redacted@ Amazon Transcribe outputs only the redacted
    -- transcript.
    --
    -- When you choose @redacted_and_unredacted@ Amazon Transcribe outputs both
    -- the redacted and unredacted transcripts.
    ContentRedaction -> RedactionOutput
redactionOutput :: RedactionOutput
  }
  deriving (ContentRedaction -> ContentRedaction -> Bool
(ContentRedaction -> ContentRedaction -> Bool)
-> (ContentRedaction -> ContentRedaction -> Bool)
-> Eq ContentRedaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContentRedaction -> ContentRedaction -> Bool
$c/= :: ContentRedaction -> ContentRedaction -> Bool
== :: ContentRedaction -> ContentRedaction -> Bool
$c== :: ContentRedaction -> ContentRedaction -> Bool
Prelude.Eq, ReadPrec [ContentRedaction]
ReadPrec ContentRedaction
Int -> ReadS ContentRedaction
ReadS [ContentRedaction]
(Int -> ReadS ContentRedaction)
-> ReadS [ContentRedaction]
-> ReadPrec ContentRedaction
-> ReadPrec [ContentRedaction]
-> Read ContentRedaction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContentRedaction]
$creadListPrec :: ReadPrec [ContentRedaction]
readPrec :: ReadPrec ContentRedaction
$creadPrec :: ReadPrec ContentRedaction
readList :: ReadS [ContentRedaction]
$creadList :: ReadS [ContentRedaction]
readsPrec :: Int -> ReadS ContentRedaction
$creadsPrec :: Int -> ReadS ContentRedaction
Prelude.Read, Int -> ContentRedaction -> ShowS
[ContentRedaction] -> ShowS
ContentRedaction -> String
(Int -> ContentRedaction -> ShowS)
-> (ContentRedaction -> String)
-> ([ContentRedaction] -> ShowS)
-> Show ContentRedaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContentRedaction] -> ShowS
$cshowList :: [ContentRedaction] -> ShowS
show :: ContentRedaction -> String
$cshow :: ContentRedaction -> String
showsPrec :: Int -> ContentRedaction -> ShowS
$cshowsPrec :: Int -> ContentRedaction -> ShowS
Prelude.Show, (forall x. ContentRedaction -> Rep ContentRedaction x)
-> (forall x. Rep ContentRedaction x -> ContentRedaction)
-> Generic ContentRedaction
forall x. Rep ContentRedaction x -> ContentRedaction
forall x. ContentRedaction -> Rep ContentRedaction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContentRedaction x -> ContentRedaction
$cfrom :: forall x. ContentRedaction -> Rep ContentRedaction x
Prelude.Generic)

-- |
-- Create a value of 'ContentRedaction' 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:
--
-- 'redactionType', 'contentRedaction_redactionType' - Request parameter that defines the entities to be redacted. The only
-- accepted value is @PII@.
--
-- 'redactionOutput', 'contentRedaction_redactionOutput' - The output transcript file stored in either the default S3 bucket or in
-- a bucket you specify.
--
-- When you choose @redacted@ Amazon Transcribe outputs only the redacted
-- transcript.
--
-- When you choose @redacted_and_unredacted@ Amazon Transcribe outputs both
-- the redacted and unredacted transcripts.
newContentRedaction ::
  -- | 'redactionType'
  RedactionType ->
  -- | 'redactionOutput'
  RedactionOutput ->
  ContentRedaction
newContentRedaction :: RedactionType -> RedactionOutput -> ContentRedaction
newContentRedaction RedactionType
pRedactionType_ RedactionOutput
pRedactionOutput_ =
  ContentRedaction' :: RedactionType -> RedactionOutput -> ContentRedaction
ContentRedaction'
    { $sel:redactionType:ContentRedaction' :: RedactionType
redactionType = RedactionType
pRedactionType_,
      $sel:redactionOutput:ContentRedaction' :: RedactionOutput
redactionOutput = RedactionOutput
pRedactionOutput_
    }

-- | Request parameter that defines the entities to be redacted. The only
-- accepted value is @PII@.
contentRedaction_redactionType :: Lens.Lens' ContentRedaction RedactionType
contentRedaction_redactionType :: (RedactionType -> f RedactionType)
-> ContentRedaction -> f ContentRedaction
contentRedaction_redactionType = (ContentRedaction -> RedactionType)
-> (ContentRedaction -> RedactionType -> ContentRedaction)
-> Lens
     ContentRedaction ContentRedaction RedactionType RedactionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentRedaction' {RedactionType
redactionType :: RedactionType
$sel:redactionType:ContentRedaction' :: ContentRedaction -> RedactionType
redactionType} -> RedactionType
redactionType) (\s :: ContentRedaction
s@ContentRedaction' {} RedactionType
a -> ContentRedaction
s {$sel:redactionType:ContentRedaction' :: RedactionType
redactionType = RedactionType
a} :: ContentRedaction)

-- | The output transcript file stored in either the default S3 bucket or in
-- a bucket you specify.
--
-- When you choose @redacted@ Amazon Transcribe outputs only the redacted
-- transcript.
--
-- When you choose @redacted_and_unredacted@ Amazon Transcribe outputs both
-- the redacted and unredacted transcripts.
contentRedaction_redactionOutput :: Lens.Lens' ContentRedaction RedactionOutput
contentRedaction_redactionOutput :: (RedactionOutput -> f RedactionOutput)
-> ContentRedaction -> f ContentRedaction
contentRedaction_redactionOutput = (ContentRedaction -> RedactionOutput)
-> (ContentRedaction -> RedactionOutput -> ContentRedaction)
-> Lens
     ContentRedaction ContentRedaction RedactionOutput RedactionOutput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentRedaction' {RedactionOutput
redactionOutput :: RedactionOutput
$sel:redactionOutput:ContentRedaction' :: ContentRedaction -> RedactionOutput
redactionOutput} -> RedactionOutput
redactionOutput) (\s :: ContentRedaction
s@ContentRedaction' {} RedactionOutput
a -> ContentRedaction
s {$sel:redactionOutput:ContentRedaction' :: RedactionOutput
redactionOutput = RedactionOutput
a} :: ContentRedaction)

instance Core.FromJSON ContentRedaction where
  parseJSON :: Value -> Parser ContentRedaction
parseJSON =
    String
-> (Object -> Parser ContentRedaction)
-> Value
-> Parser ContentRedaction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContentRedaction"
      ( \Object
x ->
          RedactionType -> RedactionOutput -> ContentRedaction
ContentRedaction'
            (RedactionType -> RedactionOutput -> ContentRedaction)
-> Parser RedactionType
-> Parser (RedactionOutput -> ContentRedaction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser RedactionType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RedactionType")
            Parser (RedactionOutput -> ContentRedaction)
-> Parser RedactionOutput -> Parser ContentRedaction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RedactionOutput
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RedactionOutput")
      )

instance Prelude.Hashable ContentRedaction

instance Prelude.NFData ContentRedaction

instance Core.ToJSON ContentRedaction where
  toJSON :: ContentRedaction -> Value
toJSON ContentRedaction' {RedactionOutput
RedactionType
redactionOutput :: RedactionOutput
redactionType :: RedactionType
$sel:redactionOutput:ContentRedaction' :: ContentRedaction -> RedactionOutput
$sel:redactionType:ContentRedaction' :: ContentRedaction -> RedactionType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RedactionType" Text -> RedactionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RedactionType
redactionType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RedactionOutput" Text -> RedactionOutput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RedactionOutput
redactionOutput)
          ]
      )