{-# 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.MediaLive.Types.Scte20SourceSettings
-- 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.MediaLive.Types.Scte20SourceSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.Scte20Convert608To708
import qualified Amazonka.Prelude as Prelude

-- | Scte20 Source Settings
--
-- /See:/ 'newScte20SourceSettings' smart constructor.
data Scte20SourceSettings = Scte20SourceSettings'
  { -- | If upconvert, 608 data is both passed through via the \"608
    -- compatibility bytes\" fields of the 708 wrapper as well as translated
    -- into 708. 708 data present in the source content will be discarded.
    Scte20SourceSettings -> Maybe Scte20Convert608To708
convert608To708 :: Prelude.Maybe Scte20Convert608To708,
    -- | Specifies the 608\/708 channel number within the video track from which
    -- to extract captions. Unused for passthrough.
    Scte20SourceSettings -> Maybe Natural
source608ChannelNumber :: Prelude.Maybe Prelude.Natural
  }
  deriving (Scte20SourceSettings -> Scte20SourceSettings -> Bool
(Scte20SourceSettings -> Scte20SourceSettings -> Bool)
-> (Scte20SourceSettings -> Scte20SourceSettings -> Bool)
-> Eq Scte20SourceSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte20SourceSettings -> Scte20SourceSettings -> Bool
$c/= :: Scte20SourceSettings -> Scte20SourceSettings -> Bool
== :: Scte20SourceSettings -> Scte20SourceSettings -> Bool
$c== :: Scte20SourceSettings -> Scte20SourceSettings -> Bool
Prelude.Eq, ReadPrec [Scte20SourceSettings]
ReadPrec Scte20SourceSettings
Int -> ReadS Scte20SourceSettings
ReadS [Scte20SourceSettings]
(Int -> ReadS Scte20SourceSettings)
-> ReadS [Scte20SourceSettings]
-> ReadPrec Scte20SourceSettings
-> ReadPrec [Scte20SourceSettings]
-> Read Scte20SourceSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte20SourceSettings]
$creadListPrec :: ReadPrec [Scte20SourceSettings]
readPrec :: ReadPrec Scte20SourceSettings
$creadPrec :: ReadPrec Scte20SourceSettings
readList :: ReadS [Scte20SourceSettings]
$creadList :: ReadS [Scte20SourceSettings]
readsPrec :: Int -> ReadS Scte20SourceSettings
$creadsPrec :: Int -> ReadS Scte20SourceSettings
Prelude.Read, Int -> Scte20SourceSettings -> ShowS
[Scte20SourceSettings] -> ShowS
Scte20SourceSettings -> String
(Int -> Scte20SourceSettings -> ShowS)
-> (Scte20SourceSettings -> String)
-> ([Scte20SourceSettings] -> ShowS)
-> Show Scte20SourceSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte20SourceSettings] -> ShowS
$cshowList :: [Scte20SourceSettings] -> ShowS
show :: Scte20SourceSettings -> String
$cshow :: Scte20SourceSettings -> String
showsPrec :: Int -> Scte20SourceSettings -> ShowS
$cshowsPrec :: Int -> Scte20SourceSettings -> ShowS
Prelude.Show, (forall x. Scte20SourceSettings -> Rep Scte20SourceSettings x)
-> (forall x. Rep Scte20SourceSettings x -> Scte20SourceSettings)
-> Generic Scte20SourceSettings
forall x. Rep Scte20SourceSettings x -> Scte20SourceSettings
forall x. Scte20SourceSettings -> Rep Scte20SourceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scte20SourceSettings x -> Scte20SourceSettings
$cfrom :: forall x. Scte20SourceSettings -> Rep Scte20SourceSettings x
Prelude.Generic)

-- |
-- Create a value of 'Scte20SourceSettings' 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', 'scte20SourceSettings_convert608To708' - If upconvert, 608 data is both passed through via the \"608
-- compatibility bytes\" fields of the 708 wrapper as well as translated
-- into 708. 708 data present in the source content will be discarded.
--
-- 'source608ChannelNumber', 'scte20SourceSettings_source608ChannelNumber' - Specifies the 608\/708 channel number within the video track from which
-- to extract captions. Unused for passthrough.
newScte20SourceSettings ::
  Scte20SourceSettings
newScte20SourceSettings :: Scte20SourceSettings
newScte20SourceSettings =
  Scte20SourceSettings' :: Maybe Scte20Convert608To708
-> Maybe Natural -> Scte20SourceSettings
Scte20SourceSettings'
    { $sel:convert608To708:Scte20SourceSettings' :: Maybe Scte20Convert608To708
convert608To708 =
        Maybe Scte20Convert608To708
forall a. Maybe a
Prelude.Nothing,
      $sel:source608ChannelNumber:Scte20SourceSettings' :: Maybe Natural
source608ChannelNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | If upconvert, 608 data is both passed through via the \"608
-- compatibility bytes\" fields of the 708 wrapper as well as translated
-- into 708. 708 data present in the source content will be discarded.
scte20SourceSettings_convert608To708 :: Lens.Lens' Scte20SourceSettings (Prelude.Maybe Scte20Convert608To708)
scte20SourceSettings_convert608To708 :: (Maybe Scte20Convert608To708 -> f (Maybe Scte20Convert608To708))
-> Scte20SourceSettings -> f Scte20SourceSettings
scte20SourceSettings_convert608To708 = (Scte20SourceSettings -> Maybe Scte20Convert608To708)
-> (Scte20SourceSettings
    -> Maybe Scte20Convert608To708 -> Scte20SourceSettings)
-> Lens
     Scte20SourceSettings
     Scte20SourceSettings
     (Maybe Scte20Convert608To708)
     (Maybe Scte20Convert608To708)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte20SourceSettings' {Maybe Scte20Convert608To708
convert608To708 :: Maybe Scte20Convert608To708
$sel:convert608To708:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Scte20Convert608To708
convert608To708} -> Maybe Scte20Convert608To708
convert608To708) (\s :: Scte20SourceSettings
s@Scte20SourceSettings' {} Maybe Scte20Convert608To708
a -> Scte20SourceSettings
s {$sel:convert608To708:Scte20SourceSettings' :: Maybe Scte20Convert608To708
convert608To708 = Maybe Scte20Convert608To708
a} :: Scte20SourceSettings)

-- | Specifies the 608\/708 channel number within the video track from which
-- to extract captions. Unused for passthrough.
scte20SourceSettings_source608ChannelNumber :: Lens.Lens' Scte20SourceSettings (Prelude.Maybe Prelude.Natural)
scte20SourceSettings_source608ChannelNumber :: (Maybe Natural -> f (Maybe Natural))
-> Scte20SourceSettings -> f Scte20SourceSettings
scte20SourceSettings_source608ChannelNumber = (Scte20SourceSettings -> Maybe Natural)
-> (Scte20SourceSettings -> Maybe Natural -> Scte20SourceSettings)
-> Lens
     Scte20SourceSettings
     Scte20SourceSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte20SourceSettings' {Maybe Natural
source608ChannelNumber :: Maybe Natural
$sel:source608ChannelNumber:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Natural
source608ChannelNumber} -> Maybe Natural
source608ChannelNumber) (\s :: Scte20SourceSettings
s@Scte20SourceSettings' {} Maybe Natural
a -> Scte20SourceSettings
s {$sel:source608ChannelNumber:Scte20SourceSettings' :: Maybe Natural
source608ChannelNumber = Maybe Natural
a} :: Scte20SourceSettings)

instance Core.FromJSON Scte20SourceSettings where
  parseJSON :: Value -> Parser Scte20SourceSettings
parseJSON =
    String
-> (Object -> Parser Scte20SourceSettings)
-> Value
-> Parser Scte20SourceSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Scte20SourceSettings"
      ( \Object
x ->
          Maybe Scte20Convert608To708
-> Maybe Natural -> Scte20SourceSettings
Scte20SourceSettings'
            (Maybe Scte20Convert608To708
 -> Maybe Natural -> Scte20SourceSettings)
-> Parser (Maybe Scte20Convert608To708)
-> Parser (Maybe Natural -> Scte20SourceSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Scte20Convert608To708)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"convert608To708")
            Parser (Maybe Natural -> Scte20SourceSettings)
-> Parser (Maybe Natural) -> Parser Scte20SourceSettings
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
"source608ChannelNumber")
      )

instance Prelude.Hashable Scte20SourceSettings

instance Prelude.NFData Scte20SourceSettings

instance Core.ToJSON Scte20SourceSettings where
  toJSON :: Scte20SourceSettings -> Value
toJSON Scte20SourceSettings' {Maybe Natural
Maybe Scte20Convert608To708
source608ChannelNumber :: Maybe Natural
convert608To708 :: Maybe Scte20Convert608To708
$sel:source608ChannelNumber:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Natural
$sel:convert608To708:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Scte20Convert608To708
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"convert608To708" Text -> Scte20Convert608To708 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Scte20Convert608To708 -> Pair)
-> Maybe Scte20Convert608To708 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Scte20Convert608To708
convert608To708,
            (Text
"source608ChannelNumber" 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
source608ChannelNumber
          ]
      )