{-# 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.SubtitlesOutput
-- 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.Transcribe.Types.SubtitlesOutput 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
import Amazonka.Transcribe.Types.SubtitleFormat

-- | Provides information about your subtitle file, including format, start
-- index, and Amazon S3 location.
--
-- /See:/ 'newSubtitlesOutput' smart constructor.
data SubtitlesOutput = SubtitlesOutput'
  { -- | Provides the format of your subtitle files. If your request included
    -- both WebVTT (@vtt@) and SubRip (@srt@) formats, both formats are shown.
    SubtitlesOutput -> Maybe [SubtitleFormat]
formats :: Prelude.Maybe [SubtitleFormat],
    -- | Provides the start index value for your subtitle files. If you did not
    -- specify a value in your request, the default value of @0@ is used.
    SubtitlesOutput -> Maybe Natural
outputStartIndex :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon S3 location of your transcript. You can use this URI to
    -- access or download your subtitle file. Your subtitle file is stored in
    -- the same location as your transcript. If you specified both WebVTT and
    -- SubRip subtitle formats, two URIs are provided.
    --
    -- If you included @OutputBucketName@ in your transcription job request,
    -- this is the URI of that bucket. If you also included @OutputKey@ in your
    -- request, your output is located in the path you specified in your
    -- request.
    --
    -- If you didn\'t include @OutputBucketName@ in your transcription job
    -- request, your subtitle file is stored in a service-managed bucket, and
    -- @TranscriptFileUri@ provides you with a temporary URI you can use for
    -- secure access to your subtitle file.
    --
    -- Temporary URIs for service-managed Amazon S3 buckets are only valid for
    -- 15 minutes. If you get an @AccesDenied@ error, you can get a new
    -- temporary URI by running a @GetTranscriptionJob@ or
    -- @ListTranscriptionJob@ request.
    SubtitlesOutput -> Maybe [Text]
subtitleFileUris :: Prelude.Maybe [Prelude.Text]
  }
  deriving (SubtitlesOutput -> SubtitlesOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubtitlesOutput -> SubtitlesOutput -> Bool
$c/= :: SubtitlesOutput -> SubtitlesOutput -> Bool
== :: SubtitlesOutput -> SubtitlesOutput -> Bool
$c== :: SubtitlesOutput -> SubtitlesOutput -> Bool
Prelude.Eq, ReadPrec [SubtitlesOutput]
ReadPrec SubtitlesOutput
Int -> ReadS SubtitlesOutput
ReadS [SubtitlesOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubtitlesOutput]
$creadListPrec :: ReadPrec [SubtitlesOutput]
readPrec :: ReadPrec SubtitlesOutput
$creadPrec :: ReadPrec SubtitlesOutput
readList :: ReadS [SubtitlesOutput]
$creadList :: ReadS [SubtitlesOutput]
readsPrec :: Int -> ReadS SubtitlesOutput
$creadsPrec :: Int -> ReadS SubtitlesOutput
Prelude.Read, Int -> SubtitlesOutput -> ShowS
[SubtitlesOutput] -> ShowS
SubtitlesOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubtitlesOutput] -> ShowS
$cshowList :: [SubtitlesOutput] -> ShowS
show :: SubtitlesOutput -> String
$cshow :: SubtitlesOutput -> String
showsPrec :: Int -> SubtitlesOutput -> ShowS
$cshowsPrec :: Int -> SubtitlesOutput -> ShowS
Prelude.Show, forall x. Rep SubtitlesOutput x -> SubtitlesOutput
forall x. SubtitlesOutput -> Rep SubtitlesOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubtitlesOutput x -> SubtitlesOutput
$cfrom :: forall x. SubtitlesOutput -> Rep SubtitlesOutput x
Prelude.Generic)

-- |
-- Create a value of 'SubtitlesOutput' 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:
--
-- 'formats', 'subtitlesOutput_formats' - Provides the format of your subtitle files. If your request included
-- both WebVTT (@vtt@) and SubRip (@srt@) formats, both formats are shown.
--
-- 'outputStartIndex', 'subtitlesOutput_outputStartIndex' - Provides the start index value for your subtitle files. If you did not
-- specify a value in your request, the default value of @0@ is used.
--
-- 'subtitleFileUris', 'subtitlesOutput_subtitleFileUris' - The Amazon S3 location of your transcript. You can use this URI to
-- access or download your subtitle file. Your subtitle file is stored in
-- the same location as your transcript. If you specified both WebVTT and
-- SubRip subtitle formats, two URIs are provided.
--
-- If you included @OutputBucketName@ in your transcription job request,
-- this is the URI of that bucket. If you also included @OutputKey@ in your
-- request, your output is located in the path you specified in your
-- request.
--
-- If you didn\'t include @OutputBucketName@ in your transcription job
-- request, your subtitle file is stored in a service-managed bucket, and
-- @TranscriptFileUri@ provides you with a temporary URI you can use for
-- secure access to your subtitle file.
--
-- Temporary URIs for service-managed Amazon S3 buckets are only valid for
-- 15 minutes. If you get an @AccesDenied@ error, you can get a new
-- temporary URI by running a @GetTranscriptionJob@ or
-- @ListTranscriptionJob@ request.
newSubtitlesOutput ::
  SubtitlesOutput
newSubtitlesOutput :: SubtitlesOutput
newSubtitlesOutput =
  SubtitlesOutput'
    { $sel:formats:SubtitlesOutput' :: Maybe [SubtitleFormat]
formats = forall a. Maybe a
Prelude.Nothing,
      $sel:outputStartIndex:SubtitlesOutput' :: Maybe Natural
outputStartIndex = forall a. Maybe a
Prelude.Nothing,
      $sel:subtitleFileUris:SubtitlesOutput' :: Maybe [Text]
subtitleFileUris = forall a. Maybe a
Prelude.Nothing
    }

-- | Provides the format of your subtitle files. If your request included
-- both WebVTT (@vtt@) and SubRip (@srt@) formats, both formats are shown.
subtitlesOutput_formats :: Lens.Lens' SubtitlesOutput (Prelude.Maybe [SubtitleFormat])
subtitlesOutput_formats :: Lens' SubtitlesOutput (Maybe [SubtitleFormat])
subtitlesOutput_formats = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubtitlesOutput' {Maybe [SubtitleFormat]
formats :: Maybe [SubtitleFormat]
$sel:formats:SubtitlesOutput' :: SubtitlesOutput -> Maybe [SubtitleFormat]
formats} -> Maybe [SubtitleFormat]
formats) (\s :: SubtitlesOutput
s@SubtitlesOutput' {} Maybe [SubtitleFormat]
a -> SubtitlesOutput
s {$sel:formats:SubtitlesOutput' :: Maybe [SubtitleFormat]
formats = Maybe [SubtitleFormat]
a} :: SubtitlesOutput) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provides the start index value for your subtitle files. If you did not
-- specify a value in your request, the default value of @0@ is used.
subtitlesOutput_outputStartIndex :: Lens.Lens' SubtitlesOutput (Prelude.Maybe Prelude.Natural)
subtitlesOutput_outputStartIndex :: Lens' SubtitlesOutput (Maybe Natural)
subtitlesOutput_outputStartIndex = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubtitlesOutput' {Maybe Natural
outputStartIndex :: Maybe Natural
$sel:outputStartIndex:SubtitlesOutput' :: SubtitlesOutput -> Maybe Natural
outputStartIndex} -> Maybe Natural
outputStartIndex) (\s :: SubtitlesOutput
s@SubtitlesOutput' {} Maybe Natural
a -> SubtitlesOutput
s {$sel:outputStartIndex:SubtitlesOutput' :: Maybe Natural
outputStartIndex = Maybe Natural
a} :: SubtitlesOutput)

-- | The Amazon S3 location of your transcript. You can use this URI to
-- access or download your subtitle file. Your subtitle file is stored in
-- the same location as your transcript. If you specified both WebVTT and
-- SubRip subtitle formats, two URIs are provided.
--
-- If you included @OutputBucketName@ in your transcription job request,
-- this is the URI of that bucket. If you also included @OutputKey@ in your
-- request, your output is located in the path you specified in your
-- request.
--
-- If you didn\'t include @OutputBucketName@ in your transcription job
-- request, your subtitle file is stored in a service-managed bucket, and
-- @TranscriptFileUri@ provides you with a temporary URI you can use for
-- secure access to your subtitle file.
--
-- Temporary URIs for service-managed Amazon S3 buckets are only valid for
-- 15 minutes. If you get an @AccesDenied@ error, you can get a new
-- temporary URI by running a @GetTranscriptionJob@ or
-- @ListTranscriptionJob@ request.
subtitlesOutput_subtitleFileUris :: Lens.Lens' SubtitlesOutput (Prelude.Maybe [Prelude.Text])
subtitlesOutput_subtitleFileUris :: Lens' SubtitlesOutput (Maybe [Text])
subtitlesOutput_subtitleFileUris = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubtitlesOutput' {Maybe [Text]
subtitleFileUris :: Maybe [Text]
$sel:subtitleFileUris:SubtitlesOutput' :: SubtitlesOutput -> Maybe [Text]
subtitleFileUris} -> Maybe [Text]
subtitleFileUris) (\s :: SubtitlesOutput
s@SubtitlesOutput' {} Maybe [Text]
a -> SubtitlesOutput
s {$sel:subtitleFileUris:SubtitlesOutput' :: Maybe [Text]
subtitleFileUris = Maybe [Text]
a} :: SubtitlesOutput) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON SubtitlesOutput where
  parseJSON :: Value -> Parser SubtitlesOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SubtitlesOutput"
      ( \Object
x ->
          Maybe [SubtitleFormat]
-> Maybe Natural -> Maybe [Text] -> SubtitlesOutput
SubtitlesOutput'
            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
"Formats" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"OutputStartIndex")
            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
"SubtitleFileUris"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SubtitlesOutput where
  hashWithSalt :: Int -> SubtitlesOutput -> Int
hashWithSalt Int
_salt SubtitlesOutput' {Maybe Natural
Maybe [Text]
Maybe [SubtitleFormat]
subtitleFileUris :: Maybe [Text]
outputStartIndex :: Maybe Natural
formats :: Maybe [SubtitleFormat]
$sel:subtitleFileUris:SubtitlesOutput' :: SubtitlesOutput -> Maybe [Text]
$sel:outputStartIndex:SubtitlesOutput' :: SubtitlesOutput -> Maybe Natural
$sel:formats:SubtitlesOutput' :: SubtitlesOutput -> Maybe [SubtitleFormat]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SubtitleFormat]
formats
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
outputStartIndex
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subtitleFileUris

instance Prelude.NFData SubtitlesOutput where
  rnf :: SubtitlesOutput -> ()
rnf SubtitlesOutput' {Maybe Natural
Maybe [Text]
Maybe [SubtitleFormat]
subtitleFileUris :: Maybe [Text]
outputStartIndex :: Maybe Natural
formats :: Maybe [SubtitleFormat]
$sel:subtitleFileUris:SubtitlesOutput' :: SubtitlesOutput -> Maybe [Text]
$sel:outputStartIndex:SubtitlesOutput' :: SubtitlesOutput -> Maybe Natural
$sel:formats:SubtitlesOutput' :: SubtitlesOutput -> Maybe [SubtitleFormat]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SubtitleFormat]
formats
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
outputStartIndex
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subtitleFileUris