{-# 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.MediaConvert.Types.CaptionDescription
-- 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.MediaConvert.Types.CaptionDescription where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.CaptionDestinationSettings
import Amazonka.MediaConvert.Types.LanguageCode
import qualified Amazonka.Prelude as Prelude

-- | This object holds groups of settings related to captions for one output.
-- For each output that has captions, include one instance of
-- CaptionDescriptions.
--
-- /See:/ 'newCaptionDescription' smart constructor.
data CaptionDescription = CaptionDescription'
  { -- | Specifies which \"Caption Selector\":#inputs-caption_selector to use
    -- from each input when generating captions. The name should be of the
    -- format \"Caption Selector \", which denotes that the Nth Caption
    -- Selector will be used from each input.
    CaptionDescription -> Maybe Text
captionSelectorName :: Prelude.Maybe Prelude.Text,
    -- | Specify the language for this captions output track. For most captions
    -- output formats, the encoder puts this language information in the output
    -- captions metadata. If your output captions format is DVB-Sub or Burn in,
    -- the encoder uses this language information when automatically selecting
    -- the font script for rendering the captions text. For all outputs, you
    -- can use an ISO 639-2 or ISO 639-3 code. For streaming outputs, you can
    -- also use any other code in the full RFC-5646 specification. Streaming
    -- outputs are those that are in one of the following output groups: CMAF,
    -- DASH ISO, Apple HLS, or Microsoft Smooth Streaming.
    CaptionDescription -> Maybe Text
customLanguageCode :: Prelude.Maybe Prelude.Text,
    -- | Specify the language of this captions output track. For most captions
    -- output formats, the encoder puts this language information in the output
    -- captions metadata. If your output captions format is DVB-Sub or Burn in,
    -- the encoder uses this language information to choose the font language
    -- for rendering the captions text.
    CaptionDescription -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | Settings related to one captions tab on the MediaConvert console. In
    -- your job JSON, an instance of captions DestinationSettings is equivalent
    -- to one captions tab in the console. Usually, one captions tab
    -- corresponds to one output captions track. Depending on your output
    -- captions format, one tab might correspond to a set of output captions
    -- tracks. For more information, see
    -- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/including-captions.html.
    CaptionDescription -> Maybe CaptionDestinationSettings
destinationSettings :: Prelude.Maybe CaptionDestinationSettings,
    -- | Specify a label for this set of output captions. For example,
    -- \"English\", \"Director commentary\", or \"track_2\". For streaming
    -- outputs, MediaConvert passes this information into destination manifests
    -- for display on the end-viewer\'s player device. For outputs in other
    -- output groups, the service ignores this setting.
    CaptionDescription -> Maybe Text
languageDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (CaptionDescription -> CaptionDescription -> Bool
(CaptionDescription -> CaptionDescription -> Bool)
-> (CaptionDescription -> CaptionDescription -> Bool)
-> Eq CaptionDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionDescription -> CaptionDescription -> Bool
$c/= :: CaptionDescription -> CaptionDescription -> Bool
== :: CaptionDescription -> CaptionDescription -> Bool
$c== :: CaptionDescription -> CaptionDescription -> Bool
Prelude.Eq, ReadPrec [CaptionDescription]
ReadPrec CaptionDescription
Int -> ReadS CaptionDescription
ReadS [CaptionDescription]
(Int -> ReadS CaptionDescription)
-> ReadS [CaptionDescription]
-> ReadPrec CaptionDescription
-> ReadPrec [CaptionDescription]
-> Read CaptionDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionDescription]
$creadListPrec :: ReadPrec [CaptionDescription]
readPrec :: ReadPrec CaptionDescription
$creadPrec :: ReadPrec CaptionDescription
readList :: ReadS [CaptionDescription]
$creadList :: ReadS [CaptionDescription]
readsPrec :: Int -> ReadS CaptionDescription
$creadsPrec :: Int -> ReadS CaptionDescription
Prelude.Read, Int -> CaptionDescription -> ShowS
[CaptionDescription] -> ShowS
CaptionDescription -> String
(Int -> CaptionDescription -> ShowS)
-> (CaptionDescription -> String)
-> ([CaptionDescription] -> ShowS)
-> Show CaptionDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionDescription] -> ShowS
$cshowList :: [CaptionDescription] -> ShowS
show :: CaptionDescription -> String
$cshow :: CaptionDescription -> String
showsPrec :: Int -> CaptionDescription -> ShowS
$cshowsPrec :: Int -> CaptionDescription -> ShowS
Prelude.Show, (forall x. CaptionDescription -> Rep CaptionDescription x)
-> (forall x. Rep CaptionDescription x -> CaptionDescription)
-> Generic CaptionDescription
forall x. Rep CaptionDescription x -> CaptionDescription
forall x. CaptionDescription -> Rep CaptionDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptionDescription x -> CaptionDescription
$cfrom :: forall x. CaptionDescription -> Rep CaptionDescription x
Prelude.Generic)

-- |
-- Create a value of 'CaptionDescription' 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:
--
-- 'captionSelectorName', 'captionDescription_captionSelectorName' - Specifies which \"Caption Selector\":#inputs-caption_selector to use
-- from each input when generating captions. The name should be of the
-- format \"Caption Selector \", which denotes that the Nth Caption
-- Selector will be used from each input.
--
-- 'customLanguageCode', 'captionDescription_customLanguageCode' - Specify the language for this captions output track. For most captions
-- output formats, the encoder puts this language information in the output
-- captions metadata. If your output captions format is DVB-Sub or Burn in,
-- the encoder uses this language information when automatically selecting
-- the font script for rendering the captions text. For all outputs, you
-- can use an ISO 639-2 or ISO 639-3 code. For streaming outputs, you can
-- also use any other code in the full RFC-5646 specification. Streaming
-- outputs are those that are in one of the following output groups: CMAF,
-- DASH ISO, Apple HLS, or Microsoft Smooth Streaming.
--
-- 'languageCode', 'captionDescription_languageCode' - Specify the language of this captions output track. For most captions
-- output formats, the encoder puts this language information in the output
-- captions metadata. If your output captions format is DVB-Sub or Burn in,
-- the encoder uses this language information to choose the font language
-- for rendering the captions text.
--
-- 'destinationSettings', 'captionDescription_destinationSettings' - Settings related to one captions tab on the MediaConvert console. In
-- your job JSON, an instance of captions DestinationSettings is equivalent
-- to one captions tab in the console. Usually, one captions tab
-- corresponds to one output captions track. Depending on your output
-- captions format, one tab might correspond to a set of output captions
-- tracks. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/including-captions.html.
--
-- 'languageDescription', 'captionDescription_languageDescription' - Specify a label for this set of output captions. For example,
-- \"English\", \"Director commentary\", or \"track_2\". For streaming
-- outputs, MediaConvert passes this information into destination manifests
-- for display on the end-viewer\'s player device. For outputs in other
-- output groups, the service ignores this setting.
newCaptionDescription ::
  CaptionDescription
newCaptionDescription :: CaptionDescription
newCaptionDescription =
  CaptionDescription' :: Maybe Text
-> Maybe Text
-> Maybe LanguageCode
-> Maybe CaptionDestinationSettings
-> Maybe Text
-> CaptionDescription
CaptionDescription'
    { $sel:captionSelectorName:CaptionDescription' :: Maybe Text
captionSelectorName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:customLanguageCode:CaptionDescription' :: Maybe Text
customLanguageCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:CaptionDescription' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationSettings:CaptionDescription' :: Maybe CaptionDestinationSettings
destinationSettings = Maybe CaptionDestinationSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:languageDescription:CaptionDescription' :: Maybe Text
languageDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies which \"Caption Selector\":#inputs-caption_selector to use
-- from each input when generating captions. The name should be of the
-- format \"Caption Selector \", which denotes that the Nth Caption
-- Selector will be used from each input.
captionDescription_captionSelectorName :: Lens.Lens' CaptionDescription (Prelude.Maybe Prelude.Text)
captionDescription_captionSelectorName :: (Maybe Text -> f (Maybe Text))
-> CaptionDescription -> f CaptionDescription
captionDescription_captionSelectorName = (CaptionDescription -> Maybe Text)
-> (CaptionDescription -> Maybe Text -> CaptionDescription)
-> Lens
     CaptionDescription CaptionDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe Text
captionSelectorName :: Maybe Text
$sel:captionSelectorName:CaptionDescription' :: CaptionDescription -> Maybe Text
captionSelectorName} -> Maybe Text
captionSelectorName) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe Text
a -> CaptionDescription
s {$sel:captionSelectorName:CaptionDescription' :: Maybe Text
captionSelectorName = Maybe Text
a} :: CaptionDescription)

-- | Specify the language for this captions output track. For most captions
-- output formats, the encoder puts this language information in the output
-- captions metadata. If your output captions format is DVB-Sub or Burn in,
-- the encoder uses this language information when automatically selecting
-- the font script for rendering the captions text. For all outputs, you
-- can use an ISO 639-2 or ISO 639-3 code. For streaming outputs, you can
-- also use any other code in the full RFC-5646 specification. Streaming
-- outputs are those that are in one of the following output groups: CMAF,
-- DASH ISO, Apple HLS, or Microsoft Smooth Streaming.
captionDescription_customLanguageCode :: Lens.Lens' CaptionDescription (Prelude.Maybe Prelude.Text)
captionDescription_customLanguageCode :: (Maybe Text -> f (Maybe Text))
-> CaptionDescription -> f CaptionDescription
captionDescription_customLanguageCode = (CaptionDescription -> Maybe Text)
-> (CaptionDescription -> Maybe Text -> CaptionDescription)
-> Lens
     CaptionDescription CaptionDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe Text
customLanguageCode :: Maybe Text
$sel:customLanguageCode:CaptionDescription' :: CaptionDescription -> Maybe Text
customLanguageCode} -> Maybe Text
customLanguageCode) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe Text
a -> CaptionDescription
s {$sel:customLanguageCode:CaptionDescription' :: Maybe Text
customLanguageCode = Maybe Text
a} :: CaptionDescription)

-- | Specify the language of this captions output track. For most captions
-- output formats, the encoder puts this language information in the output
-- captions metadata. If your output captions format is DVB-Sub or Burn in,
-- the encoder uses this language information to choose the font language
-- for rendering the captions text.
captionDescription_languageCode :: Lens.Lens' CaptionDescription (Prelude.Maybe LanguageCode)
captionDescription_languageCode :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> CaptionDescription -> f CaptionDescription
captionDescription_languageCode = (CaptionDescription -> Maybe LanguageCode)
-> (CaptionDescription -> Maybe LanguageCode -> CaptionDescription)
-> Lens
     CaptionDescription
     CaptionDescription
     (Maybe LanguageCode)
     (Maybe LanguageCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:CaptionDescription' :: CaptionDescription -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe LanguageCode
a -> CaptionDescription
s {$sel:languageCode:CaptionDescription' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: CaptionDescription)

-- | Settings related to one captions tab on the MediaConvert console. In
-- your job JSON, an instance of captions DestinationSettings is equivalent
-- to one captions tab in the console. Usually, one captions tab
-- corresponds to one output captions track. Depending on your output
-- captions format, one tab might correspond to a set of output captions
-- tracks. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/including-captions.html.
captionDescription_destinationSettings :: Lens.Lens' CaptionDescription (Prelude.Maybe CaptionDestinationSettings)
captionDescription_destinationSettings :: (Maybe CaptionDestinationSettings
 -> f (Maybe CaptionDestinationSettings))
-> CaptionDescription -> f CaptionDescription
captionDescription_destinationSettings = (CaptionDescription -> Maybe CaptionDestinationSettings)
-> (CaptionDescription
    -> Maybe CaptionDestinationSettings -> CaptionDescription)
-> Lens
     CaptionDescription
     CaptionDescription
     (Maybe CaptionDestinationSettings)
     (Maybe CaptionDestinationSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe CaptionDestinationSettings
destinationSettings :: Maybe CaptionDestinationSettings
$sel:destinationSettings:CaptionDescription' :: CaptionDescription -> Maybe CaptionDestinationSettings
destinationSettings} -> Maybe CaptionDestinationSettings
destinationSettings) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe CaptionDestinationSettings
a -> CaptionDescription
s {$sel:destinationSettings:CaptionDescription' :: Maybe CaptionDestinationSettings
destinationSettings = Maybe CaptionDestinationSettings
a} :: CaptionDescription)

-- | Specify a label for this set of output captions. For example,
-- \"English\", \"Director commentary\", or \"track_2\". For streaming
-- outputs, MediaConvert passes this information into destination manifests
-- for display on the end-viewer\'s player device. For outputs in other
-- output groups, the service ignores this setting.
captionDescription_languageDescription :: Lens.Lens' CaptionDescription (Prelude.Maybe Prelude.Text)
captionDescription_languageDescription :: (Maybe Text -> f (Maybe Text))
-> CaptionDescription -> f CaptionDescription
captionDescription_languageDescription = (CaptionDescription -> Maybe Text)
-> (CaptionDescription -> Maybe Text -> CaptionDescription)
-> Lens
     CaptionDescription CaptionDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescription' {Maybe Text
languageDescription :: Maybe Text
$sel:languageDescription:CaptionDescription' :: CaptionDescription -> Maybe Text
languageDescription} -> Maybe Text
languageDescription) (\s :: CaptionDescription
s@CaptionDescription' {} Maybe Text
a -> CaptionDescription
s {$sel:languageDescription:CaptionDescription' :: Maybe Text
languageDescription = Maybe Text
a} :: CaptionDescription)

instance Core.FromJSON CaptionDescription where
  parseJSON :: Value -> Parser CaptionDescription
parseJSON =
    String
-> (Object -> Parser CaptionDescription)
-> Value
-> Parser CaptionDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CaptionDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe LanguageCode
-> Maybe CaptionDestinationSettings
-> Maybe Text
-> CaptionDescription
CaptionDescription'
            (Maybe Text
 -> Maybe Text
 -> Maybe LanguageCode
 -> Maybe CaptionDestinationSettings
 -> Maybe Text
 -> CaptionDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe LanguageCode
      -> Maybe CaptionDestinationSettings
      -> Maybe Text
      -> CaptionDescription)
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
"captionSelectorName")
            Parser
  (Maybe Text
   -> Maybe LanguageCode
   -> Maybe CaptionDestinationSettings
   -> Maybe Text
   -> CaptionDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe LanguageCode
      -> Maybe CaptionDestinationSettings
      -> Maybe Text
      -> CaptionDescription)
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
"customLanguageCode")
            Parser
  (Maybe LanguageCode
   -> Maybe CaptionDestinationSettings
   -> Maybe Text
   -> CaptionDescription)
-> Parser (Maybe LanguageCode)
-> Parser
     (Maybe CaptionDestinationSettings
      -> Maybe Text -> CaptionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LanguageCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"languageCode")
            Parser
  (Maybe CaptionDestinationSettings
   -> Maybe Text -> CaptionDescription)
-> Parser (Maybe CaptionDestinationSettings)
-> Parser (Maybe Text -> CaptionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CaptionDestinationSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destinationSettings")
            Parser (Maybe Text -> CaptionDescription)
-> Parser (Maybe Text) -> Parser CaptionDescription
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
"languageDescription")
      )

instance Prelude.Hashable CaptionDescription

instance Prelude.NFData CaptionDescription

instance Core.ToJSON CaptionDescription where
  toJSON :: CaptionDescription -> Value
toJSON CaptionDescription' {Maybe Text
Maybe LanguageCode
Maybe CaptionDestinationSettings
languageDescription :: Maybe Text
destinationSettings :: Maybe CaptionDestinationSettings
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
captionSelectorName :: Maybe Text
$sel:languageDescription:CaptionDescription' :: CaptionDescription -> Maybe Text
$sel:destinationSettings:CaptionDescription' :: CaptionDescription -> Maybe CaptionDestinationSettings
$sel:languageCode:CaptionDescription' :: CaptionDescription -> Maybe LanguageCode
$sel:customLanguageCode:CaptionDescription' :: CaptionDescription -> Maybe Text
$sel:captionSelectorName:CaptionDescription' :: CaptionDescription -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"captionSelectorName" 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
captionSelectorName,
            (Text
"customLanguageCode" 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
customLanguageCode,
            (Text
"languageCode" Text -> LanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LanguageCode -> Pair) -> Maybe LanguageCode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LanguageCode
languageCode,
            (Text
"destinationSettings" Text -> CaptionDestinationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CaptionDestinationSettings -> Pair)
-> Maybe CaptionDestinationSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CaptionDestinationSettings
destinationSettings,
            (Text
"languageDescription" 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
languageDescription
          ]
      )