{-# 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.TtmlDestinationSettings
-- 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.TtmlDestinationSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.TtmlStylePassthrough
import qualified Amazonka.Prelude as Prelude

-- | Settings related to TTML captions. TTML is a sidecar format that holds
-- captions in a file that is separate from the video container. Set up
-- sidecar captions in the same output group, but different output from
-- your video. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/ttml-and-webvtt-output-captions.html.
-- When you work directly in your JSON job specification, include this
-- object and any required children when you set destinationType to TTML.
--
-- /See:/ 'newTtmlDestinationSettings' smart constructor.
data TtmlDestinationSettings = TtmlDestinationSettings'
  { -- | Pass through style and position information from a TTML-like input
    -- source (TTML, IMSC, SMPTE-TT) to the TTML output.
    TtmlDestinationSettings -> Maybe TtmlStylePassthrough
stylePassthrough :: Prelude.Maybe TtmlStylePassthrough
  }
  deriving (TtmlDestinationSettings -> TtmlDestinationSettings -> Bool
(TtmlDestinationSettings -> TtmlDestinationSettings -> Bool)
-> (TtmlDestinationSettings -> TtmlDestinationSettings -> Bool)
-> Eq TtmlDestinationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TtmlDestinationSettings -> TtmlDestinationSettings -> Bool
$c/= :: TtmlDestinationSettings -> TtmlDestinationSettings -> Bool
== :: TtmlDestinationSettings -> TtmlDestinationSettings -> Bool
$c== :: TtmlDestinationSettings -> TtmlDestinationSettings -> Bool
Prelude.Eq, ReadPrec [TtmlDestinationSettings]
ReadPrec TtmlDestinationSettings
Int -> ReadS TtmlDestinationSettings
ReadS [TtmlDestinationSettings]
(Int -> ReadS TtmlDestinationSettings)
-> ReadS [TtmlDestinationSettings]
-> ReadPrec TtmlDestinationSettings
-> ReadPrec [TtmlDestinationSettings]
-> Read TtmlDestinationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TtmlDestinationSettings]
$creadListPrec :: ReadPrec [TtmlDestinationSettings]
readPrec :: ReadPrec TtmlDestinationSettings
$creadPrec :: ReadPrec TtmlDestinationSettings
readList :: ReadS [TtmlDestinationSettings]
$creadList :: ReadS [TtmlDestinationSettings]
readsPrec :: Int -> ReadS TtmlDestinationSettings
$creadsPrec :: Int -> ReadS TtmlDestinationSettings
Prelude.Read, Int -> TtmlDestinationSettings -> ShowS
[TtmlDestinationSettings] -> ShowS
TtmlDestinationSettings -> String
(Int -> TtmlDestinationSettings -> ShowS)
-> (TtmlDestinationSettings -> String)
-> ([TtmlDestinationSettings] -> ShowS)
-> Show TtmlDestinationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TtmlDestinationSettings] -> ShowS
$cshowList :: [TtmlDestinationSettings] -> ShowS
show :: TtmlDestinationSettings -> String
$cshow :: TtmlDestinationSettings -> String
showsPrec :: Int -> TtmlDestinationSettings -> ShowS
$cshowsPrec :: Int -> TtmlDestinationSettings -> ShowS
Prelude.Show, (forall x.
 TtmlDestinationSettings -> Rep TtmlDestinationSettings x)
-> (forall x.
    Rep TtmlDestinationSettings x -> TtmlDestinationSettings)
-> Generic TtmlDestinationSettings
forall x. Rep TtmlDestinationSettings x -> TtmlDestinationSettings
forall x. TtmlDestinationSettings -> Rep TtmlDestinationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TtmlDestinationSettings x -> TtmlDestinationSettings
$cfrom :: forall x. TtmlDestinationSettings -> Rep TtmlDestinationSettings x
Prelude.Generic)

-- |
-- Create a value of 'TtmlDestinationSettings' 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:
--
-- 'stylePassthrough', 'ttmlDestinationSettings_stylePassthrough' - Pass through style and position information from a TTML-like input
-- source (TTML, IMSC, SMPTE-TT) to the TTML output.
newTtmlDestinationSettings ::
  TtmlDestinationSettings
newTtmlDestinationSettings :: TtmlDestinationSettings
newTtmlDestinationSettings =
  TtmlDestinationSettings' :: Maybe TtmlStylePassthrough -> TtmlDestinationSettings
TtmlDestinationSettings'
    { $sel:stylePassthrough:TtmlDestinationSettings' :: Maybe TtmlStylePassthrough
stylePassthrough =
        Maybe TtmlStylePassthrough
forall a. Maybe a
Prelude.Nothing
    }

-- | Pass through style and position information from a TTML-like input
-- source (TTML, IMSC, SMPTE-TT) to the TTML output.
ttmlDestinationSettings_stylePassthrough :: Lens.Lens' TtmlDestinationSettings (Prelude.Maybe TtmlStylePassthrough)
ttmlDestinationSettings_stylePassthrough :: (Maybe TtmlStylePassthrough -> f (Maybe TtmlStylePassthrough))
-> TtmlDestinationSettings -> f TtmlDestinationSettings
ttmlDestinationSettings_stylePassthrough = (TtmlDestinationSettings -> Maybe TtmlStylePassthrough)
-> (TtmlDestinationSettings
    -> Maybe TtmlStylePassthrough -> TtmlDestinationSettings)
-> Lens
     TtmlDestinationSettings
     TtmlDestinationSettings
     (Maybe TtmlStylePassthrough)
     (Maybe TtmlStylePassthrough)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TtmlDestinationSettings' {Maybe TtmlStylePassthrough
stylePassthrough :: Maybe TtmlStylePassthrough
$sel:stylePassthrough:TtmlDestinationSettings' :: TtmlDestinationSettings -> Maybe TtmlStylePassthrough
stylePassthrough} -> Maybe TtmlStylePassthrough
stylePassthrough) (\s :: TtmlDestinationSettings
s@TtmlDestinationSettings' {} Maybe TtmlStylePassthrough
a -> TtmlDestinationSettings
s {$sel:stylePassthrough:TtmlDestinationSettings' :: Maybe TtmlStylePassthrough
stylePassthrough = Maybe TtmlStylePassthrough
a} :: TtmlDestinationSettings)

instance Core.FromJSON TtmlDestinationSettings where
  parseJSON :: Value -> Parser TtmlDestinationSettings
parseJSON =
    String
-> (Object -> Parser TtmlDestinationSettings)
-> Value
-> Parser TtmlDestinationSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TtmlDestinationSettings"
      ( \Object
x ->
          Maybe TtmlStylePassthrough -> TtmlDestinationSettings
TtmlDestinationSettings'
            (Maybe TtmlStylePassthrough -> TtmlDestinationSettings)
-> Parser (Maybe TtmlStylePassthrough)
-> Parser TtmlDestinationSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TtmlStylePassthrough)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stylePassthrough")
      )

instance Prelude.Hashable TtmlDestinationSettings

instance Prelude.NFData TtmlDestinationSettings

instance Core.ToJSON TtmlDestinationSettings where
  toJSON :: TtmlDestinationSettings -> Value
toJSON TtmlDestinationSettings' {Maybe TtmlStylePassthrough
stylePassthrough :: Maybe TtmlStylePassthrough
$sel:stylePassthrough:TtmlDestinationSettings' :: TtmlDestinationSettings -> Maybe TtmlStylePassthrough
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"stylePassthrough" Text -> TtmlStylePassthrough -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TtmlStylePassthrough -> Pair)
-> Maybe TtmlStylePassthrough -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TtmlStylePassthrough
stylePassthrough
          ]
      )