{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.Scte20SourceSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:convert608To708:Scte20SourceSettings' :: Maybe Scte20Convert608To708
convert608To708 =
        forall a. Maybe a
Prelude.Nothing,
      $sel:source608ChannelNumber:Scte20SourceSettings' :: Maybe Natural
source608ChannelNumber = 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 :: Lens' Scte20SourceSettings (Maybe Scte20Convert608To708)
scte20SourceSettings_convert608To708 = 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 :: Lens' Scte20SourceSettings (Maybe Natural)
scte20SourceSettings_source608ChannelNumber = 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 Data.FromJSON Scte20SourceSettings where
  parseJSON :: Value -> Parser Scte20SourceSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Scte20SourceSettings"
      ( \Object
x ->
          Maybe Scte20Convert608To708
-> Maybe Natural -> Scte20SourceSettings
Scte20SourceSettings'
            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
"convert608To708")
            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
"source608ChannelNumber")
      )

instance Prelude.Hashable Scte20SourceSettings where
  hashWithSalt :: Int -> Scte20SourceSettings -> Int
hashWithSalt Int
_salt Scte20SourceSettings' {Maybe Natural
Maybe Scte20Convert608To708
source608ChannelNumber :: Maybe Natural
convert608To708 :: Maybe Scte20Convert608To708
$sel:source608ChannelNumber:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Natural
$sel:convert608To708:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Scte20Convert608To708
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scte20Convert608To708
convert608To708
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
source608ChannelNumber

instance Prelude.NFData Scte20SourceSettings where
  rnf :: Scte20SourceSettings -> ()
rnf Scte20SourceSettings' {Maybe Natural
Maybe Scte20Convert608To708
source608ChannelNumber :: Maybe Natural
convert608To708 :: Maybe Scte20Convert608To708
$sel:source608ChannelNumber:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Natural
$sel:convert608To708:Scte20SourceSettings' :: Scte20SourceSettings -> Maybe Scte20Convert608To708
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Scte20Convert608To708
convert608To708
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
source608ChannelNumber

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"convert608To708" 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 Scte20Convert608To708
convert608To708,
            (Key
"source608ChannelNumber" 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 Natural
source608ChannelNumber
          ]
      )