{-# 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.ElasticTranscoder.Types.CaptionSource
-- 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.ElasticTranscoder.Types.CaptionSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticTranscoder.Types.Encryption
import qualified Amazonka.Prelude as Prelude

-- | A source file for the input sidecar captions used during the transcoding
-- process.
--
-- /See:/ 'newCaptionSource' smart constructor.
data CaptionSource = CaptionSource'
  { -- | The encryption settings, if any, that Elastic Transcoder needs to
    -- decyrpt your caption sources, or that you want Elastic Transcoder to
    -- apply to your caption sources.
    CaptionSource -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
    -- | The name of the sidecar caption file that you want Elastic Transcoder to
    -- include in the output file.
    CaptionSource -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The label of the caption shown in the player when choosing a language.
    -- We recommend that you put the caption language name here, in the
    -- language of the captions.
    CaptionSource -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | A string that specifies the language of the caption. If you specified
    -- multiple inputs with captions, the caption language must match in order
    -- to be included in the output. Specify this as one of:
    --
    -- -   2-character ISO 639-1 code
    --
    -- -   3-character ISO 639-2 code
    --
    -- For more information on ISO language codes and language names, see the
    -- List of ISO 639-1 codes.
    CaptionSource -> Maybe Text
language :: Prelude.Maybe Prelude.Text,
    -- | For clip generation or captions that do not start at the same time as
    -- the associated video file, the @TimeOffset@ tells Elastic Transcoder how
    -- much of the video to encode before including captions.
    --
    -- Specify the TimeOffset in the form [+-]SS.sss or [+-]HH:mm:SS.ss.
    CaptionSource -> Maybe Text
timeOffset :: Prelude.Maybe Prelude.Text
  }
  deriving (CaptionSource -> CaptionSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionSource -> CaptionSource -> Bool
$c/= :: CaptionSource -> CaptionSource -> Bool
== :: CaptionSource -> CaptionSource -> Bool
$c== :: CaptionSource -> CaptionSource -> Bool
Prelude.Eq, ReadPrec [CaptionSource]
ReadPrec CaptionSource
Int -> ReadS CaptionSource
ReadS [CaptionSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionSource]
$creadListPrec :: ReadPrec [CaptionSource]
readPrec :: ReadPrec CaptionSource
$creadPrec :: ReadPrec CaptionSource
readList :: ReadS [CaptionSource]
$creadList :: ReadS [CaptionSource]
readsPrec :: Int -> ReadS CaptionSource
$creadsPrec :: Int -> ReadS CaptionSource
Prelude.Read, Int -> CaptionSource -> ShowS
[CaptionSource] -> ShowS
CaptionSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionSource] -> ShowS
$cshowList :: [CaptionSource] -> ShowS
show :: CaptionSource -> String
$cshow :: CaptionSource -> String
showsPrec :: Int -> CaptionSource -> ShowS
$cshowsPrec :: Int -> CaptionSource -> ShowS
Prelude.Show, forall x. Rep CaptionSource x -> CaptionSource
forall x. CaptionSource -> Rep CaptionSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptionSource x -> CaptionSource
$cfrom :: forall x. CaptionSource -> Rep CaptionSource x
Prelude.Generic)

-- |
-- Create a value of 'CaptionSource' 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:
--
-- 'encryption', 'captionSource_encryption' - The encryption settings, if any, that Elastic Transcoder needs to
-- decyrpt your caption sources, or that you want Elastic Transcoder to
-- apply to your caption sources.
--
-- 'key', 'captionSource_key' - The name of the sidecar caption file that you want Elastic Transcoder to
-- include in the output file.
--
-- 'label', 'captionSource_label' - The label of the caption shown in the player when choosing a language.
-- We recommend that you put the caption language name here, in the
-- language of the captions.
--
-- 'language', 'captionSource_language' - A string that specifies the language of the caption. If you specified
-- multiple inputs with captions, the caption language must match in order
-- to be included in the output. Specify this as one of:
--
-- -   2-character ISO 639-1 code
--
-- -   3-character ISO 639-2 code
--
-- For more information on ISO language codes and language names, see the
-- List of ISO 639-1 codes.
--
-- 'timeOffset', 'captionSource_timeOffset' - For clip generation or captions that do not start at the same time as
-- the associated video file, the @TimeOffset@ tells Elastic Transcoder how
-- much of the video to encode before including captions.
--
-- Specify the TimeOffset in the form [+-]SS.sss or [+-]HH:mm:SS.ss.
newCaptionSource ::
  CaptionSource
newCaptionSource :: CaptionSource
newCaptionSource =
  CaptionSource'
    { $sel:encryption:CaptionSource' :: Maybe Encryption
encryption = forall a. Maybe a
Prelude.Nothing,
      $sel:key:CaptionSource' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:label:CaptionSource' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:language:CaptionSource' :: Maybe Text
language = forall a. Maybe a
Prelude.Nothing,
      $sel:timeOffset:CaptionSource' :: Maybe Text
timeOffset = forall a. Maybe a
Prelude.Nothing
    }

-- | The encryption settings, if any, that Elastic Transcoder needs to
-- decyrpt your caption sources, or that you want Elastic Transcoder to
-- apply to your caption sources.
captionSource_encryption :: Lens.Lens' CaptionSource (Prelude.Maybe Encryption)
captionSource_encryption :: Lens' CaptionSource (Maybe Encryption)
captionSource_encryption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:CaptionSource' :: CaptionSource -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: CaptionSource
s@CaptionSource' {} Maybe Encryption
a -> CaptionSource
s {$sel:encryption:CaptionSource' :: Maybe Encryption
encryption = Maybe Encryption
a} :: CaptionSource)

-- | The name of the sidecar caption file that you want Elastic Transcoder to
-- include in the output file.
captionSource_key :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_key :: Lens' CaptionSource (Maybe Text)
captionSource_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
key :: Maybe Text
$sel:key:CaptionSource' :: CaptionSource -> Maybe Text
key} -> Maybe Text
key) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:key:CaptionSource' :: Maybe Text
key = Maybe Text
a} :: CaptionSource)

-- | The label of the caption shown in the player when choosing a language.
-- We recommend that you put the caption language name here, in the
-- language of the captions.
captionSource_label :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_label :: Lens' CaptionSource (Maybe Text)
captionSource_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
label :: Maybe Text
$sel:label:CaptionSource' :: CaptionSource -> Maybe Text
label} -> Maybe Text
label) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:label:CaptionSource' :: Maybe Text
label = Maybe Text
a} :: CaptionSource)

-- | A string that specifies the language of the caption. If you specified
-- multiple inputs with captions, the caption language must match in order
-- to be included in the output. Specify this as one of:
--
-- -   2-character ISO 639-1 code
--
-- -   3-character ISO 639-2 code
--
-- For more information on ISO language codes and language names, see the
-- List of ISO 639-1 codes.
captionSource_language :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_language :: Lens' CaptionSource (Maybe Text)
captionSource_language = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
language :: Maybe Text
$sel:language:CaptionSource' :: CaptionSource -> Maybe Text
language} -> Maybe Text
language) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:language:CaptionSource' :: Maybe Text
language = Maybe Text
a} :: CaptionSource)

-- | For clip generation or captions that do not start at the same time as
-- the associated video file, the @TimeOffset@ tells Elastic Transcoder how
-- much of the video to encode before including captions.
--
-- Specify the TimeOffset in the form [+-]SS.sss or [+-]HH:mm:SS.ss.
captionSource_timeOffset :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_timeOffset :: Lens' CaptionSource (Maybe Text)
captionSource_timeOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
timeOffset :: Maybe Text
$sel:timeOffset:CaptionSource' :: CaptionSource -> Maybe Text
timeOffset} -> Maybe Text
timeOffset) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:timeOffset:CaptionSource' :: Maybe Text
timeOffset = Maybe Text
a} :: CaptionSource)

instance Data.FromJSON CaptionSource where
  parseJSON :: Value -> Parser CaptionSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CaptionSource"
      ( \Object
x ->
          Maybe Encryption
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CaptionSource
CaptionSource'
            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
"Encryption")
            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
"Key")
            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
"Label")
            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
"Language")
            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
"TimeOffset")
      )

instance Prelude.Hashable CaptionSource where
  hashWithSalt :: Int -> CaptionSource -> Int
hashWithSalt Int
_salt CaptionSource' {Maybe Text
Maybe Encryption
timeOffset :: Maybe Text
language :: Maybe Text
label :: Maybe Text
key :: Maybe Text
encryption :: Maybe Encryption
$sel:timeOffset:CaptionSource' :: CaptionSource -> Maybe Text
$sel:language:CaptionSource' :: CaptionSource -> Maybe Text
$sel:label:CaptionSource' :: CaptionSource -> Maybe Text
$sel:key:CaptionSource' :: CaptionSource -> Maybe Text
$sel:encryption:CaptionSource' :: CaptionSource -> Maybe Encryption
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Encryption
encryption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
label
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
language
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timeOffset

instance Prelude.NFData CaptionSource where
  rnf :: CaptionSource -> ()
rnf CaptionSource' {Maybe Text
Maybe Encryption
timeOffset :: Maybe Text
language :: Maybe Text
label :: Maybe Text
key :: Maybe Text
encryption :: Maybe Encryption
$sel:timeOffset:CaptionSource' :: CaptionSource -> Maybe Text
$sel:language:CaptionSource' :: CaptionSource -> Maybe Text
$sel:label:CaptionSource' :: CaptionSource -> Maybe Text
$sel:key:CaptionSource' :: CaptionSource -> Maybe Text
$sel:encryption:CaptionSource' :: CaptionSource -> Maybe Encryption
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Encryption
encryption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
language
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timeOffset

instance Data.ToJSON CaptionSource where
  toJSON :: CaptionSource -> Value
toJSON CaptionSource' {Maybe Text
Maybe Encryption
timeOffset :: Maybe Text
language :: Maybe Text
label :: Maybe Text
key :: Maybe Text
encryption :: Maybe Encryption
$sel:timeOffset:CaptionSource' :: CaptionSource -> Maybe Text
$sel:language:CaptionSource' :: CaptionSource -> Maybe Text
$sel:label:CaptionSource' :: CaptionSource -> Maybe Text
$sel:key:CaptionSource' :: CaptionSource -> Maybe Text
$sel:encryption:CaptionSource' :: CaptionSource -> Maybe Encryption
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Encryption" 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 Encryption
encryption,
            (Key
"Key" 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 Text
key,
            (Key
"Label" 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 Text
label,
            (Key
"Language" 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 Text
language,
            (Key
"TimeOffset" 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 Text
timeOffset
          ]
      )