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

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

-- | Caption Description for preset
--
-- /See:/ 'newCaptionDescriptionPreset' smart constructor.
data CaptionDescriptionPreset = CaptionDescriptionPreset'
  { -- | 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.
    CaptionDescriptionPreset -> Maybe Text
customLanguageCode :: Prelude.Maybe Prelude.Text,
    -- | 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.
    CaptionDescriptionPreset -> Maybe CaptionDestinationSettings
destinationSettings :: Prelude.Maybe CaptionDestinationSettings,
    -- | 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.
    CaptionDescriptionPreset -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | 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.
    CaptionDescriptionPreset -> Maybe Text
languageDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (CaptionDescriptionPreset -> CaptionDescriptionPreset -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionDescriptionPreset -> CaptionDescriptionPreset -> Bool
$c/= :: CaptionDescriptionPreset -> CaptionDescriptionPreset -> Bool
== :: CaptionDescriptionPreset -> CaptionDescriptionPreset -> Bool
$c== :: CaptionDescriptionPreset -> CaptionDescriptionPreset -> Bool
Prelude.Eq, ReadPrec [CaptionDescriptionPreset]
ReadPrec CaptionDescriptionPreset
Int -> ReadS CaptionDescriptionPreset
ReadS [CaptionDescriptionPreset]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionDescriptionPreset]
$creadListPrec :: ReadPrec [CaptionDescriptionPreset]
readPrec :: ReadPrec CaptionDescriptionPreset
$creadPrec :: ReadPrec CaptionDescriptionPreset
readList :: ReadS [CaptionDescriptionPreset]
$creadList :: ReadS [CaptionDescriptionPreset]
readsPrec :: Int -> ReadS CaptionDescriptionPreset
$creadsPrec :: Int -> ReadS CaptionDescriptionPreset
Prelude.Read, Int -> CaptionDescriptionPreset -> ShowS
[CaptionDescriptionPreset] -> ShowS
CaptionDescriptionPreset -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionDescriptionPreset] -> ShowS
$cshowList :: [CaptionDescriptionPreset] -> ShowS
show :: CaptionDescriptionPreset -> String
$cshow :: CaptionDescriptionPreset -> String
showsPrec :: Int -> CaptionDescriptionPreset -> ShowS
$cshowsPrec :: Int -> CaptionDescriptionPreset -> ShowS
Prelude.Show, forall x.
Rep CaptionDescriptionPreset x -> CaptionDescriptionPreset
forall x.
CaptionDescriptionPreset -> Rep CaptionDescriptionPreset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CaptionDescriptionPreset x -> CaptionDescriptionPreset
$cfrom :: forall x.
CaptionDescriptionPreset -> Rep CaptionDescriptionPreset x
Prelude.Generic)

-- |
-- Create a value of 'CaptionDescriptionPreset' 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:
--
-- 'customLanguageCode', 'captionDescriptionPreset_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.
--
-- 'destinationSettings', 'captionDescriptionPreset_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.
--
-- 'languageCode', 'captionDescriptionPreset_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.
--
-- 'languageDescription', 'captionDescriptionPreset_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.
newCaptionDescriptionPreset ::
  CaptionDescriptionPreset
newCaptionDescriptionPreset :: CaptionDescriptionPreset
newCaptionDescriptionPreset =
  CaptionDescriptionPreset'
    { $sel:customLanguageCode:CaptionDescriptionPreset' :: Maybe Text
customLanguageCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:destinationSettings:CaptionDescriptionPreset' :: Maybe CaptionDestinationSettings
destinationSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:CaptionDescriptionPreset' :: Maybe LanguageCode
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:languageDescription:CaptionDescriptionPreset' :: Maybe Text
languageDescription = forall a. Maybe a
Prelude.Nothing
    }

-- | 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.
captionDescriptionPreset_customLanguageCode :: Lens.Lens' CaptionDescriptionPreset (Prelude.Maybe Prelude.Text)
captionDescriptionPreset_customLanguageCode :: Lens' CaptionDescriptionPreset (Maybe Text)
captionDescriptionPreset_customLanguageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescriptionPreset' {Maybe Text
customLanguageCode :: Maybe Text
$sel:customLanguageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
customLanguageCode} -> Maybe Text
customLanguageCode) (\s :: CaptionDescriptionPreset
s@CaptionDescriptionPreset' {} Maybe Text
a -> CaptionDescriptionPreset
s {$sel:customLanguageCode:CaptionDescriptionPreset' :: Maybe Text
customLanguageCode = Maybe Text
a} :: CaptionDescriptionPreset)

-- | 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.
captionDescriptionPreset_destinationSettings :: Lens.Lens' CaptionDescriptionPreset (Prelude.Maybe CaptionDestinationSettings)
captionDescriptionPreset_destinationSettings :: Lens' CaptionDescriptionPreset (Maybe CaptionDestinationSettings)
captionDescriptionPreset_destinationSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescriptionPreset' {Maybe CaptionDestinationSettings
destinationSettings :: Maybe CaptionDestinationSettings
$sel:destinationSettings:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe CaptionDestinationSettings
destinationSettings} -> Maybe CaptionDestinationSettings
destinationSettings) (\s :: CaptionDescriptionPreset
s@CaptionDescriptionPreset' {} Maybe CaptionDestinationSettings
a -> CaptionDescriptionPreset
s {$sel:destinationSettings:CaptionDescriptionPreset' :: Maybe CaptionDestinationSettings
destinationSettings = Maybe CaptionDestinationSettings
a} :: CaptionDescriptionPreset)

-- | 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.
captionDescriptionPreset_languageCode :: Lens.Lens' CaptionDescriptionPreset (Prelude.Maybe LanguageCode)
captionDescriptionPreset_languageCode :: Lens' CaptionDescriptionPreset (Maybe LanguageCode)
captionDescriptionPreset_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescriptionPreset' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: CaptionDescriptionPreset
s@CaptionDescriptionPreset' {} Maybe LanguageCode
a -> CaptionDescriptionPreset
s {$sel:languageCode:CaptionDescriptionPreset' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: CaptionDescriptionPreset)

-- | 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.
captionDescriptionPreset_languageDescription :: Lens.Lens' CaptionDescriptionPreset (Prelude.Maybe Prelude.Text)
captionDescriptionPreset_languageDescription :: Lens' CaptionDescriptionPreset (Maybe Text)
captionDescriptionPreset_languageDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionDescriptionPreset' {Maybe Text
languageDescription :: Maybe Text
$sel:languageDescription:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
languageDescription} -> Maybe Text
languageDescription) (\s :: CaptionDescriptionPreset
s@CaptionDescriptionPreset' {} Maybe Text
a -> CaptionDescriptionPreset
s {$sel:languageDescription:CaptionDescriptionPreset' :: Maybe Text
languageDescription = Maybe Text
a} :: CaptionDescriptionPreset)

instance Data.FromJSON CaptionDescriptionPreset where
  parseJSON :: Value -> Parser CaptionDescriptionPreset
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CaptionDescriptionPreset"
      ( \Object
x ->
          Maybe Text
-> Maybe CaptionDestinationSettings
-> Maybe LanguageCode
-> Maybe Text
-> CaptionDescriptionPreset
CaptionDescriptionPreset'
            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
"customLanguageCode")
            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
"destinationSettings")
            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
"languageCode")
            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
"languageDescription")
      )

instance Prelude.Hashable CaptionDescriptionPreset where
  hashWithSalt :: Int -> CaptionDescriptionPreset -> Int
hashWithSalt Int
_salt CaptionDescriptionPreset' {Maybe Text
Maybe LanguageCode
Maybe CaptionDestinationSettings
languageDescription :: Maybe Text
languageCode :: Maybe LanguageCode
destinationSettings :: Maybe CaptionDestinationSettings
customLanguageCode :: Maybe Text
$sel:languageDescription:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
$sel:languageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe LanguageCode
$sel:destinationSettings:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe CaptionDestinationSettings
$sel:customLanguageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customLanguageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CaptionDestinationSettings
destinationSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
languageDescription

instance Prelude.NFData CaptionDescriptionPreset where
  rnf :: CaptionDescriptionPreset -> ()
rnf CaptionDescriptionPreset' {Maybe Text
Maybe LanguageCode
Maybe CaptionDestinationSettings
languageDescription :: Maybe Text
languageCode :: Maybe LanguageCode
destinationSettings :: Maybe CaptionDestinationSettings
customLanguageCode :: Maybe Text
$sel:languageDescription:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
$sel:languageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe LanguageCode
$sel:destinationSettings:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe CaptionDestinationSettings
$sel:customLanguageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customLanguageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CaptionDestinationSettings
destinationSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
languageDescription

instance Data.ToJSON CaptionDescriptionPreset where
  toJSON :: CaptionDescriptionPreset -> Value
toJSON CaptionDescriptionPreset' {Maybe Text
Maybe LanguageCode
Maybe CaptionDestinationSettings
languageDescription :: Maybe Text
languageCode :: Maybe LanguageCode
destinationSettings :: Maybe CaptionDestinationSettings
customLanguageCode :: Maybe Text
$sel:languageDescription:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
$sel:languageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe LanguageCode
$sel:destinationSettings:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe CaptionDestinationSettings
$sel:customLanguageCode:CaptionDescriptionPreset' :: CaptionDescriptionPreset -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"customLanguageCode" 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
customLanguageCode,
            (Key
"destinationSettings" 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 CaptionDestinationSettings
destinationSettings,
            (Key
"languageCode" 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 LanguageCode
languageCode,
            (Key
"languageDescription" 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
languageDescription
          ]
      )