{-# 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.Subtitles
-- 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.Subtitles 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

-- | Generate subtitles for your media file with your transcription request.
--
-- You can choose a start index of 0 or 1, and you can specify either
-- WebVTT or SubRip (or both) as your output format.
--
-- Note that your subtitle files are placed in the same location as your
-- transcription output.
--
-- /See:/ 'newSubtitles' smart constructor.
data Subtitles = Subtitles'
  { -- | Specify the output format for your subtitle file; if you select both
    -- WebVTT (@vtt@) and SubRip (@srt@) formats, two output files are
    -- generated.
    Subtitles -> Maybe [SubtitleFormat]
formats :: Prelude.Maybe [SubtitleFormat],
    -- | Specify the starting value that is assigned to the first subtitle
    -- segment.
    --
    -- The default start index for Amazon Transcribe is @0@, which differs from
    -- the more widely used standard of @1@. If you\'re uncertain which value
    -- to use, we recommend choosing @1@, as this may improve compatibility
    -- with other services.
    Subtitles -> Maybe Natural
outputStartIndex :: Prelude.Maybe Prelude.Natural
  }
  deriving (Subtitles -> Subtitles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Subtitles -> Subtitles -> Bool
$c/= :: Subtitles -> Subtitles -> Bool
== :: Subtitles -> Subtitles -> Bool
$c== :: Subtitles -> Subtitles -> Bool
Prelude.Eq, ReadPrec [Subtitles]
ReadPrec Subtitles
Int -> ReadS Subtitles
ReadS [Subtitles]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Subtitles]
$creadListPrec :: ReadPrec [Subtitles]
readPrec :: ReadPrec Subtitles
$creadPrec :: ReadPrec Subtitles
readList :: ReadS [Subtitles]
$creadList :: ReadS [Subtitles]
readsPrec :: Int -> ReadS Subtitles
$creadsPrec :: Int -> ReadS Subtitles
Prelude.Read, Int -> Subtitles -> ShowS
[Subtitles] -> ShowS
Subtitles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Subtitles] -> ShowS
$cshowList :: [Subtitles] -> ShowS
show :: Subtitles -> String
$cshow :: Subtitles -> String
showsPrec :: Int -> Subtitles -> ShowS
$cshowsPrec :: Int -> Subtitles -> ShowS
Prelude.Show, forall x. Rep Subtitles x -> Subtitles
forall x. Subtitles -> Rep Subtitles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Subtitles x -> Subtitles
$cfrom :: forall x. Subtitles -> Rep Subtitles x
Prelude.Generic)

-- |
-- Create a value of 'Subtitles' 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', 'subtitles_formats' - Specify the output format for your subtitle file; if you select both
-- WebVTT (@vtt@) and SubRip (@srt@) formats, two output files are
-- generated.
--
-- 'outputStartIndex', 'subtitles_outputStartIndex' - Specify the starting value that is assigned to the first subtitle
-- segment.
--
-- The default start index for Amazon Transcribe is @0@, which differs from
-- the more widely used standard of @1@. If you\'re uncertain which value
-- to use, we recommend choosing @1@, as this may improve compatibility
-- with other services.
newSubtitles ::
  Subtitles
newSubtitles :: Subtitles
newSubtitles =
  Subtitles'
    { $sel:formats:Subtitles' :: Maybe [SubtitleFormat]
formats = forall a. Maybe a
Prelude.Nothing,
      $sel:outputStartIndex:Subtitles' :: Maybe Natural
outputStartIndex = forall a. Maybe a
Prelude.Nothing
    }

-- | Specify the output format for your subtitle file; if you select both
-- WebVTT (@vtt@) and SubRip (@srt@) formats, two output files are
-- generated.
subtitles_formats :: Lens.Lens' Subtitles (Prelude.Maybe [SubtitleFormat])
subtitles_formats :: Lens' Subtitles (Maybe [SubtitleFormat])
subtitles_formats = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subtitles' {Maybe [SubtitleFormat]
formats :: Maybe [SubtitleFormat]
$sel:formats:Subtitles' :: Subtitles -> Maybe [SubtitleFormat]
formats} -> Maybe [SubtitleFormat]
formats) (\s :: Subtitles
s@Subtitles' {} Maybe [SubtitleFormat]
a -> Subtitles
s {$sel:formats:Subtitles' :: Maybe [SubtitleFormat]
formats = Maybe [SubtitleFormat]
a} :: Subtitles) 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

-- | Specify the starting value that is assigned to the first subtitle
-- segment.
--
-- The default start index for Amazon Transcribe is @0@, which differs from
-- the more widely used standard of @1@. If you\'re uncertain which value
-- to use, we recommend choosing @1@, as this may improve compatibility
-- with other services.
subtitles_outputStartIndex :: Lens.Lens' Subtitles (Prelude.Maybe Prelude.Natural)
subtitles_outputStartIndex :: Lens' Subtitles (Maybe Natural)
subtitles_outputStartIndex = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subtitles' {Maybe Natural
outputStartIndex :: Maybe Natural
$sel:outputStartIndex:Subtitles' :: Subtitles -> Maybe Natural
outputStartIndex} -> Maybe Natural
outputStartIndex) (\s :: Subtitles
s@Subtitles' {} Maybe Natural
a -> Subtitles
s {$sel:outputStartIndex:Subtitles' :: Maybe Natural
outputStartIndex = Maybe Natural
a} :: Subtitles)

instance Prelude.Hashable Subtitles where
  hashWithSalt :: Int -> Subtitles -> Int
hashWithSalt Int
_salt Subtitles' {Maybe Natural
Maybe [SubtitleFormat]
outputStartIndex :: Maybe Natural
formats :: Maybe [SubtitleFormat]
$sel:outputStartIndex:Subtitles' :: Subtitles -> Maybe Natural
$sel:formats:Subtitles' :: Subtitles -> 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

instance Prelude.NFData Subtitles where
  rnf :: Subtitles -> ()
rnf Subtitles' {Maybe Natural
Maybe [SubtitleFormat]
outputStartIndex :: Maybe Natural
formats :: Maybe [SubtitleFormat]
$sel:outputStartIndex:Subtitles' :: Subtitles -> Maybe Natural
$sel:formats:Subtitles' :: Subtitles -> 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

instance Data.ToJSON Subtitles where
  toJSON :: Subtitles -> Value
toJSON Subtitles' {Maybe Natural
Maybe [SubtitleFormat]
outputStartIndex :: Maybe Natural
formats :: Maybe [SubtitleFormat]
$sel:outputStartIndex:Subtitles' :: Subtitles -> Maybe Natural
$sel:formats:Subtitles' :: Subtitles -> Maybe [SubtitleFormat]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Formats" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SubtitleFormat]
formats,
            (Key
"OutputStartIndex" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
outputStartIndex
          ]
      )