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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (MultiplexProgram -> MultiplexProgram -> Bool
(MultiplexProgram -> MultiplexProgram -> Bool)
-> (MultiplexProgram -> MultiplexProgram -> Bool)
-> Eq MultiplexProgram
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]
(Int -> ReadS MultiplexProgram)
-> ReadS [MultiplexProgram]
-> ReadPrec MultiplexProgram
-> ReadPrec [MultiplexProgram]
-> Read 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
(Int -> MultiplexProgram -> ShowS)
-> (MultiplexProgram -> String)
-> ([MultiplexProgram] -> ShowS)
-> Show MultiplexProgram
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. MultiplexProgram -> Rep MultiplexProgram x)
-> (forall x. Rep MultiplexProgram x -> MultiplexProgram)
-> Generic MultiplexProgram
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:
--
-- '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.
--
-- 'channelId', 'multiplexProgram_channelId' - The MediaLive channel associated with the program.
--
-- 'multiplexProgramSettings', 'multiplexProgram_multiplexProgramSettings' - The settings for this multiplex program.
newMultiplexProgram ::
  MultiplexProgram
newMultiplexProgram :: MultiplexProgram
newMultiplexProgram =
  MultiplexProgram' :: Maybe MultiplexProgramPacketIdentifiersMap
-> Maybe [MultiplexProgramPipelineDetail]
-> Maybe Text
-> Maybe Text
-> Maybe MultiplexProgramSettings
-> MultiplexProgram
MultiplexProgram'
    { $sel:packetIdentifiersMap:MultiplexProgram' :: Maybe MultiplexProgramPacketIdentifiersMap
packetIdentifiersMap =
        Maybe MultiplexProgramPacketIdentifiersMap
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineDetails:MultiplexProgram' :: Maybe [MultiplexProgramPipelineDetail]
pipelineDetails = Maybe [MultiplexProgramPipelineDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:programName:MultiplexProgram' :: Maybe Text
programName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelId:MultiplexProgram' :: Maybe Text
channelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:multiplexProgramSettings:MultiplexProgram' :: Maybe MultiplexProgramSettings
multiplexProgramSettings = Maybe MultiplexProgramSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | The packet identifier map for this multiplex program.
multiplexProgram_packetIdentifiersMap :: Lens.Lens' MultiplexProgram (Prelude.Maybe MultiplexProgramPacketIdentifiersMap)
multiplexProgram_packetIdentifiersMap :: (Maybe MultiplexProgramPacketIdentifiersMap
 -> f (Maybe MultiplexProgramPacketIdentifiersMap))
-> MultiplexProgram -> f MultiplexProgram
multiplexProgram_packetIdentifiersMap = (MultiplexProgram -> Maybe MultiplexProgramPacketIdentifiersMap)
-> (MultiplexProgram
    -> Maybe MultiplexProgramPacketIdentifiersMap -> MultiplexProgram)
-> Lens
     MultiplexProgram
     MultiplexProgram
     (Maybe MultiplexProgramPacketIdentifiersMap)
     (Maybe MultiplexProgramPacketIdentifiersMap)
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 :: (Maybe [MultiplexProgramPipelineDetail]
 -> f (Maybe [MultiplexProgramPipelineDetail]))
-> MultiplexProgram -> f MultiplexProgram
multiplexProgram_pipelineDetails = (MultiplexProgram -> Maybe [MultiplexProgramPipelineDetail])
-> (MultiplexProgram
    -> Maybe [MultiplexProgramPipelineDetail] -> MultiplexProgram)
-> Lens
     MultiplexProgram
     MultiplexProgram
     (Maybe [MultiplexProgramPipelineDetail])
     (Maybe [MultiplexProgramPipelineDetail])
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) ((Maybe [MultiplexProgramPipelineDetail]
  -> f (Maybe [MultiplexProgramPipelineDetail]))
 -> MultiplexProgram -> f MultiplexProgram)
-> ((Maybe [MultiplexProgramPipelineDetail]
     -> f (Maybe [MultiplexProgramPipelineDetail]))
    -> Maybe [MultiplexProgramPipelineDetail]
    -> f (Maybe [MultiplexProgramPipelineDetail]))
-> (Maybe [MultiplexProgramPipelineDetail]
    -> f (Maybe [MultiplexProgramPipelineDetail]))
-> MultiplexProgram
-> f MultiplexProgram
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MultiplexProgramPipelineDetail]
  [MultiplexProgramPipelineDetail]
  [MultiplexProgramPipelineDetail]
  [MultiplexProgramPipelineDetail]
-> Iso
     (Maybe [MultiplexProgramPipelineDetail])
     (Maybe [MultiplexProgramPipelineDetail])
     (Maybe [MultiplexProgramPipelineDetail])
     (Maybe [MultiplexProgramPipelineDetail])
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 AnIso
  [MultiplexProgramPipelineDetail]
  [MultiplexProgramPipelineDetail]
  [MultiplexProgramPipelineDetail]
  [MultiplexProgramPipelineDetail]
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 :: (Maybe Text -> f (Maybe Text))
-> MultiplexProgram -> f MultiplexProgram
multiplexProgram_programName = (MultiplexProgram -> Maybe Text)
-> (MultiplexProgram -> Maybe Text -> MultiplexProgram)
-> Lens MultiplexProgram MultiplexProgram (Maybe Text) (Maybe Text)
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)

-- | The MediaLive channel associated with the program.
multiplexProgram_channelId :: Lens.Lens' MultiplexProgram (Prelude.Maybe Prelude.Text)
multiplexProgram_channelId :: (Maybe Text -> f (Maybe Text))
-> MultiplexProgram -> f MultiplexProgram
multiplexProgram_channelId = (MultiplexProgram -> Maybe Text)
-> (MultiplexProgram -> Maybe Text -> MultiplexProgram)
-> Lens MultiplexProgram MultiplexProgram (Maybe Text) (Maybe Text)
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 :: (Maybe MultiplexProgramSettings
 -> f (Maybe MultiplexProgramSettings))
-> MultiplexProgram -> f MultiplexProgram
multiplexProgram_multiplexProgramSettings = (MultiplexProgram -> Maybe MultiplexProgramSettings)
-> (MultiplexProgram
    -> Maybe MultiplexProgramSettings -> MultiplexProgram)
-> Lens
     MultiplexProgram
     MultiplexProgram
     (Maybe MultiplexProgramSettings)
     (Maybe 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)

instance Core.FromJSON MultiplexProgram where
  parseJSON :: Value -> Parser MultiplexProgram
parseJSON =
    String
-> (Object -> Parser MultiplexProgram)
-> Value
-> Parser MultiplexProgram
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MultiplexProgram"
      ( \Object
x ->
          Maybe MultiplexProgramPacketIdentifiersMap
-> Maybe [MultiplexProgramPipelineDetail]
-> Maybe Text
-> Maybe Text
-> Maybe MultiplexProgramSettings
-> MultiplexProgram
MultiplexProgram'
            (Maybe MultiplexProgramPacketIdentifiersMap
 -> Maybe [MultiplexProgramPipelineDetail]
 -> Maybe Text
 -> Maybe Text
 -> Maybe MultiplexProgramSettings
 -> MultiplexProgram)
-> Parser (Maybe MultiplexProgramPacketIdentifiersMap)
-> Parser
     (Maybe [MultiplexProgramPipelineDetail]
      -> Maybe Text
      -> Maybe Text
      -> Maybe MultiplexProgramSettings
      -> MultiplexProgram)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe MultiplexProgramPacketIdentifiersMap)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"packetIdentifiersMap")
            Parser
  (Maybe [MultiplexProgramPipelineDetail]
   -> Maybe Text
   -> Maybe Text
   -> Maybe MultiplexProgramSettings
   -> MultiplexProgram)
-> Parser (Maybe [MultiplexProgramPipelineDetail])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe MultiplexProgramSettings
      -> MultiplexProgram)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [MultiplexProgramPipelineDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pipelineDetails"
                            Parser (Maybe (Maybe [MultiplexProgramPipelineDetail]))
-> Maybe [MultiplexProgramPipelineDetail]
-> Parser (Maybe [MultiplexProgramPipelineDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MultiplexProgramPipelineDetail]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe MultiplexProgramSettings
   -> MultiplexProgram)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe MultiplexProgramSettings -> MultiplexProgram)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"programName")
            Parser
  (Maybe Text -> Maybe MultiplexProgramSettings -> MultiplexProgram)
-> Parser (Maybe Text)
-> Parser (Maybe MultiplexProgramSettings -> MultiplexProgram)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"channelId")
            Parser (Maybe MultiplexProgramSettings -> MultiplexProgram)
-> Parser (Maybe MultiplexProgramSettings)
-> Parser MultiplexProgram
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MultiplexProgramSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"multiplexProgramSettings")
      )

instance Prelude.Hashable MultiplexProgram

instance Prelude.NFData MultiplexProgram