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

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

-- | Contains configuration for a Multiplex event
--
-- /See:/ 'newMultiplexSettings' smart constructor.
data MultiplexSettings = MultiplexSettings'
  { -- | Maximum video buffer delay in milliseconds.
    MultiplexSettings -> Maybe Natural
maximumVideoBufferDelayMilliseconds :: Prelude.Maybe Prelude.Natural,
    -- | Transport stream reserved bit rate.
    MultiplexSettings -> Maybe Natural
transportStreamReservedBitrate :: Prelude.Maybe Prelude.Natural,
    -- | Transport stream bit rate.
    MultiplexSettings -> Natural
transportStreamBitrate :: Prelude.Natural,
    -- | Transport stream ID.
    MultiplexSettings -> Natural
transportStreamId :: Prelude.Natural
  }
  deriving (MultiplexSettings -> MultiplexSettings -> Bool
(MultiplexSettings -> MultiplexSettings -> Bool)
-> (MultiplexSettings -> MultiplexSettings -> Bool)
-> Eq MultiplexSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexSettings -> MultiplexSettings -> Bool
$c/= :: MultiplexSettings -> MultiplexSettings -> Bool
== :: MultiplexSettings -> MultiplexSettings -> Bool
$c== :: MultiplexSettings -> MultiplexSettings -> Bool
Prelude.Eq, ReadPrec [MultiplexSettings]
ReadPrec MultiplexSettings
Int -> ReadS MultiplexSettings
ReadS [MultiplexSettings]
(Int -> ReadS MultiplexSettings)
-> ReadS [MultiplexSettings]
-> ReadPrec MultiplexSettings
-> ReadPrec [MultiplexSettings]
-> Read MultiplexSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexSettings]
$creadListPrec :: ReadPrec [MultiplexSettings]
readPrec :: ReadPrec MultiplexSettings
$creadPrec :: ReadPrec MultiplexSettings
readList :: ReadS [MultiplexSettings]
$creadList :: ReadS [MultiplexSettings]
readsPrec :: Int -> ReadS MultiplexSettings
$creadsPrec :: Int -> ReadS MultiplexSettings
Prelude.Read, Int -> MultiplexSettings -> ShowS
[MultiplexSettings] -> ShowS
MultiplexSettings -> String
(Int -> MultiplexSettings -> ShowS)
-> (MultiplexSettings -> String)
-> ([MultiplexSettings] -> ShowS)
-> Show MultiplexSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexSettings] -> ShowS
$cshowList :: [MultiplexSettings] -> ShowS
show :: MultiplexSettings -> String
$cshow :: MultiplexSettings -> String
showsPrec :: Int -> MultiplexSettings -> ShowS
$cshowsPrec :: Int -> MultiplexSettings -> ShowS
Prelude.Show, (forall x. MultiplexSettings -> Rep MultiplexSettings x)
-> (forall x. Rep MultiplexSettings x -> MultiplexSettings)
-> Generic MultiplexSettings
forall x. Rep MultiplexSettings x -> MultiplexSettings
forall x. MultiplexSettings -> Rep MultiplexSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MultiplexSettings x -> MultiplexSettings
$cfrom :: forall x. MultiplexSettings -> Rep MultiplexSettings x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexSettings' 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:
--
-- 'maximumVideoBufferDelayMilliseconds', 'multiplexSettings_maximumVideoBufferDelayMilliseconds' - Maximum video buffer delay in milliseconds.
--
-- 'transportStreamReservedBitrate', 'multiplexSettings_transportStreamReservedBitrate' - Transport stream reserved bit rate.
--
-- 'transportStreamBitrate', 'multiplexSettings_transportStreamBitrate' - Transport stream bit rate.
--
-- 'transportStreamId', 'multiplexSettings_transportStreamId' - Transport stream ID.
newMultiplexSettings ::
  -- | 'transportStreamBitrate'
  Prelude.Natural ->
  -- | 'transportStreamId'
  Prelude.Natural ->
  MultiplexSettings
newMultiplexSettings :: Natural -> Natural -> MultiplexSettings
newMultiplexSettings
  Natural
pTransportStreamBitrate_
  Natural
pTransportStreamId_ =
    MultiplexSettings' :: Maybe Natural
-> Maybe Natural -> Natural -> Natural -> MultiplexSettings
MultiplexSettings'
      { $sel:maximumVideoBufferDelayMilliseconds:MultiplexSettings' :: Maybe Natural
maximumVideoBufferDelayMilliseconds =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:transportStreamReservedBitrate:MultiplexSettings' :: Maybe Natural
transportStreamReservedBitrate = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:transportStreamBitrate:MultiplexSettings' :: Natural
transportStreamBitrate = Natural
pTransportStreamBitrate_,
        $sel:transportStreamId:MultiplexSettings' :: Natural
transportStreamId = Natural
pTransportStreamId_
      }

-- | Maximum video buffer delay in milliseconds.
multiplexSettings_maximumVideoBufferDelayMilliseconds :: Lens.Lens' MultiplexSettings (Prelude.Maybe Prelude.Natural)
multiplexSettings_maximumVideoBufferDelayMilliseconds :: (Maybe Natural -> f (Maybe Natural))
-> MultiplexSettings -> f MultiplexSettings
multiplexSettings_maximumVideoBufferDelayMilliseconds = (MultiplexSettings -> Maybe Natural)
-> (MultiplexSettings -> Maybe Natural -> MultiplexSettings)
-> Lens
     MultiplexSettings MultiplexSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexSettings' {Maybe Natural
maximumVideoBufferDelayMilliseconds :: Maybe Natural
$sel:maximumVideoBufferDelayMilliseconds:MultiplexSettings' :: MultiplexSettings -> Maybe Natural
maximumVideoBufferDelayMilliseconds} -> Maybe Natural
maximumVideoBufferDelayMilliseconds) (\s :: MultiplexSettings
s@MultiplexSettings' {} Maybe Natural
a -> MultiplexSettings
s {$sel:maximumVideoBufferDelayMilliseconds:MultiplexSettings' :: Maybe Natural
maximumVideoBufferDelayMilliseconds = Maybe Natural
a} :: MultiplexSettings)

-- | Transport stream reserved bit rate.
multiplexSettings_transportStreamReservedBitrate :: Lens.Lens' MultiplexSettings (Prelude.Maybe Prelude.Natural)
multiplexSettings_transportStreamReservedBitrate :: (Maybe Natural -> f (Maybe Natural))
-> MultiplexSettings -> f MultiplexSettings
multiplexSettings_transportStreamReservedBitrate = (MultiplexSettings -> Maybe Natural)
-> (MultiplexSettings -> Maybe Natural -> MultiplexSettings)
-> Lens
     MultiplexSettings MultiplexSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexSettings' {Maybe Natural
transportStreamReservedBitrate :: Maybe Natural
$sel:transportStreamReservedBitrate:MultiplexSettings' :: MultiplexSettings -> Maybe Natural
transportStreamReservedBitrate} -> Maybe Natural
transportStreamReservedBitrate) (\s :: MultiplexSettings
s@MultiplexSettings' {} Maybe Natural
a -> MultiplexSettings
s {$sel:transportStreamReservedBitrate:MultiplexSettings' :: Maybe Natural
transportStreamReservedBitrate = Maybe Natural
a} :: MultiplexSettings)

-- | Transport stream bit rate.
multiplexSettings_transportStreamBitrate :: Lens.Lens' MultiplexSettings Prelude.Natural
multiplexSettings_transportStreamBitrate :: (Natural -> f Natural) -> MultiplexSettings -> f MultiplexSettings
multiplexSettings_transportStreamBitrate = (MultiplexSettings -> Natural)
-> (MultiplexSettings -> Natural -> MultiplexSettings)
-> Lens MultiplexSettings MultiplexSettings Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexSettings' {Natural
transportStreamBitrate :: Natural
$sel:transportStreamBitrate:MultiplexSettings' :: MultiplexSettings -> Natural
transportStreamBitrate} -> Natural
transportStreamBitrate) (\s :: MultiplexSettings
s@MultiplexSettings' {} Natural
a -> MultiplexSettings
s {$sel:transportStreamBitrate:MultiplexSettings' :: Natural
transportStreamBitrate = Natural
a} :: MultiplexSettings)

-- | Transport stream ID.
multiplexSettings_transportStreamId :: Lens.Lens' MultiplexSettings Prelude.Natural
multiplexSettings_transportStreamId :: (Natural -> f Natural) -> MultiplexSettings -> f MultiplexSettings
multiplexSettings_transportStreamId = (MultiplexSettings -> Natural)
-> (MultiplexSettings -> Natural -> MultiplexSettings)
-> Lens MultiplexSettings MultiplexSettings Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexSettings' {Natural
transportStreamId :: Natural
$sel:transportStreamId:MultiplexSettings' :: MultiplexSettings -> Natural
transportStreamId} -> Natural
transportStreamId) (\s :: MultiplexSettings
s@MultiplexSettings' {} Natural
a -> MultiplexSettings
s {$sel:transportStreamId:MultiplexSettings' :: Natural
transportStreamId = Natural
a} :: MultiplexSettings)

instance Core.FromJSON MultiplexSettings where
  parseJSON :: Value -> Parser MultiplexSettings
parseJSON =
    String
-> (Object -> Parser MultiplexSettings)
-> Value
-> Parser MultiplexSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MultiplexSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Natural -> Natural -> MultiplexSettings
MultiplexSettings'
            (Maybe Natural
 -> Maybe Natural -> Natural -> Natural -> MultiplexSettings)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural -> Natural -> Natural -> MultiplexSettings)
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
"maximumVideoBufferDelayMilliseconds")
            Parser (Maybe Natural -> Natural -> Natural -> MultiplexSettings)
-> Parser (Maybe Natural)
-> Parser (Natural -> Natural -> MultiplexSettings)
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
"transportStreamReservedBitrate")
            Parser (Natural -> Natural -> MultiplexSettings)
-> Parser Natural -> Parser (Natural -> MultiplexSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"transportStreamBitrate")
            Parser (Natural -> MultiplexSettings)
-> Parser Natural -> Parser MultiplexSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"transportStreamId")
      )

instance Prelude.Hashable MultiplexSettings

instance Prelude.NFData MultiplexSettings

instance Core.ToJSON MultiplexSettings where
  toJSON :: MultiplexSettings -> Value
toJSON MultiplexSettings' {Natural
Maybe Natural
transportStreamId :: Natural
transportStreamBitrate :: Natural
transportStreamReservedBitrate :: Maybe Natural
maximumVideoBufferDelayMilliseconds :: Maybe Natural
$sel:transportStreamId:MultiplexSettings' :: MultiplexSettings -> Natural
$sel:transportStreamBitrate:MultiplexSettings' :: MultiplexSettings -> Natural
$sel:transportStreamReservedBitrate:MultiplexSettings' :: MultiplexSettings -> Maybe Natural
$sel:maximumVideoBufferDelayMilliseconds:MultiplexSettings' :: MultiplexSettings -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"maximumVideoBufferDelayMilliseconds" 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
maximumVideoBufferDelayMilliseconds,
            (Text
"transportStreamReservedBitrate" 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
transportStreamReservedBitrate,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"transportStreamBitrate"
                  Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
transportStreamBitrate
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"transportStreamId" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
transportStreamId)
          ]
      )