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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.GlobalConfigurationInputEndAction
import Amazonka.MediaLive.Types.GlobalConfigurationLowFramerateInputs
import Amazonka.MediaLive.Types.GlobalConfigurationOutputLockingMode
import Amazonka.MediaLive.Types.GlobalConfigurationOutputTimingSource
import Amazonka.MediaLive.Types.InputLossBehavior
import qualified Amazonka.Prelude as Prelude

-- | Global Configuration
--
-- /See:/ 'newGlobalConfiguration' smart constructor.
data GlobalConfiguration = GlobalConfiguration'
  { -- | Indicates how MediaLive pipelines are synchronized. PIPELINE_LOCKING -
    -- MediaLive will attempt to synchronize the output of each pipeline to the
    -- other. EPOCH_LOCKING - MediaLive will attempt to synchronize the output
    -- of each pipeline to the Unix epoch.
    GlobalConfiguration -> Maybe GlobalConfigurationOutputLockingMode
outputLockingMode :: Prelude.Maybe GlobalConfigurationOutputLockingMode,
    -- | Settings for system actions when input is lost.
    GlobalConfiguration -> Maybe InputLossBehavior
inputLossBehavior :: Prelude.Maybe InputLossBehavior,
    -- | Value to set the initial audio gain for the Live Event.
    GlobalConfiguration -> Maybe Int
initialAudioGain :: Prelude.Maybe Prelude.Int,
    -- | Adjusts video input buffer for streams with very low video framerates.
    -- This is commonly set to enabled for music channels with less than one
    -- video frame per second.
    GlobalConfiguration -> Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs :: Prelude.Maybe GlobalConfigurationLowFramerateInputs,
    -- | Indicates the action to take when the current input completes (e.g.
    -- end-of-file). When switchAndLoopInputs is configured the encoder will
    -- restart at the beginning of the first input. When \"none\" is configured
    -- the encoder will transcode either black, a solid color, or a user
    -- specified slate images per the \"Input Loss Behavior\" configuration
    -- until the next input switch occurs (which is controlled through the
    -- Channel Schedule API).
    GlobalConfiguration -> Maybe GlobalConfigurationInputEndAction
inputEndAction :: Prelude.Maybe GlobalConfigurationInputEndAction,
    -- | Indicates whether the rate of frames emitted by the Live encoder should
    -- be paced by its system clock (which optionally may be locked to another
    -- source via NTP) or should be locked to the clock of the source that is
    -- providing the input stream.
    GlobalConfiguration -> Maybe GlobalConfigurationOutputTimingSource
outputTimingSource :: Prelude.Maybe GlobalConfigurationOutputTimingSource
  }
  deriving (GlobalConfiguration -> GlobalConfiguration -> Bool
(GlobalConfiguration -> GlobalConfiguration -> Bool)
-> (GlobalConfiguration -> GlobalConfiguration -> Bool)
-> Eq GlobalConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GlobalConfiguration -> GlobalConfiguration -> Bool
$c/= :: GlobalConfiguration -> GlobalConfiguration -> Bool
== :: GlobalConfiguration -> GlobalConfiguration -> Bool
$c== :: GlobalConfiguration -> GlobalConfiguration -> Bool
Prelude.Eq, ReadPrec [GlobalConfiguration]
ReadPrec GlobalConfiguration
Int -> ReadS GlobalConfiguration
ReadS [GlobalConfiguration]
(Int -> ReadS GlobalConfiguration)
-> ReadS [GlobalConfiguration]
-> ReadPrec GlobalConfiguration
-> ReadPrec [GlobalConfiguration]
-> Read GlobalConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GlobalConfiguration]
$creadListPrec :: ReadPrec [GlobalConfiguration]
readPrec :: ReadPrec GlobalConfiguration
$creadPrec :: ReadPrec GlobalConfiguration
readList :: ReadS [GlobalConfiguration]
$creadList :: ReadS [GlobalConfiguration]
readsPrec :: Int -> ReadS GlobalConfiguration
$creadsPrec :: Int -> ReadS GlobalConfiguration
Prelude.Read, Int -> GlobalConfiguration -> ShowS
[GlobalConfiguration] -> ShowS
GlobalConfiguration -> String
(Int -> GlobalConfiguration -> ShowS)
-> (GlobalConfiguration -> String)
-> ([GlobalConfiguration] -> ShowS)
-> Show GlobalConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GlobalConfiguration] -> ShowS
$cshowList :: [GlobalConfiguration] -> ShowS
show :: GlobalConfiguration -> String
$cshow :: GlobalConfiguration -> String
showsPrec :: Int -> GlobalConfiguration -> ShowS
$cshowsPrec :: Int -> GlobalConfiguration -> ShowS
Prelude.Show, (forall x. GlobalConfiguration -> Rep GlobalConfiguration x)
-> (forall x. Rep GlobalConfiguration x -> GlobalConfiguration)
-> Generic GlobalConfiguration
forall x. Rep GlobalConfiguration x -> GlobalConfiguration
forall x. GlobalConfiguration -> Rep GlobalConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GlobalConfiguration x -> GlobalConfiguration
$cfrom :: forall x. GlobalConfiguration -> Rep GlobalConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GlobalConfiguration' 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:
--
-- 'outputLockingMode', 'globalConfiguration_outputLockingMode' - Indicates how MediaLive pipelines are synchronized. PIPELINE_LOCKING -
-- MediaLive will attempt to synchronize the output of each pipeline to the
-- other. EPOCH_LOCKING - MediaLive will attempt to synchronize the output
-- of each pipeline to the Unix epoch.
--
-- 'inputLossBehavior', 'globalConfiguration_inputLossBehavior' - Settings for system actions when input is lost.
--
-- 'initialAudioGain', 'globalConfiguration_initialAudioGain' - Value to set the initial audio gain for the Live Event.
--
-- 'supportLowFramerateInputs', 'globalConfiguration_supportLowFramerateInputs' - Adjusts video input buffer for streams with very low video framerates.
-- This is commonly set to enabled for music channels with less than one
-- video frame per second.
--
-- 'inputEndAction', 'globalConfiguration_inputEndAction' - Indicates the action to take when the current input completes (e.g.
-- end-of-file). When switchAndLoopInputs is configured the encoder will
-- restart at the beginning of the first input. When \"none\" is configured
-- the encoder will transcode either black, a solid color, or a user
-- specified slate images per the \"Input Loss Behavior\" configuration
-- until the next input switch occurs (which is controlled through the
-- Channel Schedule API).
--
-- 'outputTimingSource', 'globalConfiguration_outputTimingSource' - Indicates whether the rate of frames emitted by the Live encoder should
-- be paced by its system clock (which optionally may be locked to another
-- source via NTP) or should be locked to the clock of the source that is
-- providing the input stream.
newGlobalConfiguration ::
  GlobalConfiguration
newGlobalConfiguration :: GlobalConfiguration
newGlobalConfiguration =
  GlobalConfiguration' :: Maybe GlobalConfigurationOutputLockingMode
-> Maybe InputLossBehavior
-> Maybe Int
-> Maybe GlobalConfigurationLowFramerateInputs
-> Maybe GlobalConfigurationInputEndAction
-> Maybe GlobalConfigurationOutputTimingSource
-> GlobalConfiguration
GlobalConfiguration'
    { $sel:outputLockingMode:GlobalConfiguration' :: Maybe GlobalConfigurationOutputLockingMode
outputLockingMode =
        Maybe GlobalConfigurationOutputLockingMode
forall a. Maybe a
Prelude.Nothing,
      $sel:inputLossBehavior:GlobalConfiguration' :: Maybe InputLossBehavior
inputLossBehavior = Maybe InputLossBehavior
forall a. Maybe a
Prelude.Nothing,
      $sel:initialAudioGain:GlobalConfiguration' :: Maybe Int
initialAudioGain = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:supportLowFramerateInputs:GlobalConfiguration' :: Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs = Maybe GlobalConfigurationLowFramerateInputs
forall a. Maybe a
Prelude.Nothing,
      $sel:inputEndAction:GlobalConfiguration' :: Maybe GlobalConfigurationInputEndAction
inputEndAction = Maybe GlobalConfigurationInputEndAction
forall a. Maybe a
Prelude.Nothing,
      $sel:outputTimingSource:GlobalConfiguration' :: Maybe GlobalConfigurationOutputTimingSource
outputTimingSource = Maybe GlobalConfigurationOutputTimingSource
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates how MediaLive pipelines are synchronized. PIPELINE_LOCKING -
-- MediaLive will attempt to synchronize the output of each pipeline to the
-- other. EPOCH_LOCKING - MediaLive will attempt to synchronize the output
-- of each pipeline to the Unix epoch.
globalConfiguration_outputLockingMode :: Lens.Lens' GlobalConfiguration (Prelude.Maybe GlobalConfigurationOutputLockingMode)
globalConfiguration_outputLockingMode :: (Maybe GlobalConfigurationOutputLockingMode
 -> f (Maybe GlobalConfigurationOutputLockingMode))
-> GlobalConfiguration -> f GlobalConfiguration
globalConfiguration_outputLockingMode = (GlobalConfiguration -> Maybe GlobalConfigurationOutputLockingMode)
-> (GlobalConfiguration
    -> Maybe GlobalConfigurationOutputLockingMode
    -> GlobalConfiguration)
-> Lens
     GlobalConfiguration
     GlobalConfiguration
     (Maybe GlobalConfigurationOutputLockingMode)
     (Maybe GlobalConfigurationOutputLockingMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalConfiguration' {Maybe GlobalConfigurationOutputLockingMode
outputLockingMode :: Maybe GlobalConfigurationOutputLockingMode
$sel:outputLockingMode:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationOutputLockingMode
outputLockingMode} -> Maybe GlobalConfigurationOutputLockingMode
outputLockingMode) (\s :: GlobalConfiguration
s@GlobalConfiguration' {} Maybe GlobalConfigurationOutputLockingMode
a -> GlobalConfiguration
s {$sel:outputLockingMode:GlobalConfiguration' :: Maybe GlobalConfigurationOutputLockingMode
outputLockingMode = Maybe GlobalConfigurationOutputLockingMode
a} :: GlobalConfiguration)

-- | Settings for system actions when input is lost.
globalConfiguration_inputLossBehavior :: Lens.Lens' GlobalConfiguration (Prelude.Maybe InputLossBehavior)
globalConfiguration_inputLossBehavior :: (Maybe InputLossBehavior -> f (Maybe InputLossBehavior))
-> GlobalConfiguration -> f GlobalConfiguration
globalConfiguration_inputLossBehavior = (GlobalConfiguration -> Maybe InputLossBehavior)
-> (GlobalConfiguration
    -> Maybe InputLossBehavior -> GlobalConfiguration)
-> Lens
     GlobalConfiguration
     GlobalConfiguration
     (Maybe InputLossBehavior)
     (Maybe InputLossBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalConfiguration' {Maybe InputLossBehavior
inputLossBehavior :: Maybe InputLossBehavior
$sel:inputLossBehavior:GlobalConfiguration' :: GlobalConfiguration -> Maybe InputLossBehavior
inputLossBehavior} -> Maybe InputLossBehavior
inputLossBehavior) (\s :: GlobalConfiguration
s@GlobalConfiguration' {} Maybe InputLossBehavior
a -> GlobalConfiguration
s {$sel:inputLossBehavior:GlobalConfiguration' :: Maybe InputLossBehavior
inputLossBehavior = Maybe InputLossBehavior
a} :: GlobalConfiguration)

-- | Value to set the initial audio gain for the Live Event.
globalConfiguration_initialAudioGain :: Lens.Lens' GlobalConfiguration (Prelude.Maybe Prelude.Int)
globalConfiguration_initialAudioGain :: (Maybe Int -> f (Maybe Int))
-> GlobalConfiguration -> f GlobalConfiguration
globalConfiguration_initialAudioGain = (GlobalConfiguration -> Maybe Int)
-> (GlobalConfiguration -> Maybe Int -> GlobalConfiguration)
-> Lens
     GlobalConfiguration GlobalConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalConfiguration' {Maybe Int
initialAudioGain :: Maybe Int
$sel:initialAudioGain:GlobalConfiguration' :: GlobalConfiguration -> Maybe Int
initialAudioGain} -> Maybe Int
initialAudioGain) (\s :: GlobalConfiguration
s@GlobalConfiguration' {} Maybe Int
a -> GlobalConfiguration
s {$sel:initialAudioGain:GlobalConfiguration' :: Maybe Int
initialAudioGain = Maybe Int
a} :: GlobalConfiguration)

-- | Adjusts video input buffer for streams with very low video framerates.
-- This is commonly set to enabled for music channels with less than one
-- video frame per second.
globalConfiguration_supportLowFramerateInputs :: Lens.Lens' GlobalConfiguration (Prelude.Maybe GlobalConfigurationLowFramerateInputs)
globalConfiguration_supportLowFramerateInputs :: (Maybe GlobalConfigurationLowFramerateInputs
 -> f (Maybe GlobalConfigurationLowFramerateInputs))
-> GlobalConfiguration -> f GlobalConfiguration
globalConfiguration_supportLowFramerateInputs = (GlobalConfiguration
 -> Maybe GlobalConfigurationLowFramerateInputs)
-> (GlobalConfiguration
    -> Maybe GlobalConfigurationLowFramerateInputs
    -> GlobalConfiguration)
-> Lens
     GlobalConfiguration
     GlobalConfiguration
     (Maybe GlobalConfigurationLowFramerateInputs)
     (Maybe GlobalConfigurationLowFramerateInputs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalConfiguration' {Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs :: Maybe GlobalConfigurationLowFramerateInputs
$sel:supportLowFramerateInputs:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs} -> Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs) (\s :: GlobalConfiguration
s@GlobalConfiguration' {} Maybe GlobalConfigurationLowFramerateInputs
a -> GlobalConfiguration
s {$sel:supportLowFramerateInputs:GlobalConfiguration' :: Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs = Maybe GlobalConfigurationLowFramerateInputs
a} :: GlobalConfiguration)

-- | Indicates the action to take when the current input completes (e.g.
-- end-of-file). When switchAndLoopInputs is configured the encoder will
-- restart at the beginning of the first input. When \"none\" is configured
-- the encoder will transcode either black, a solid color, or a user
-- specified slate images per the \"Input Loss Behavior\" configuration
-- until the next input switch occurs (which is controlled through the
-- Channel Schedule API).
globalConfiguration_inputEndAction :: Lens.Lens' GlobalConfiguration (Prelude.Maybe GlobalConfigurationInputEndAction)
globalConfiguration_inputEndAction :: (Maybe GlobalConfigurationInputEndAction
 -> f (Maybe GlobalConfigurationInputEndAction))
-> GlobalConfiguration -> f GlobalConfiguration
globalConfiguration_inputEndAction = (GlobalConfiguration -> Maybe GlobalConfigurationInputEndAction)
-> (GlobalConfiguration
    -> Maybe GlobalConfigurationInputEndAction -> GlobalConfiguration)
-> Lens
     GlobalConfiguration
     GlobalConfiguration
     (Maybe GlobalConfigurationInputEndAction)
     (Maybe GlobalConfigurationInputEndAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalConfiguration' {Maybe GlobalConfigurationInputEndAction
inputEndAction :: Maybe GlobalConfigurationInputEndAction
$sel:inputEndAction:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationInputEndAction
inputEndAction} -> Maybe GlobalConfigurationInputEndAction
inputEndAction) (\s :: GlobalConfiguration
s@GlobalConfiguration' {} Maybe GlobalConfigurationInputEndAction
a -> GlobalConfiguration
s {$sel:inputEndAction:GlobalConfiguration' :: Maybe GlobalConfigurationInputEndAction
inputEndAction = Maybe GlobalConfigurationInputEndAction
a} :: GlobalConfiguration)

-- | Indicates whether the rate of frames emitted by the Live encoder should
-- be paced by its system clock (which optionally may be locked to another
-- source via NTP) or should be locked to the clock of the source that is
-- providing the input stream.
globalConfiguration_outputTimingSource :: Lens.Lens' GlobalConfiguration (Prelude.Maybe GlobalConfigurationOutputTimingSource)
globalConfiguration_outputTimingSource :: (Maybe GlobalConfigurationOutputTimingSource
 -> f (Maybe GlobalConfigurationOutputTimingSource))
-> GlobalConfiguration -> f GlobalConfiguration
globalConfiguration_outputTimingSource = (GlobalConfiguration
 -> Maybe GlobalConfigurationOutputTimingSource)
-> (GlobalConfiguration
    -> Maybe GlobalConfigurationOutputTimingSource
    -> GlobalConfiguration)
-> Lens
     GlobalConfiguration
     GlobalConfiguration
     (Maybe GlobalConfigurationOutputTimingSource)
     (Maybe GlobalConfigurationOutputTimingSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalConfiguration' {Maybe GlobalConfigurationOutputTimingSource
outputTimingSource :: Maybe GlobalConfigurationOutputTimingSource
$sel:outputTimingSource:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationOutputTimingSource
outputTimingSource} -> Maybe GlobalConfigurationOutputTimingSource
outputTimingSource) (\s :: GlobalConfiguration
s@GlobalConfiguration' {} Maybe GlobalConfigurationOutputTimingSource
a -> GlobalConfiguration
s {$sel:outputTimingSource:GlobalConfiguration' :: Maybe GlobalConfigurationOutputTimingSource
outputTimingSource = Maybe GlobalConfigurationOutputTimingSource
a} :: GlobalConfiguration)

instance Core.FromJSON GlobalConfiguration where
  parseJSON :: Value -> Parser GlobalConfiguration
parseJSON =
    String
-> (Object -> Parser GlobalConfiguration)
-> Value
-> Parser GlobalConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GlobalConfiguration"
      ( \Object
x ->
          Maybe GlobalConfigurationOutputLockingMode
-> Maybe InputLossBehavior
-> Maybe Int
-> Maybe GlobalConfigurationLowFramerateInputs
-> Maybe GlobalConfigurationInputEndAction
-> Maybe GlobalConfigurationOutputTimingSource
-> GlobalConfiguration
GlobalConfiguration'
            (Maybe GlobalConfigurationOutputLockingMode
 -> Maybe InputLossBehavior
 -> Maybe Int
 -> Maybe GlobalConfigurationLowFramerateInputs
 -> Maybe GlobalConfigurationInputEndAction
 -> Maybe GlobalConfigurationOutputTimingSource
 -> GlobalConfiguration)
-> Parser (Maybe GlobalConfigurationOutputLockingMode)
-> Parser
     (Maybe InputLossBehavior
      -> Maybe Int
      -> Maybe GlobalConfigurationLowFramerateInputs
      -> Maybe GlobalConfigurationInputEndAction
      -> Maybe GlobalConfigurationOutputTimingSource
      -> GlobalConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe GlobalConfigurationOutputLockingMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputLockingMode")
            Parser
  (Maybe InputLossBehavior
   -> Maybe Int
   -> Maybe GlobalConfigurationLowFramerateInputs
   -> Maybe GlobalConfigurationInputEndAction
   -> Maybe GlobalConfigurationOutputTimingSource
   -> GlobalConfiguration)
-> Parser (Maybe InputLossBehavior)
-> Parser
     (Maybe Int
      -> Maybe GlobalConfigurationLowFramerateInputs
      -> Maybe GlobalConfigurationInputEndAction
      -> Maybe GlobalConfigurationOutputTimingSource
      -> GlobalConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputLossBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputLossBehavior")
            Parser
  (Maybe Int
   -> Maybe GlobalConfigurationLowFramerateInputs
   -> Maybe GlobalConfigurationInputEndAction
   -> Maybe GlobalConfigurationOutputTimingSource
   -> GlobalConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe GlobalConfigurationLowFramerateInputs
      -> Maybe GlobalConfigurationInputEndAction
      -> Maybe GlobalConfigurationOutputTimingSource
      -> GlobalConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"initialAudioGain")
            Parser
  (Maybe GlobalConfigurationLowFramerateInputs
   -> Maybe GlobalConfigurationInputEndAction
   -> Maybe GlobalConfigurationOutputTimingSource
   -> GlobalConfiguration)
-> Parser (Maybe GlobalConfigurationLowFramerateInputs)
-> Parser
     (Maybe GlobalConfigurationInputEndAction
      -> Maybe GlobalConfigurationOutputTimingSource
      -> GlobalConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe GlobalConfigurationLowFramerateInputs)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"supportLowFramerateInputs")
            Parser
  (Maybe GlobalConfigurationInputEndAction
   -> Maybe GlobalConfigurationOutputTimingSource
   -> GlobalConfiguration)
-> Parser (Maybe GlobalConfigurationInputEndAction)
-> Parser
     (Maybe GlobalConfigurationOutputTimingSource
      -> GlobalConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe GlobalConfigurationInputEndAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputEndAction")
            Parser
  (Maybe GlobalConfigurationOutputTimingSource
   -> GlobalConfiguration)
-> Parser (Maybe GlobalConfigurationOutputTimingSource)
-> Parser GlobalConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe GlobalConfigurationOutputTimingSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputTimingSource")
      )

instance Prelude.Hashable GlobalConfiguration

instance Prelude.NFData GlobalConfiguration

instance Core.ToJSON GlobalConfiguration where
  toJSON :: GlobalConfiguration -> Value
toJSON GlobalConfiguration' {Maybe Int
Maybe GlobalConfigurationInputEndAction
Maybe GlobalConfigurationLowFramerateInputs
Maybe GlobalConfigurationOutputLockingMode
Maybe GlobalConfigurationOutputTimingSource
Maybe InputLossBehavior
outputTimingSource :: Maybe GlobalConfigurationOutputTimingSource
inputEndAction :: Maybe GlobalConfigurationInputEndAction
supportLowFramerateInputs :: Maybe GlobalConfigurationLowFramerateInputs
initialAudioGain :: Maybe Int
inputLossBehavior :: Maybe InputLossBehavior
outputLockingMode :: Maybe GlobalConfigurationOutputLockingMode
$sel:outputTimingSource:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationOutputTimingSource
$sel:inputEndAction:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationInputEndAction
$sel:supportLowFramerateInputs:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationLowFramerateInputs
$sel:initialAudioGain:GlobalConfiguration' :: GlobalConfiguration -> Maybe Int
$sel:inputLossBehavior:GlobalConfiguration' :: GlobalConfiguration -> Maybe InputLossBehavior
$sel:outputLockingMode:GlobalConfiguration' :: GlobalConfiguration -> Maybe GlobalConfigurationOutputLockingMode
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"outputLockingMode" Text -> GlobalConfigurationOutputLockingMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (GlobalConfigurationOutputLockingMode -> Pair)
-> Maybe GlobalConfigurationOutputLockingMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GlobalConfigurationOutputLockingMode
outputLockingMode,
            (Text
"inputLossBehavior" Text -> InputLossBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputLossBehavior -> Pair)
-> Maybe InputLossBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputLossBehavior
inputLossBehavior,
            (Text
"initialAudioGain" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
initialAudioGain,
            (Text
"supportLowFramerateInputs" Text -> GlobalConfigurationLowFramerateInputs -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (GlobalConfigurationLowFramerateInputs -> Pair)
-> Maybe GlobalConfigurationLowFramerateInputs -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GlobalConfigurationLowFramerateInputs
supportLowFramerateInputs,
            (Text
"inputEndAction" Text -> GlobalConfigurationInputEndAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (GlobalConfigurationInputEndAction -> Pair)
-> Maybe GlobalConfigurationInputEndAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GlobalConfigurationInputEndAction
inputEndAction,
            (Text
"outputTimingSource" Text -> GlobalConfigurationOutputTimingSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (GlobalConfigurationOutputTimingSource -> Pair)
-> Maybe GlobalConfigurationOutputTimingSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GlobalConfigurationOutputTimingSource
outputTimingSource
          ]
      )