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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.MultiplexProgramServiceDescriptor
import Amazonka.MediaLive.Types.MultiplexVideoSettings
import Amazonka.MediaLive.Types.PreferredChannelPipeline
import qualified Amazonka.Prelude as Prelude

-- | Multiplex Program settings configuration.
--
-- /See:/ 'newMultiplexProgramSettings' smart constructor.
data MultiplexProgramSettings = MultiplexProgramSettings'
  { -- | Indicates which pipeline is preferred by the multiplex for program
    -- ingest.
    MultiplexProgramSettings -> Maybe PreferredChannelPipeline
preferredChannelPipeline :: Prelude.Maybe PreferredChannelPipeline,
    -- | Transport stream service descriptor configuration for the Multiplex
    -- program.
    MultiplexProgramSettings -> Maybe MultiplexProgramServiceDescriptor
serviceDescriptor :: Prelude.Maybe MultiplexProgramServiceDescriptor,
    -- | Program video settings configuration.
    MultiplexProgramSettings -> Maybe MultiplexVideoSettings
videoSettings :: Prelude.Maybe MultiplexVideoSettings,
    -- | Unique program number.
    MultiplexProgramSettings -> Natural
programNumber :: Prelude.Natural
  }
  deriving (MultiplexProgramSettings -> MultiplexProgramSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexProgramSettings -> MultiplexProgramSettings -> Bool
$c/= :: MultiplexProgramSettings -> MultiplexProgramSettings -> Bool
== :: MultiplexProgramSettings -> MultiplexProgramSettings -> Bool
$c== :: MultiplexProgramSettings -> MultiplexProgramSettings -> Bool
Prelude.Eq, ReadPrec [MultiplexProgramSettings]
ReadPrec MultiplexProgramSettings
Int -> ReadS MultiplexProgramSettings
ReadS [MultiplexProgramSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexProgramSettings]
$creadListPrec :: ReadPrec [MultiplexProgramSettings]
readPrec :: ReadPrec MultiplexProgramSettings
$creadPrec :: ReadPrec MultiplexProgramSettings
readList :: ReadS [MultiplexProgramSettings]
$creadList :: ReadS [MultiplexProgramSettings]
readsPrec :: Int -> ReadS MultiplexProgramSettings
$creadsPrec :: Int -> ReadS MultiplexProgramSettings
Prelude.Read, Int -> MultiplexProgramSettings -> ShowS
[MultiplexProgramSettings] -> ShowS
MultiplexProgramSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexProgramSettings] -> ShowS
$cshowList :: [MultiplexProgramSettings] -> ShowS
show :: MultiplexProgramSettings -> String
$cshow :: MultiplexProgramSettings -> String
showsPrec :: Int -> MultiplexProgramSettings -> ShowS
$cshowsPrec :: Int -> MultiplexProgramSettings -> ShowS
Prelude.Show, forall x.
Rep MultiplexProgramSettings x -> MultiplexProgramSettings
forall x.
MultiplexProgramSettings -> Rep MultiplexProgramSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MultiplexProgramSettings x -> MultiplexProgramSettings
$cfrom :: forall x.
MultiplexProgramSettings -> Rep MultiplexProgramSettings x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexProgramSettings' 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:
--
-- 'preferredChannelPipeline', 'multiplexProgramSettings_preferredChannelPipeline' - Indicates which pipeline is preferred by the multiplex for program
-- ingest.
--
-- 'serviceDescriptor', 'multiplexProgramSettings_serviceDescriptor' - Transport stream service descriptor configuration for the Multiplex
-- program.
--
-- 'videoSettings', 'multiplexProgramSettings_videoSettings' - Program video settings configuration.
--
-- 'programNumber', 'multiplexProgramSettings_programNumber' - Unique program number.
newMultiplexProgramSettings ::
  -- | 'programNumber'
  Prelude.Natural ->
  MultiplexProgramSettings
newMultiplexProgramSettings :: Natural -> MultiplexProgramSettings
newMultiplexProgramSettings Natural
pProgramNumber_ =
  MultiplexProgramSettings'
    { $sel:preferredChannelPipeline:MultiplexProgramSettings' :: Maybe PreferredChannelPipeline
preferredChannelPipeline =
        forall a. Maybe a
Prelude.Nothing,
      $sel:serviceDescriptor:MultiplexProgramSettings' :: Maybe MultiplexProgramServiceDescriptor
serviceDescriptor = forall a. Maybe a
Prelude.Nothing,
      $sel:videoSettings:MultiplexProgramSettings' :: Maybe MultiplexVideoSettings
videoSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:programNumber:MultiplexProgramSettings' :: Natural
programNumber = Natural
pProgramNumber_
    }

-- | Indicates which pipeline is preferred by the multiplex for program
-- ingest.
multiplexProgramSettings_preferredChannelPipeline :: Lens.Lens' MultiplexProgramSettings (Prelude.Maybe PreferredChannelPipeline)
multiplexProgramSettings_preferredChannelPipeline :: Lens' MultiplexProgramSettings (Maybe PreferredChannelPipeline)
multiplexProgramSettings_preferredChannelPipeline = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgramSettings' {Maybe PreferredChannelPipeline
preferredChannelPipeline :: Maybe PreferredChannelPipeline
$sel:preferredChannelPipeline:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe PreferredChannelPipeline
preferredChannelPipeline} -> Maybe PreferredChannelPipeline
preferredChannelPipeline) (\s :: MultiplexProgramSettings
s@MultiplexProgramSettings' {} Maybe PreferredChannelPipeline
a -> MultiplexProgramSettings
s {$sel:preferredChannelPipeline:MultiplexProgramSettings' :: Maybe PreferredChannelPipeline
preferredChannelPipeline = Maybe PreferredChannelPipeline
a} :: MultiplexProgramSettings)

-- | Transport stream service descriptor configuration for the Multiplex
-- program.
multiplexProgramSettings_serviceDescriptor :: Lens.Lens' MultiplexProgramSettings (Prelude.Maybe MultiplexProgramServiceDescriptor)
multiplexProgramSettings_serviceDescriptor :: Lens'
  MultiplexProgramSettings (Maybe MultiplexProgramServiceDescriptor)
multiplexProgramSettings_serviceDescriptor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgramSettings' {Maybe MultiplexProgramServiceDescriptor
serviceDescriptor :: Maybe MultiplexProgramServiceDescriptor
$sel:serviceDescriptor:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexProgramServiceDescriptor
serviceDescriptor} -> Maybe MultiplexProgramServiceDescriptor
serviceDescriptor) (\s :: MultiplexProgramSettings
s@MultiplexProgramSettings' {} Maybe MultiplexProgramServiceDescriptor
a -> MultiplexProgramSettings
s {$sel:serviceDescriptor:MultiplexProgramSettings' :: Maybe MultiplexProgramServiceDescriptor
serviceDescriptor = Maybe MultiplexProgramServiceDescriptor
a} :: MultiplexProgramSettings)

-- | Program video settings configuration.
multiplexProgramSettings_videoSettings :: Lens.Lens' MultiplexProgramSettings (Prelude.Maybe MultiplexVideoSettings)
multiplexProgramSettings_videoSettings :: Lens' MultiplexProgramSettings (Maybe MultiplexVideoSettings)
multiplexProgramSettings_videoSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgramSettings' {Maybe MultiplexVideoSettings
videoSettings :: Maybe MultiplexVideoSettings
$sel:videoSettings:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexVideoSettings
videoSettings} -> Maybe MultiplexVideoSettings
videoSettings) (\s :: MultiplexProgramSettings
s@MultiplexProgramSettings' {} Maybe MultiplexVideoSettings
a -> MultiplexProgramSettings
s {$sel:videoSettings:MultiplexProgramSettings' :: Maybe MultiplexVideoSettings
videoSettings = Maybe MultiplexVideoSettings
a} :: MultiplexProgramSettings)

-- | Unique program number.
multiplexProgramSettings_programNumber :: Lens.Lens' MultiplexProgramSettings Prelude.Natural
multiplexProgramSettings_programNumber :: Lens' MultiplexProgramSettings Natural
multiplexProgramSettings_programNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgramSettings' {Natural
programNumber :: Natural
$sel:programNumber:MultiplexProgramSettings' :: MultiplexProgramSettings -> Natural
programNumber} -> Natural
programNumber) (\s :: MultiplexProgramSettings
s@MultiplexProgramSettings' {} Natural
a -> MultiplexProgramSettings
s {$sel:programNumber:MultiplexProgramSettings' :: Natural
programNumber = Natural
a} :: MultiplexProgramSettings)

instance Data.FromJSON MultiplexProgramSettings where
  parseJSON :: Value -> Parser MultiplexProgramSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MultiplexProgramSettings"
      ( \Object
x ->
          Maybe PreferredChannelPipeline
-> Maybe MultiplexProgramServiceDescriptor
-> Maybe MultiplexVideoSettings
-> Natural
-> MultiplexProgramSettings
MultiplexProgramSettings'
            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
"preferredChannelPipeline")
            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
"serviceDescriptor")
            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
"videoSettings")
            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
"programNumber")
      )

instance Prelude.Hashable MultiplexProgramSettings where
  hashWithSalt :: Int -> MultiplexProgramSettings -> Int
hashWithSalt Int
_salt MultiplexProgramSettings' {Natural
Maybe MultiplexProgramServiceDescriptor
Maybe MultiplexVideoSettings
Maybe PreferredChannelPipeline
programNumber :: Natural
videoSettings :: Maybe MultiplexVideoSettings
serviceDescriptor :: Maybe MultiplexProgramServiceDescriptor
preferredChannelPipeline :: Maybe PreferredChannelPipeline
$sel:programNumber:MultiplexProgramSettings' :: MultiplexProgramSettings -> Natural
$sel:videoSettings:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexVideoSettings
$sel:serviceDescriptor:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexProgramServiceDescriptor
$sel:preferredChannelPipeline:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe PreferredChannelPipeline
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PreferredChannelPipeline
preferredChannelPipeline
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiplexProgramServiceDescriptor
serviceDescriptor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiplexVideoSettings
videoSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
programNumber

instance Prelude.NFData MultiplexProgramSettings where
  rnf :: MultiplexProgramSettings -> ()
rnf MultiplexProgramSettings' {Natural
Maybe MultiplexProgramServiceDescriptor
Maybe MultiplexVideoSettings
Maybe PreferredChannelPipeline
programNumber :: Natural
videoSettings :: Maybe MultiplexVideoSettings
serviceDescriptor :: Maybe MultiplexProgramServiceDescriptor
preferredChannelPipeline :: Maybe PreferredChannelPipeline
$sel:programNumber:MultiplexProgramSettings' :: MultiplexProgramSettings -> Natural
$sel:videoSettings:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexVideoSettings
$sel:serviceDescriptor:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexProgramServiceDescriptor
$sel:preferredChannelPipeline:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe PreferredChannelPipeline
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PreferredChannelPipeline
preferredChannelPipeline
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiplexProgramServiceDescriptor
serviceDescriptor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiplexVideoSettings
videoSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
programNumber

instance Data.ToJSON MultiplexProgramSettings where
  toJSON :: MultiplexProgramSettings -> Value
toJSON MultiplexProgramSettings' {Natural
Maybe MultiplexProgramServiceDescriptor
Maybe MultiplexVideoSettings
Maybe PreferredChannelPipeline
programNumber :: Natural
videoSettings :: Maybe MultiplexVideoSettings
serviceDescriptor :: Maybe MultiplexProgramServiceDescriptor
preferredChannelPipeline :: Maybe PreferredChannelPipeline
$sel:programNumber:MultiplexProgramSettings' :: MultiplexProgramSettings -> Natural
$sel:videoSettings:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexVideoSettings
$sel:serviceDescriptor:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe MultiplexProgramServiceDescriptor
$sel:preferredChannelPipeline:MultiplexProgramSettings' :: MultiplexProgramSettings -> Maybe PreferredChannelPipeline
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"preferredChannelPipeline" 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 PreferredChannelPipeline
preferredChannelPipeline,
            (Key
"serviceDescriptor" 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 MultiplexProgramServiceDescriptor
serviceDescriptor,
            (Key
"videoSettings" 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 MultiplexVideoSettings
videoSettings,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"programNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
programNumber)
          ]
      )