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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.AncillaryConvert608To708
import Amazonka.MediaConvert.Types.AncillaryTerminateCaptions
import qualified Amazonka.Prelude as Prelude

-- | Settings for ancillary captions source.
--
-- /See:/ 'newAncillarySourceSettings' smart constructor.
data AncillarySourceSettings = AncillarySourceSettings'
  { -- | Specify whether this set of input captions appears in your outputs in
    -- both 608 and 708 format. If you choose Upconvert (UPCONVERT),
    -- MediaConvert includes the captions data in two ways: it passes the 608
    -- data through using the 608 compatibility bytes fields of the 708
    -- wrapper, and it also translates the 608 data into 708.
    AncillarySourceSettings -> Maybe AncillaryConvert608To708
convert608To708 :: Prelude.Maybe AncillaryConvert608To708,
    -- | By default, the service terminates any unterminated captions at the end
    -- of each input. If you want the caption to continue onto your next input,
    -- disable this setting.
    AncillarySourceSettings -> Maybe AncillaryTerminateCaptions
terminateCaptions :: Prelude.Maybe AncillaryTerminateCaptions,
    -- | Specifies the 608 channel number in the ancillary data track from which
    -- to extract captions. Unused for passthrough.
    AncillarySourceSettings -> Maybe Natural
sourceAncillaryChannelNumber :: Prelude.Maybe Prelude.Natural
  }
  deriving (AncillarySourceSettings -> AncillarySourceSettings -> Bool
(AncillarySourceSettings -> AncillarySourceSettings -> Bool)
-> (AncillarySourceSettings -> AncillarySourceSettings -> Bool)
-> Eq AncillarySourceSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AncillarySourceSettings -> AncillarySourceSettings -> Bool
$c/= :: AncillarySourceSettings -> AncillarySourceSettings -> Bool
== :: AncillarySourceSettings -> AncillarySourceSettings -> Bool
$c== :: AncillarySourceSettings -> AncillarySourceSettings -> Bool
Prelude.Eq, ReadPrec [AncillarySourceSettings]
ReadPrec AncillarySourceSettings
Int -> ReadS AncillarySourceSettings
ReadS [AncillarySourceSettings]
(Int -> ReadS AncillarySourceSettings)
-> ReadS [AncillarySourceSettings]
-> ReadPrec AncillarySourceSettings
-> ReadPrec [AncillarySourceSettings]
-> Read AncillarySourceSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AncillarySourceSettings]
$creadListPrec :: ReadPrec [AncillarySourceSettings]
readPrec :: ReadPrec AncillarySourceSettings
$creadPrec :: ReadPrec AncillarySourceSettings
readList :: ReadS [AncillarySourceSettings]
$creadList :: ReadS [AncillarySourceSettings]
readsPrec :: Int -> ReadS AncillarySourceSettings
$creadsPrec :: Int -> ReadS AncillarySourceSettings
Prelude.Read, Int -> AncillarySourceSettings -> ShowS
[AncillarySourceSettings] -> ShowS
AncillarySourceSettings -> String
(Int -> AncillarySourceSettings -> ShowS)
-> (AncillarySourceSettings -> String)
-> ([AncillarySourceSettings] -> ShowS)
-> Show AncillarySourceSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AncillarySourceSettings] -> ShowS
$cshowList :: [AncillarySourceSettings] -> ShowS
show :: AncillarySourceSettings -> String
$cshow :: AncillarySourceSettings -> String
showsPrec :: Int -> AncillarySourceSettings -> ShowS
$cshowsPrec :: Int -> AncillarySourceSettings -> ShowS
Prelude.Show, (forall x.
 AncillarySourceSettings -> Rep AncillarySourceSettings x)
-> (forall x.
    Rep AncillarySourceSettings x -> AncillarySourceSettings)
-> Generic AncillarySourceSettings
forall x. Rep AncillarySourceSettings x -> AncillarySourceSettings
forall x. AncillarySourceSettings -> Rep AncillarySourceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AncillarySourceSettings x -> AncillarySourceSettings
$cfrom :: forall x. AncillarySourceSettings -> Rep AncillarySourceSettings x
Prelude.Generic)

-- |
-- Create a value of 'AncillarySourceSettings' 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:
--
-- 'convert608To708', 'ancillarySourceSettings_convert608To708' - Specify whether this set of input captions appears in your outputs in
-- both 608 and 708 format. If you choose Upconvert (UPCONVERT),
-- MediaConvert includes the captions data in two ways: it passes the 608
-- data through using the 608 compatibility bytes fields of the 708
-- wrapper, and it also translates the 608 data into 708.
--
-- 'terminateCaptions', 'ancillarySourceSettings_terminateCaptions' - By default, the service terminates any unterminated captions at the end
-- of each input. If you want the caption to continue onto your next input,
-- disable this setting.
--
-- 'sourceAncillaryChannelNumber', 'ancillarySourceSettings_sourceAncillaryChannelNumber' - Specifies the 608 channel number in the ancillary data track from which
-- to extract captions. Unused for passthrough.
newAncillarySourceSettings ::
  AncillarySourceSettings
newAncillarySourceSettings :: AncillarySourceSettings
newAncillarySourceSettings =
  AncillarySourceSettings' :: Maybe AncillaryConvert608To708
-> Maybe AncillaryTerminateCaptions
-> Maybe Natural
-> AncillarySourceSettings
AncillarySourceSettings'
    { $sel:convert608To708:AncillarySourceSettings' :: Maybe AncillaryConvert608To708
convert608To708 =
        Maybe AncillaryConvert608To708
forall a. Maybe a
Prelude.Nothing,
      $sel:terminateCaptions:AncillarySourceSettings' :: Maybe AncillaryTerminateCaptions
terminateCaptions = Maybe AncillaryTerminateCaptions
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceAncillaryChannelNumber:AncillarySourceSettings' :: Maybe Natural
sourceAncillaryChannelNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify whether this set of input captions appears in your outputs in
-- both 608 and 708 format. If you choose Upconvert (UPCONVERT),
-- MediaConvert includes the captions data in two ways: it passes the 608
-- data through using the 608 compatibility bytes fields of the 708
-- wrapper, and it also translates the 608 data into 708.
ancillarySourceSettings_convert608To708 :: Lens.Lens' AncillarySourceSettings (Prelude.Maybe AncillaryConvert608To708)
ancillarySourceSettings_convert608To708 :: (Maybe AncillaryConvert608To708
 -> f (Maybe AncillaryConvert608To708))
-> AncillarySourceSettings -> f AncillarySourceSettings
ancillarySourceSettings_convert608To708 = (AncillarySourceSettings -> Maybe AncillaryConvert608To708)
-> (AncillarySourceSettings
    -> Maybe AncillaryConvert608To708 -> AncillarySourceSettings)
-> Lens
     AncillarySourceSettings
     AncillarySourceSettings
     (Maybe AncillaryConvert608To708)
     (Maybe AncillaryConvert608To708)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AncillarySourceSettings' {Maybe AncillaryConvert608To708
convert608To708 :: Maybe AncillaryConvert608To708
$sel:convert608To708:AncillarySourceSettings' :: AncillarySourceSettings -> Maybe AncillaryConvert608To708
convert608To708} -> Maybe AncillaryConvert608To708
convert608To708) (\s :: AncillarySourceSettings
s@AncillarySourceSettings' {} Maybe AncillaryConvert608To708
a -> AncillarySourceSettings
s {$sel:convert608To708:AncillarySourceSettings' :: Maybe AncillaryConvert608To708
convert608To708 = Maybe AncillaryConvert608To708
a} :: AncillarySourceSettings)

-- | By default, the service terminates any unterminated captions at the end
-- of each input. If you want the caption to continue onto your next input,
-- disable this setting.
ancillarySourceSettings_terminateCaptions :: Lens.Lens' AncillarySourceSettings (Prelude.Maybe AncillaryTerminateCaptions)
ancillarySourceSettings_terminateCaptions :: (Maybe AncillaryTerminateCaptions
 -> f (Maybe AncillaryTerminateCaptions))
-> AncillarySourceSettings -> f AncillarySourceSettings
ancillarySourceSettings_terminateCaptions = (AncillarySourceSettings -> Maybe AncillaryTerminateCaptions)
-> (AncillarySourceSettings
    -> Maybe AncillaryTerminateCaptions -> AncillarySourceSettings)
-> Lens
     AncillarySourceSettings
     AncillarySourceSettings
     (Maybe AncillaryTerminateCaptions)
     (Maybe AncillaryTerminateCaptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AncillarySourceSettings' {Maybe AncillaryTerminateCaptions
terminateCaptions :: Maybe AncillaryTerminateCaptions
$sel:terminateCaptions:AncillarySourceSettings' :: AncillarySourceSettings -> Maybe AncillaryTerminateCaptions
terminateCaptions} -> Maybe AncillaryTerminateCaptions
terminateCaptions) (\s :: AncillarySourceSettings
s@AncillarySourceSettings' {} Maybe AncillaryTerminateCaptions
a -> AncillarySourceSettings
s {$sel:terminateCaptions:AncillarySourceSettings' :: Maybe AncillaryTerminateCaptions
terminateCaptions = Maybe AncillaryTerminateCaptions
a} :: AncillarySourceSettings)

-- | Specifies the 608 channel number in the ancillary data track from which
-- to extract captions. Unused for passthrough.
ancillarySourceSettings_sourceAncillaryChannelNumber :: Lens.Lens' AncillarySourceSettings (Prelude.Maybe Prelude.Natural)
ancillarySourceSettings_sourceAncillaryChannelNumber :: (Maybe Natural -> f (Maybe Natural))
-> AncillarySourceSettings -> f AncillarySourceSettings
ancillarySourceSettings_sourceAncillaryChannelNumber = (AncillarySourceSettings -> Maybe Natural)
-> (AncillarySourceSettings
    -> Maybe Natural -> AncillarySourceSettings)
-> Lens
     AncillarySourceSettings
     AncillarySourceSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AncillarySourceSettings' {Maybe Natural
sourceAncillaryChannelNumber :: Maybe Natural
$sel:sourceAncillaryChannelNumber:AncillarySourceSettings' :: AncillarySourceSettings -> Maybe Natural
sourceAncillaryChannelNumber} -> Maybe Natural
sourceAncillaryChannelNumber) (\s :: AncillarySourceSettings
s@AncillarySourceSettings' {} Maybe Natural
a -> AncillarySourceSettings
s {$sel:sourceAncillaryChannelNumber:AncillarySourceSettings' :: Maybe Natural
sourceAncillaryChannelNumber = Maybe Natural
a} :: AncillarySourceSettings)

instance Core.FromJSON AncillarySourceSettings where
  parseJSON :: Value -> Parser AncillarySourceSettings
parseJSON =
    String
-> (Object -> Parser AncillarySourceSettings)
-> Value
-> Parser AncillarySourceSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AncillarySourceSettings"
      ( \Object
x ->
          Maybe AncillaryConvert608To708
-> Maybe AncillaryTerminateCaptions
-> Maybe Natural
-> AncillarySourceSettings
AncillarySourceSettings'
            (Maybe AncillaryConvert608To708
 -> Maybe AncillaryTerminateCaptions
 -> Maybe Natural
 -> AncillarySourceSettings)
-> Parser (Maybe AncillaryConvert608To708)
-> Parser
     (Maybe AncillaryTerminateCaptions
      -> Maybe Natural -> AncillarySourceSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AncillaryConvert608To708)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"convert608To708")
            Parser
  (Maybe AncillaryTerminateCaptions
   -> Maybe Natural -> AncillarySourceSettings)
-> Parser (Maybe AncillaryTerminateCaptions)
-> Parser (Maybe Natural -> AncillarySourceSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AncillaryTerminateCaptions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"terminateCaptions")
            Parser (Maybe Natural -> AncillarySourceSettings)
-> Parser (Maybe Natural) -> Parser AncillarySourceSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sourceAncillaryChannelNumber")
      )

instance Prelude.Hashable AncillarySourceSettings

instance Prelude.NFData AncillarySourceSettings

instance Core.ToJSON AncillarySourceSettings where
  toJSON :: AncillarySourceSettings -> Value
toJSON AncillarySourceSettings' {Maybe Natural
Maybe AncillaryConvert608To708
Maybe AncillaryTerminateCaptions
sourceAncillaryChannelNumber :: Maybe Natural
terminateCaptions :: Maybe AncillaryTerminateCaptions
convert608To708 :: Maybe AncillaryConvert608To708
$sel:sourceAncillaryChannelNumber:AncillarySourceSettings' :: AncillarySourceSettings -> Maybe Natural
$sel:terminateCaptions:AncillarySourceSettings' :: AncillarySourceSettings -> Maybe AncillaryTerminateCaptions
$sel:convert608To708:AncillarySourceSettings' :: AncillarySourceSettings -> Maybe AncillaryConvert608To708
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"convert608To708" Text -> AncillaryConvert608To708 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AncillaryConvert608To708 -> Pair)
-> Maybe AncillaryConvert608To708 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AncillaryConvert608To708
convert608To708,
            (Text
"terminateCaptions" Text -> AncillaryTerminateCaptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AncillaryTerminateCaptions -> Pair)
-> Maybe AncillaryTerminateCaptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AncillaryTerminateCaptions
terminateCaptions,
            (Text
"sourceAncillaryChannelNumber" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
sourceAncillaryChannelNumber
          ]
      )