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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.EsamManifestConfirmConditionNotification
import Amazonka.MediaConvert.Types.EsamSignalProcessingNotification
import qualified Amazonka.Prelude as Prelude

-- | Settings for Event Signaling And Messaging (ESAM). If you don\'t do ad
-- insertion, you can ignore these settings.
--
-- /See:/ 'newEsamSettings' smart constructor.
data EsamSettings = EsamSettings'
  { -- | Specifies an ESAM ManifestConfirmConditionNotification XML as per
    -- OC-SP-ESAM-API-I03-131025. The transcoder uses the manifest conditioning
    -- instructions that you provide in the setting MCC XML (mccXml).
    EsamSettings -> Maybe EsamManifestConfirmConditionNotification
manifestConfirmConditionNotification :: Prelude.Maybe EsamManifestConfirmConditionNotification,
    -- | Specifies the stream distance, in milliseconds, between the SCTE 35
    -- messages that the transcoder places and the splice points that they
    -- refer to. If the time between the start of the asset and the SCTE-35
    -- message is less than this value, then the transcoder places the SCTE-35
    -- marker at the beginning of the stream.
    EsamSettings -> Maybe Natural
responseSignalPreroll :: Prelude.Maybe Prelude.Natural,
    -- | Specifies an ESAM SignalProcessingNotification XML as per
    -- OC-SP-ESAM-API-I03-131025. The transcoder uses the signal processing
    -- instructions that you provide in the setting SCC XML (sccXml).
    EsamSettings -> Maybe EsamSignalProcessingNotification
signalProcessingNotification :: Prelude.Maybe EsamSignalProcessingNotification
  }
  deriving (EsamSettings -> EsamSettings -> Bool
(EsamSettings -> EsamSettings -> Bool)
-> (EsamSettings -> EsamSettings -> Bool) -> Eq EsamSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EsamSettings -> EsamSettings -> Bool
$c/= :: EsamSettings -> EsamSettings -> Bool
== :: EsamSettings -> EsamSettings -> Bool
$c== :: EsamSettings -> EsamSettings -> Bool
Prelude.Eq, ReadPrec [EsamSettings]
ReadPrec EsamSettings
Int -> ReadS EsamSettings
ReadS [EsamSettings]
(Int -> ReadS EsamSettings)
-> ReadS [EsamSettings]
-> ReadPrec EsamSettings
-> ReadPrec [EsamSettings]
-> Read EsamSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EsamSettings]
$creadListPrec :: ReadPrec [EsamSettings]
readPrec :: ReadPrec EsamSettings
$creadPrec :: ReadPrec EsamSettings
readList :: ReadS [EsamSettings]
$creadList :: ReadS [EsamSettings]
readsPrec :: Int -> ReadS EsamSettings
$creadsPrec :: Int -> ReadS EsamSettings
Prelude.Read, Int -> EsamSettings -> ShowS
[EsamSettings] -> ShowS
EsamSettings -> String
(Int -> EsamSettings -> ShowS)
-> (EsamSettings -> String)
-> ([EsamSettings] -> ShowS)
-> Show EsamSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EsamSettings] -> ShowS
$cshowList :: [EsamSettings] -> ShowS
show :: EsamSettings -> String
$cshow :: EsamSettings -> String
showsPrec :: Int -> EsamSettings -> ShowS
$cshowsPrec :: Int -> EsamSettings -> ShowS
Prelude.Show, (forall x. EsamSettings -> Rep EsamSettings x)
-> (forall x. Rep EsamSettings x -> EsamSettings)
-> Generic EsamSettings
forall x. Rep EsamSettings x -> EsamSettings
forall x. EsamSettings -> Rep EsamSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EsamSettings x -> EsamSettings
$cfrom :: forall x. EsamSettings -> Rep EsamSettings x
Prelude.Generic)

-- |
-- Create a value of 'EsamSettings' 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:
--
-- 'manifestConfirmConditionNotification', 'esamSettings_manifestConfirmConditionNotification' - Specifies an ESAM ManifestConfirmConditionNotification XML as per
-- OC-SP-ESAM-API-I03-131025. The transcoder uses the manifest conditioning
-- instructions that you provide in the setting MCC XML (mccXml).
--
-- 'responseSignalPreroll', 'esamSettings_responseSignalPreroll' - Specifies the stream distance, in milliseconds, between the SCTE 35
-- messages that the transcoder places and the splice points that they
-- refer to. If the time between the start of the asset and the SCTE-35
-- message is less than this value, then the transcoder places the SCTE-35
-- marker at the beginning of the stream.
--
-- 'signalProcessingNotification', 'esamSettings_signalProcessingNotification' - Specifies an ESAM SignalProcessingNotification XML as per
-- OC-SP-ESAM-API-I03-131025. The transcoder uses the signal processing
-- instructions that you provide in the setting SCC XML (sccXml).
newEsamSettings ::
  EsamSettings
newEsamSettings :: EsamSettings
newEsamSettings =
  EsamSettings' :: Maybe EsamManifestConfirmConditionNotification
-> Maybe Natural
-> Maybe EsamSignalProcessingNotification
-> EsamSettings
EsamSettings'
    { $sel:manifestConfirmConditionNotification:EsamSettings' :: Maybe EsamManifestConfirmConditionNotification
manifestConfirmConditionNotification =
        Maybe EsamManifestConfirmConditionNotification
forall a. Maybe a
Prelude.Nothing,
      $sel:responseSignalPreroll:EsamSettings' :: Maybe Natural
responseSignalPreroll = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:signalProcessingNotification:EsamSettings' :: Maybe EsamSignalProcessingNotification
signalProcessingNotification = Maybe EsamSignalProcessingNotification
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies an ESAM ManifestConfirmConditionNotification XML as per
-- OC-SP-ESAM-API-I03-131025. The transcoder uses the manifest conditioning
-- instructions that you provide in the setting MCC XML (mccXml).
esamSettings_manifestConfirmConditionNotification :: Lens.Lens' EsamSettings (Prelude.Maybe EsamManifestConfirmConditionNotification)
esamSettings_manifestConfirmConditionNotification :: (Maybe EsamManifestConfirmConditionNotification
 -> f (Maybe EsamManifestConfirmConditionNotification))
-> EsamSettings -> f EsamSettings
esamSettings_manifestConfirmConditionNotification = (EsamSettings -> Maybe EsamManifestConfirmConditionNotification)
-> (EsamSettings
    -> Maybe EsamManifestConfirmConditionNotification -> EsamSettings)
-> Lens
     EsamSettings
     EsamSettings
     (Maybe EsamManifestConfirmConditionNotification)
     (Maybe EsamManifestConfirmConditionNotification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EsamSettings' {Maybe EsamManifestConfirmConditionNotification
manifestConfirmConditionNotification :: Maybe EsamManifestConfirmConditionNotification
$sel:manifestConfirmConditionNotification:EsamSettings' :: EsamSettings -> Maybe EsamManifestConfirmConditionNotification
manifestConfirmConditionNotification} -> Maybe EsamManifestConfirmConditionNotification
manifestConfirmConditionNotification) (\s :: EsamSettings
s@EsamSettings' {} Maybe EsamManifestConfirmConditionNotification
a -> EsamSettings
s {$sel:manifestConfirmConditionNotification:EsamSettings' :: Maybe EsamManifestConfirmConditionNotification
manifestConfirmConditionNotification = Maybe EsamManifestConfirmConditionNotification
a} :: EsamSettings)

-- | Specifies the stream distance, in milliseconds, between the SCTE 35
-- messages that the transcoder places and the splice points that they
-- refer to. If the time between the start of the asset and the SCTE-35
-- message is less than this value, then the transcoder places the SCTE-35
-- marker at the beginning of the stream.
esamSettings_responseSignalPreroll :: Lens.Lens' EsamSettings (Prelude.Maybe Prelude.Natural)
esamSettings_responseSignalPreroll :: (Maybe Natural -> f (Maybe Natural))
-> EsamSettings -> f EsamSettings
esamSettings_responseSignalPreroll = (EsamSettings -> Maybe Natural)
-> (EsamSettings -> Maybe Natural -> EsamSettings)
-> Lens EsamSettings EsamSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EsamSettings' {Maybe Natural
responseSignalPreroll :: Maybe Natural
$sel:responseSignalPreroll:EsamSettings' :: EsamSettings -> Maybe Natural
responseSignalPreroll} -> Maybe Natural
responseSignalPreroll) (\s :: EsamSettings
s@EsamSettings' {} Maybe Natural
a -> EsamSettings
s {$sel:responseSignalPreroll:EsamSettings' :: Maybe Natural
responseSignalPreroll = Maybe Natural
a} :: EsamSettings)

-- | Specifies an ESAM SignalProcessingNotification XML as per
-- OC-SP-ESAM-API-I03-131025. The transcoder uses the signal processing
-- instructions that you provide in the setting SCC XML (sccXml).
esamSettings_signalProcessingNotification :: Lens.Lens' EsamSettings (Prelude.Maybe EsamSignalProcessingNotification)
esamSettings_signalProcessingNotification :: (Maybe EsamSignalProcessingNotification
 -> f (Maybe EsamSignalProcessingNotification))
-> EsamSettings -> f EsamSettings
esamSettings_signalProcessingNotification = (EsamSettings -> Maybe EsamSignalProcessingNotification)
-> (EsamSettings
    -> Maybe EsamSignalProcessingNotification -> EsamSettings)
-> Lens
     EsamSettings
     EsamSettings
     (Maybe EsamSignalProcessingNotification)
     (Maybe EsamSignalProcessingNotification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EsamSettings' {Maybe EsamSignalProcessingNotification
signalProcessingNotification :: Maybe EsamSignalProcessingNotification
$sel:signalProcessingNotification:EsamSettings' :: EsamSettings -> Maybe EsamSignalProcessingNotification
signalProcessingNotification} -> Maybe EsamSignalProcessingNotification
signalProcessingNotification) (\s :: EsamSettings
s@EsamSettings' {} Maybe EsamSignalProcessingNotification
a -> EsamSettings
s {$sel:signalProcessingNotification:EsamSettings' :: Maybe EsamSignalProcessingNotification
signalProcessingNotification = Maybe EsamSignalProcessingNotification
a} :: EsamSettings)

instance Core.FromJSON EsamSettings where
  parseJSON :: Value -> Parser EsamSettings
parseJSON =
    String
-> (Object -> Parser EsamSettings) -> Value -> Parser EsamSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EsamSettings"
      ( \Object
x ->
          Maybe EsamManifestConfirmConditionNotification
-> Maybe Natural
-> Maybe EsamSignalProcessingNotification
-> EsamSettings
EsamSettings'
            (Maybe EsamManifestConfirmConditionNotification
 -> Maybe Natural
 -> Maybe EsamSignalProcessingNotification
 -> EsamSettings)
-> Parser (Maybe EsamManifestConfirmConditionNotification)
-> Parser
     (Maybe Natural
      -> Maybe EsamSignalProcessingNotification -> EsamSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe EsamManifestConfirmConditionNotification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"manifestConfirmConditionNotification")
            Parser
  (Maybe Natural
   -> Maybe EsamSignalProcessingNotification -> EsamSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe EsamSignalProcessingNotification -> EsamSettings)
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
"responseSignalPreroll")
            Parser (Maybe EsamSignalProcessingNotification -> EsamSettings)
-> Parser (Maybe EsamSignalProcessingNotification)
-> Parser EsamSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EsamSignalProcessingNotification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"signalProcessingNotification")
      )

instance Prelude.Hashable EsamSettings

instance Prelude.NFData EsamSettings

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