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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
      { $sel:maximumVideoBufferDelayMilliseconds:MultiplexSettings' :: Maybe Natural
maximumVideoBufferDelayMilliseconds =
          forall a. Maybe a
Prelude.Nothing,
        $sel:transportStreamReservedBitrate:MultiplexSettings' :: Maybe Natural
transportStreamReservedBitrate = 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 :: Lens' MultiplexSettings (Maybe Natural)
multiplexSettings_maximumVideoBufferDelayMilliseconds = 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 :: Lens' MultiplexSettings (Maybe Natural)
multiplexSettings_transportStreamReservedBitrate = 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 :: Lens' MultiplexSettings Natural
multiplexSettings_transportStreamBitrate = 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 :: Lens' MultiplexSettings Natural
multiplexSettings_transportStreamId = 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 Data.FromJSON MultiplexSettings where
  parseJSON :: Value -> Parser MultiplexSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MultiplexSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Natural -> Natural -> MultiplexSettings
MultiplexSettings'
            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
"maximumVideoBufferDelayMilliseconds")
            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
"transportStreamReservedBitrate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"transportStreamBitrate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"transportStreamId")
      )

instance Prelude.Hashable MultiplexSettings where
  hashWithSalt :: Int -> MultiplexSettings -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maximumVideoBufferDelayMilliseconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
transportStreamReservedBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
transportStreamBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
transportStreamId

instance Prelude.NFData MultiplexSettings where
  rnf :: MultiplexSettings -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maximumVideoBufferDelayMilliseconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
transportStreamReservedBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
transportStreamBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
transportStreamId

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maximumVideoBufferDelayMilliseconds" 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
maximumVideoBufferDelayMilliseconds,
            (Key
"transportStreamReservedBitrate" 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
transportStreamReservedBitrate,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"transportStreamBitrate"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
transportStreamBitrate
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"transportStreamId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
transportStreamId)
          ]
      )