{-# 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.MultiplexProgram
-- 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.MultiplexProgram 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.MultiplexProgramPacketIdentifiersMap
import Amazonka.MediaLive.Types.MultiplexProgramPipelineDetail
import Amazonka.MediaLive.Types.MultiplexProgramSettings
import qualified Amazonka.Prelude as Prelude

-- | The multiplex program object.
--
-- /See:/ 'newMultiplexProgram' smart constructor.
data MultiplexProgram = MultiplexProgram'
  { -- | The MediaLive channel associated with the program.
    MultiplexProgram -> Maybe Text
channelId :: Prelude.Maybe Prelude.Text,
    -- | The settings for this multiplex program.
    MultiplexProgram -> Maybe MultiplexProgramSettings
multiplexProgramSettings :: Prelude.Maybe MultiplexProgramSettings,
    -- | The packet identifier map for this multiplex program.
    MultiplexProgram -> Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap :: Prelude.Maybe MultiplexProgramPacketIdentifiersMap,
    -- | Contains information about the current sources for the specified program
    -- in the specified multiplex. Keep in mind that each multiplex pipeline
    -- connects to both pipelines in a given source channel (the channel
    -- identified by the program). But only one of those channel pipelines is
    -- ever active at one time.
    MultiplexProgram -> Maybe [MultiplexProgramPipelineDetail]
pipelineDetails :: Prelude.Maybe [MultiplexProgramPipelineDetail],
    -- | The name of the multiplex program.
    MultiplexProgram -> Maybe Text
programName :: Prelude.Maybe Prelude.Text
  }
  deriving (MultiplexProgram -> MultiplexProgram -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexProgram -> MultiplexProgram -> Bool
$c/= :: MultiplexProgram -> MultiplexProgram -> Bool
== :: MultiplexProgram -> MultiplexProgram -> Bool
$c== :: MultiplexProgram -> MultiplexProgram -> Bool
Prelude.Eq, ReadPrec [MultiplexProgram]
ReadPrec MultiplexProgram
Int -> ReadS MultiplexProgram
ReadS [MultiplexProgram]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexProgram]
$creadListPrec :: ReadPrec [MultiplexProgram]
readPrec :: ReadPrec MultiplexProgram
$creadPrec :: ReadPrec MultiplexProgram
readList :: ReadS [MultiplexProgram]
$creadList :: ReadS [MultiplexProgram]
readsPrec :: Int -> ReadS MultiplexProgram
$creadsPrec :: Int -> ReadS MultiplexProgram
Prelude.Read, Int -> MultiplexProgram -> ShowS
[MultiplexProgram] -> ShowS
MultiplexProgram -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexProgram] -> ShowS
$cshowList :: [MultiplexProgram] -> ShowS
show :: MultiplexProgram -> String
$cshow :: MultiplexProgram -> String
showsPrec :: Int -> MultiplexProgram -> ShowS
$cshowsPrec :: Int -> MultiplexProgram -> ShowS
Prelude.Show, forall x. Rep MultiplexProgram x -> MultiplexProgram
forall x. MultiplexProgram -> Rep MultiplexProgram x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MultiplexProgram x -> MultiplexProgram
$cfrom :: forall x. MultiplexProgram -> Rep MultiplexProgram x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexProgram' 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:
--
-- 'channelId', 'multiplexProgram_channelId' - The MediaLive channel associated with the program.
--
-- 'multiplexProgramSettings', 'multiplexProgram_multiplexProgramSettings' - The settings for this multiplex program.
--
-- 'packetIdentifiersMap', 'multiplexProgram_packetIdentifiersMap' - The packet identifier map for this multiplex program.
--
-- 'pipelineDetails', 'multiplexProgram_pipelineDetails' - Contains information about the current sources for the specified program
-- in the specified multiplex. Keep in mind that each multiplex pipeline
-- connects to both pipelines in a given source channel (the channel
-- identified by the program). But only one of those channel pipelines is
-- ever active at one time.
--
-- 'programName', 'multiplexProgram_programName' - The name of the multiplex program.
newMultiplexProgram ::
  MultiplexProgram
newMultiplexProgram :: MultiplexProgram
newMultiplexProgram =
  MultiplexProgram'
    { $sel:channelId:MultiplexProgram' :: Maybe Text
channelId = forall a. Maybe a
Prelude.Nothing,
      $sel:multiplexProgramSettings:MultiplexProgram' :: Maybe MultiplexProgramSettings
multiplexProgramSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:packetIdentifiersMap:MultiplexProgram' :: Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap = forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineDetails:MultiplexProgram' :: Maybe [MultiplexProgramPipelineDetail]
pipelineDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:programName:MultiplexProgram' :: Maybe Text
programName = forall a. Maybe a
Prelude.Nothing
    }

-- | The MediaLive channel associated with the program.
multiplexProgram_channelId :: Lens.Lens' MultiplexProgram (Prelude.Maybe Prelude.Text)
multiplexProgram_channelId :: Lens' MultiplexProgram (Maybe Text)
multiplexProgram_channelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgram' {Maybe Text
channelId :: Maybe Text
$sel:channelId:MultiplexProgram' :: MultiplexProgram -> Maybe Text
channelId} -> Maybe Text
channelId) (\s :: MultiplexProgram
s@MultiplexProgram' {} Maybe Text
a -> MultiplexProgram
s {$sel:channelId:MultiplexProgram' :: Maybe Text
channelId = Maybe Text
a} :: MultiplexProgram)

-- | The settings for this multiplex program.
multiplexProgram_multiplexProgramSettings :: Lens.Lens' MultiplexProgram (Prelude.Maybe MultiplexProgramSettings)
multiplexProgram_multiplexProgramSettings :: Lens' MultiplexProgram (Maybe MultiplexProgramSettings)
multiplexProgram_multiplexProgramSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgram' {Maybe MultiplexProgramSettings
multiplexProgramSettings :: Maybe MultiplexProgramSettings
$sel:multiplexProgramSettings:MultiplexProgram' :: MultiplexProgram -> Maybe MultiplexProgramSettings
multiplexProgramSettings} -> Maybe MultiplexProgramSettings
multiplexProgramSettings) (\s :: MultiplexProgram
s@MultiplexProgram' {} Maybe MultiplexProgramSettings
a -> MultiplexProgram
s {$sel:multiplexProgramSettings:MultiplexProgram' :: Maybe MultiplexProgramSettings
multiplexProgramSettings = Maybe MultiplexProgramSettings
a} :: MultiplexProgram)

-- | The packet identifier map for this multiplex program.
multiplexProgram_packetIdentifiersMap :: Lens.Lens' MultiplexProgram (Prelude.Maybe MultiplexProgramPacketIdentifiersMap)
multiplexProgram_packetIdentifiersMap :: Lens' MultiplexProgram (Maybe MultiplexProgramPacketIdentifiersMap)
multiplexProgram_packetIdentifiersMap = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgram' {Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap :: Maybe MultiplexProgramPacketIdentifiersMap
$sel:packetIdentifiersMap:MultiplexProgram' :: MultiplexProgram -> Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap} -> Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap) (\s :: MultiplexProgram
s@MultiplexProgram' {} Maybe MultiplexProgramPacketIdentifiersMap
a -> MultiplexProgram
s {$sel:packetIdentifiersMap:MultiplexProgram' :: Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap = Maybe MultiplexProgramPacketIdentifiersMap
a} :: MultiplexProgram)

-- | Contains information about the current sources for the specified program
-- in the specified multiplex. Keep in mind that each multiplex pipeline
-- connects to both pipelines in a given source channel (the channel
-- identified by the program). But only one of those channel pipelines is
-- ever active at one time.
multiplexProgram_pipelineDetails :: Lens.Lens' MultiplexProgram (Prelude.Maybe [MultiplexProgramPipelineDetail])
multiplexProgram_pipelineDetails :: Lens' MultiplexProgram (Maybe [MultiplexProgramPipelineDetail])
multiplexProgram_pipelineDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgram' {Maybe [MultiplexProgramPipelineDetail]
pipelineDetails :: Maybe [MultiplexProgramPipelineDetail]
$sel:pipelineDetails:MultiplexProgram' :: MultiplexProgram -> Maybe [MultiplexProgramPipelineDetail]
pipelineDetails} -> Maybe [MultiplexProgramPipelineDetail]
pipelineDetails) (\s :: MultiplexProgram
s@MultiplexProgram' {} Maybe [MultiplexProgramPipelineDetail]
a -> MultiplexProgram
s {$sel:pipelineDetails:MultiplexProgram' :: Maybe [MultiplexProgramPipelineDetail]
pipelineDetails = Maybe [MultiplexProgramPipelineDetail]
a} :: MultiplexProgram) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the multiplex program.
multiplexProgram_programName :: Lens.Lens' MultiplexProgram (Prelude.Maybe Prelude.Text)
multiplexProgram_programName :: Lens' MultiplexProgram (Maybe Text)
multiplexProgram_programName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgram' {Maybe Text
programName :: Maybe Text
$sel:programName:MultiplexProgram' :: MultiplexProgram -> Maybe Text
programName} -> Maybe Text
programName) (\s :: MultiplexProgram
s@MultiplexProgram' {} Maybe Text
a -> MultiplexProgram
s {$sel:programName:MultiplexProgram' :: Maybe Text
programName = Maybe Text
a} :: MultiplexProgram)

instance Data.FromJSON MultiplexProgram where
  parseJSON :: Value -> Parser MultiplexProgram
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MultiplexProgram"
      ( \Object
x ->
          Maybe Text
-> Maybe MultiplexProgramSettings
-> Maybe MultiplexProgramPacketIdentifiersMap
-> Maybe [MultiplexProgramPipelineDetail]
-> Maybe Text
-> MultiplexProgram
MultiplexProgram'
            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
"channelId")
            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
"multiplexProgramSettings")
            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
"packetIdentifiersMap")
            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
"pipelineDetails"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"programName")
      )

instance Prelude.Hashable MultiplexProgram where
  hashWithSalt :: Int -> MultiplexProgram -> Int
hashWithSalt Int
_salt MultiplexProgram' {Maybe [MultiplexProgramPipelineDetail]
Maybe Text
Maybe MultiplexProgramPacketIdentifiersMap
Maybe MultiplexProgramSettings
programName :: Maybe Text
pipelineDetails :: Maybe [MultiplexProgramPipelineDetail]
packetIdentifiersMap :: Maybe MultiplexProgramPacketIdentifiersMap
multiplexProgramSettings :: Maybe MultiplexProgramSettings
channelId :: Maybe Text
$sel:programName:MultiplexProgram' :: MultiplexProgram -> Maybe Text
$sel:pipelineDetails:MultiplexProgram' :: MultiplexProgram -> Maybe [MultiplexProgramPipelineDetail]
$sel:packetIdentifiersMap:MultiplexProgram' :: MultiplexProgram -> Maybe MultiplexProgramPacketIdentifiersMap
$sel:multiplexProgramSettings:MultiplexProgram' :: MultiplexProgram -> Maybe MultiplexProgramSettings
$sel:channelId:MultiplexProgram' :: MultiplexProgram -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiplexProgramSettings
multiplexProgramSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MultiplexProgramPipelineDetail]
pipelineDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
programName

instance Prelude.NFData MultiplexProgram where
  rnf :: MultiplexProgram -> ()
rnf MultiplexProgram' {Maybe [MultiplexProgramPipelineDetail]
Maybe Text
Maybe MultiplexProgramPacketIdentifiersMap
Maybe MultiplexProgramSettings
programName :: Maybe Text
pipelineDetails :: Maybe [MultiplexProgramPipelineDetail]
packetIdentifiersMap :: Maybe MultiplexProgramPacketIdentifiersMap
multiplexProgramSettings :: Maybe MultiplexProgramSettings
channelId :: Maybe Text
$sel:programName:MultiplexProgram' :: MultiplexProgram -> Maybe Text
$sel:pipelineDetails:MultiplexProgram' :: MultiplexProgram -> Maybe [MultiplexProgramPipelineDetail]
$sel:packetIdentifiersMap:MultiplexProgram' :: MultiplexProgram -> Maybe MultiplexProgramPacketIdentifiersMap
$sel:multiplexProgramSettings:MultiplexProgram' :: MultiplexProgram -> Maybe MultiplexProgramSettings
$sel:channelId:MultiplexProgram' :: MultiplexProgram -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiplexProgramSettings
multiplexProgramSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MultiplexProgramPipelineDetail]
pipelineDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
programName