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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Settings for SCTE-35 signals from ESAM. Include this in your job
-- settings to put SCTE-35 markers in your HLS and transport stream outputs
-- at the insertion points that you specify in an ESAM XML document.
-- Provide the document in the setting SCC XML (sccXml).
--
-- /See:/ 'newM2tsScte35Esam' smart constructor.
data M2tsScte35Esam = M2tsScte35Esam'
  { -- | Packet Identifier (PID) of the SCTE-35 stream in the transport stream
    -- generated by ESAM.
    M2tsScte35Esam -> Maybe Natural
scte35EsamPid :: Prelude.Maybe Prelude.Natural
  }
  deriving (M2tsScte35Esam -> M2tsScte35Esam -> Bool
(M2tsScte35Esam -> M2tsScte35Esam -> Bool)
-> (M2tsScte35Esam -> M2tsScte35Esam -> Bool) -> Eq M2tsScte35Esam
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: M2tsScte35Esam -> M2tsScte35Esam -> Bool
$c/= :: M2tsScte35Esam -> M2tsScte35Esam -> Bool
== :: M2tsScte35Esam -> M2tsScte35Esam -> Bool
$c== :: M2tsScte35Esam -> M2tsScte35Esam -> Bool
Prelude.Eq, ReadPrec [M2tsScte35Esam]
ReadPrec M2tsScte35Esam
Int -> ReadS M2tsScte35Esam
ReadS [M2tsScte35Esam]
(Int -> ReadS M2tsScte35Esam)
-> ReadS [M2tsScte35Esam]
-> ReadPrec M2tsScte35Esam
-> ReadPrec [M2tsScte35Esam]
-> Read M2tsScte35Esam
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [M2tsScte35Esam]
$creadListPrec :: ReadPrec [M2tsScte35Esam]
readPrec :: ReadPrec M2tsScte35Esam
$creadPrec :: ReadPrec M2tsScte35Esam
readList :: ReadS [M2tsScte35Esam]
$creadList :: ReadS [M2tsScte35Esam]
readsPrec :: Int -> ReadS M2tsScte35Esam
$creadsPrec :: Int -> ReadS M2tsScte35Esam
Prelude.Read, Int -> M2tsScte35Esam -> ShowS
[M2tsScte35Esam] -> ShowS
M2tsScte35Esam -> String
(Int -> M2tsScte35Esam -> ShowS)
-> (M2tsScte35Esam -> String)
-> ([M2tsScte35Esam] -> ShowS)
-> Show M2tsScte35Esam
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [M2tsScte35Esam] -> ShowS
$cshowList :: [M2tsScte35Esam] -> ShowS
show :: M2tsScte35Esam -> String
$cshow :: M2tsScte35Esam -> String
showsPrec :: Int -> M2tsScte35Esam -> ShowS
$cshowsPrec :: Int -> M2tsScte35Esam -> ShowS
Prelude.Show, (forall x. M2tsScte35Esam -> Rep M2tsScte35Esam x)
-> (forall x. Rep M2tsScte35Esam x -> M2tsScte35Esam)
-> Generic M2tsScte35Esam
forall x. Rep M2tsScte35Esam x -> M2tsScte35Esam
forall x. M2tsScte35Esam -> Rep M2tsScte35Esam x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep M2tsScte35Esam x -> M2tsScte35Esam
$cfrom :: forall x. M2tsScte35Esam -> Rep M2tsScte35Esam x
Prelude.Generic)

-- |
-- Create a value of 'M2tsScte35Esam' 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:
--
-- 'scte35EsamPid', 'm2tsScte35Esam_scte35EsamPid' - Packet Identifier (PID) of the SCTE-35 stream in the transport stream
-- generated by ESAM.
newM2tsScte35Esam ::
  M2tsScte35Esam
newM2tsScte35Esam :: M2tsScte35Esam
newM2tsScte35Esam =
  M2tsScte35Esam' :: Maybe Natural -> M2tsScte35Esam
M2tsScte35Esam' {$sel:scte35EsamPid:M2tsScte35Esam' :: Maybe Natural
scte35EsamPid = Maybe Natural
forall a. Maybe a
Prelude.Nothing}

-- | Packet Identifier (PID) of the SCTE-35 stream in the transport stream
-- generated by ESAM.
m2tsScte35Esam_scte35EsamPid :: Lens.Lens' M2tsScte35Esam (Prelude.Maybe Prelude.Natural)
m2tsScte35Esam_scte35EsamPid :: (Maybe Natural -> f (Maybe Natural))
-> M2tsScte35Esam -> f M2tsScte35Esam
m2tsScte35Esam_scte35EsamPid = (M2tsScte35Esam -> Maybe Natural)
-> (M2tsScte35Esam -> Maybe Natural -> M2tsScte35Esam)
-> Lens
     M2tsScte35Esam M2tsScte35Esam (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\M2tsScte35Esam' {Maybe Natural
scte35EsamPid :: Maybe Natural
$sel:scte35EsamPid:M2tsScte35Esam' :: M2tsScte35Esam -> Maybe Natural
scte35EsamPid} -> Maybe Natural
scte35EsamPid) (\s :: M2tsScte35Esam
s@M2tsScte35Esam' {} Maybe Natural
a -> M2tsScte35Esam
s {$sel:scte35EsamPid:M2tsScte35Esam' :: Maybe Natural
scte35EsamPid = Maybe Natural
a} :: M2tsScte35Esam)

instance Core.FromJSON M2tsScte35Esam where
  parseJSON :: Value -> Parser M2tsScte35Esam
parseJSON =
    String
-> (Object -> Parser M2tsScte35Esam)
-> Value
-> Parser M2tsScte35Esam
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"M2tsScte35Esam"
      ( \Object
x ->
          Maybe Natural -> M2tsScte35Esam
M2tsScte35Esam'
            (Maybe Natural -> M2tsScte35Esam)
-> Parser (Maybe Natural) -> Parser M2tsScte35Esam
forall (f :: * -> *) a b. Functor 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
"scte35EsamPid")
      )

instance Prelude.Hashable M2tsScte35Esam

instance Prelude.NFData M2tsScte35Esam

instance Core.ToJSON M2tsScte35Esam where
  toJSON :: M2tsScte35Esam -> Value
toJSON M2tsScte35Esam' {Maybe Natural
scte35EsamPid :: Maybe Natural
$sel:scte35EsamPid:M2tsScte35Esam' :: M2tsScte35Esam -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"scte35EsamPid" 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
scte35EsamPid
          ]
      )