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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the input media file in a transcription request.
--
-- /See:/ 'newMedia' smart constructor.
data Media = Media'
  { -- | The S3 object location of the input media file. The URI must be in the
    -- same region as the API endpoint that you are calling. The general form
    -- is:
    --
    -- For example:
    --
    -- For more information about S3 object names, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys Object Keys>
    -- in the /Amazon S3 Developer Guide/.
    Media -> Maybe Text
mediaFileUri :: Prelude.Maybe Prelude.Text,
    -- | The S3 object location for your redacted output media file. This is only
    -- supported for call analytics jobs.
    Media -> Maybe Text
redactedMediaFileUri :: Prelude.Maybe Prelude.Text
  }
  deriving (Media -> Media -> Bool
(Media -> Media -> Bool) -> (Media -> Media -> Bool) -> Eq Media
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Media -> Media -> Bool
$c/= :: Media -> Media -> Bool
== :: Media -> Media -> Bool
$c== :: Media -> Media -> Bool
Prelude.Eq, ReadPrec [Media]
ReadPrec Media
Int -> ReadS Media
ReadS [Media]
(Int -> ReadS Media)
-> ReadS [Media]
-> ReadPrec Media
-> ReadPrec [Media]
-> Read Media
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Media]
$creadListPrec :: ReadPrec [Media]
readPrec :: ReadPrec Media
$creadPrec :: ReadPrec Media
readList :: ReadS [Media]
$creadList :: ReadS [Media]
readsPrec :: Int -> ReadS Media
$creadsPrec :: Int -> ReadS Media
Prelude.Read, Int -> Media -> ShowS
[Media] -> ShowS
Media -> String
(Int -> Media -> ShowS)
-> (Media -> String) -> ([Media] -> ShowS) -> Show Media
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Media] -> ShowS
$cshowList :: [Media] -> ShowS
show :: Media -> String
$cshow :: Media -> String
showsPrec :: Int -> Media -> ShowS
$cshowsPrec :: Int -> Media -> ShowS
Prelude.Show, (forall x. Media -> Rep Media x)
-> (forall x. Rep Media x -> Media) -> Generic Media
forall x. Rep Media x -> Media
forall x. Media -> Rep Media x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Media x -> Media
$cfrom :: forall x. Media -> Rep Media x
Prelude.Generic)

-- |
-- Create a value of 'Media' 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:
--
-- 'mediaFileUri', 'media_mediaFileUri' - The S3 object location of the input media file. The URI must be in the
-- same region as the API endpoint that you are calling. The general form
-- is:
--
-- For example:
--
-- For more information about S3 object names, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys Object Keys>
-- in the /Amazon S3 Developer Guide/.
--
-- 'redactedMediaFileUri', 'media_redactedMediaFileUri' - The S3 object location for your redacted output media file. This is only
-- supported for call analytics jobs.
newMedia ::
  Media
newMedia :: Media
newMedia =
  Media' :: Maybe Text -> Maybe Text -> Media
Media'
    { $sel:mediaFileUri:Media' :: Maybe Text
mediaFileUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:redactedMediaFileUri:Media' :: Maybe Text
redactedMediaFileUri = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The S3 object location of the input media file. The URI must be in the
-- same region as the API endpoint that you are calling. The general form
-- is:
--
-- For example:
--
-- For more information about S3 object names, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys Object Keys>
-- in the /Amazon S3 Developer Guide/.
media_mediaFileUri :: Lens.Lens' Media (Prelude.Maybe Prelude.Text)
media_mediaFileUri :: (Maybe Text -> f (Maybe Text)) -> Media -> f Media
media_mediaFileUri = (Media -> Maybe Text)
-> (Media -> Maybe Text -> Media)
-> Lens Media Media (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Media' {Maybe Text
mediaFileUri :: Maybe Text
$sel:mediaFileUri:Media' :: Media -> Maybe Text
mediaFileUri} -> Maybe Text
mediaFileUri) (\s :: Media
s@Media' {} Maybe Text
a -> Media
s {$sel:mediaFileUri:Media' :: Maybe Text
mediaFileUri = Maybe Text
a} :: Media)

-- | The S3 object location for your redacted output media file. This is only
-- supported for call analytics jobs.
media_redactedMediaFileUri :: Lens.Lens' Media (Prelude.Maybe Prelude.Text)
media_redactedMediaFileUri :: (Maybe Text -> f (Maybe Text)) -> Media -> f Media
media_redactedMediaFileUri = (Media -> Maybe Text)
-> (Media -> Maybe Text -> Media)
-> Lens Media Media (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Media' {Maybe Text
redactedMediaFileUri :: Maybe Text
$sel:redactedMediaFileUri:Media' :: Media -> Maybe Text
redactedMediaFileUri} -> Maybe Text
redactedMediaFileUri) (\s :: Media
s@Media' {} Maybe Text
a -> Media
s {$sel:redactedMediaFileUri:Media' :: Maybe Text
redactedMediaFileUri = Maybe Text
a} :: Media)

instance Core.FromJSON Media where
  parseJSON :: Value -> Parser Media
parseJSON =
    String -> (Object -> Parser Media) -> Value -> Parser Media
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Media"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Media
Media'
            (Maybe Text -> Maybe Text -> Media)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Media)
forall (f :: * -> *) a b. Functor 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
"MediaFileUri")
            Parser (Maybe Text -> Media) -> Parser (Maybe Text) -> Parser Media
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
"RedactedMediaFileUri")
      )

instance Prelude.Hashable Media

instance Prelude.NFData Media

instance Core.ToJSON Media where
  toJSON :: Media -> Value
toJSON Media' {Maybe Text
redactedMediaFileUri :: Maybe Text
mediaFileUri :: Maybe Text
$sel:redactedMediaFileUri:Media' :: Media -> Maybe Text
$sel:mediaFileUri:Media' :: Media -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MediaFileUri" 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
mediaFileUri,
            (Text
"RedactedMediaFileUri" 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
redactedMediaFileUri
          ]
      )