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

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

-- | Transport stream service descriptor configuration for the Multiplex
-- program.
--
-- /See:/ 'newMultiplexProgramServiceDescriptor' smart constructor.
data MultiplexProgramServiceDescriptor = MultiplexProgramServiceDescriptor'
  { -- | Name of the provider.
    MultiplexProgramServiceDescriptor -> Text
providerName :: Prelude.Text,
    -- | Name of the service.
    MultiplexProgramServiceDescriptor -> Text
serviceName :: Prelude.Text
  }
  deriving (MultiplexProgramServiceDescriptor
-> MultiplexProgramServiceDescriptor -> Bool
(MultiplexProgramServiceDescriptor
 -> MultiplexProgramServiceDescriptor -> Bool)
-> (MultiplexProgramServiceDescriptor
    -> MultiplexProgramServiceDescriptor -> Bool)
-> Eq MultiplexProgramServiceDescriptor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexProgramServiceDescriptor
-> MultiplexProgramServiceDescriptor -> Bool
$c/= :: MultiplexProgramServiceDescriptor
-> MultiplexProgramServiceDescriptor -> Bool
== :: MultiplexProgramServiceDescriptor
-> MultiplexProgramServiceDescriptor -> Bool
$c== :: MultiplexProgramServiceDescriptor
-> MultiplexProgramServiceDescriptor -> Bool
Prelude.Eq, ReadPrec [MultiplexProgramServiceDescriptor]
ReadPrec MultiplexProgramServiceDescriptor
Int -> ReadS MultiplexProgramServiceDescriptor
ReadS [MultiplexProgramServiceDescriptor]
(Int -> ReadS MultiplexProgramServiceDescriptor)
-> ReadS [MultiplexProgramServiceDescriptor]
-> ReadPrec MultiplexProgramServiceDescriptor
-> ReadPrec [MultiplexProgramServiceDescriptor]
-> Read MultiplexProgramServiceDescriptor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexProgramServiceDescriptor]
$creadListPrec :: ReadPrec [MultiplexProgramServiceDescriptor]
readPrec :: ReadPrec MultiplexProgramServiceDescriptor
$creadPrec :: ReadPrec MultiplexProgramServiceDescriptor
readList :: ReadS [MultiplexProgramServiceDescriptor]
$creadList :: ReadS [MultiplexProgramServiceDescriptor]
readsPrec :: Int -> ReadS MultiplexProgramServiceDescriptor
$creadsPrec :: Int -> ReadS MultiplexProgramServiceDescriptor
Prelude.Read, Int -> MultiplexProgramServiceDescriptor -> ShowS
[MultiplexProgramServiceDescriptor] -> ShowS
MultiplexProgramServiceDescriptor -> String
(Int -> MultiplexProgramServiceDescriptor -> ShowS)
-> (MultiplexProgramServiceDescriptor -> String)
-> ([MultiplexProgramServiceDescriptor] -> ShowS)
-> Show MultiplexProgramServiceDescriptor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexProgramServiceDescriptor] -> ShowS
$cshowList :: [MultiplexProgramServiceDescriptor] -> ShowS
show :: MultiplexProgramServiceDescriptor -> String
$cshow :: MultiplexProgramServiceDescriptor -> String
showsPrec :: Int -> MultiplexProgramServiceDescriptor -> ShowS
$cshowsPrec :: Int -> MultiplexProgramServiceDescriptor -> ShowS
Prelude.Show, (forall x.
 MultiplexProgramServiceDescriptor
 -> Rep MultiplexProgramServiceDescriptor x)
-> (forall x.
    Rep MultiplexProgramServiceDescriptor x
    -> MultiplexProgramServiceDescriptor)
-> Generic MultiplexProgramServiceDescriptor
forall x.
Rep MultiplexProgramServiceDescriptor x
-> MultiplexProgramServiceDescriptor
forall x.
MultiplexProgramServiceDescriptor
-> Rep MultiplexProgramServiceDescriptor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MultiplexProgramServiceDescriptor x
-> MultiplexProgramServiceDescriptor
$cfrom :: forall x.
MultiplexProgramServiceDescriptor
-> Rep MultiplexProgramServiceDescriptor x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexProgramServiceDescriptor' 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:
--
-- 'providerName', 'multiplexProgramServiceDescriptor_providerName' - Name of the provider.
--
-- 'serviceName', 'multiplexProgramServiceDescriptor_serviceName' - Name of the service.
newMultiplexProgramServiceDescriptor ::
  -- | 'providerName'
  Prelude.Text ->
  -- | 'serviceName'
  Prelude.Text ->
  MultiplexProgramServiceDescriptor
newMultiplexProgramServiceDescriptor :: Text -> Text -> MultiplexProgramServiceDescriptor
newMultiplexProgramServiceDescriptor
  Text
pProviderName_
  Text
pServiceName_ =
    MultiplexProgramServiceDescriptor' :: Text -> Text -> MultiplexProgramServiceDescriptor
MultiplexProgramServiceDescriptor'
      { $sel:providerName:MultiplexProgramServiceDescriptor' :: Text
providerName =
          Text
pProviderName_,
        $sel:serviceName:MultiplexProgramServiceDescriptor' :: Text
serviceName = Text
pServiceName_
      }

-- | Name of the provider.
multiplexProgramServiceDescriptor_providerName :: Lens.Lens' MultiplexProgramServiceDescriptor Prelude.Text
multiplexProgramServiceDescriptor_providerName :: (Text -> f Text)
-> MultiplexProgramServiceDescriptor
-> f MultiplexProgramServiceDescriptor
multiplexProgramServiceDescriptor_providerName = (MultiplexProgramServiceDescriptor -> Text)
-> (MultiplexProgramServiceDescriptor
    -> Text -> MultiplexProgramServiceDescriptor)
-> Lens
     MultiplexProgramServiceDescriptor
     MultiplexProgramServiceDescriptor
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgramServiceDescriptor' {Text
providerName :: Text
$sel:providerName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
providerName} -> Text
providerName) (\s :: MultiplexProgramServiceDescriptor
s@MultiplexProgramServiceDescriptor' {} Text
a -> MultiplexProgramServiceDescriptor
s {$sel:providerName:MultiplexProgramServiceDescriptor' :: Text
providerName = Text
a} :: MultiplexProgramServiceDescriptor)

-- | Name of the service.
multiplexProgramServiceDescriptor_serviceName :: Lens.Lens' MultiplexProgramServiceDescriptor Prelude.Text
multiplexProgramServiceDescriptor_serviceName :: (Text -> f Text)
-> MultiplexProgramServiceDescriptor
-> f MultiplexProgramServiceDescriptor
multiplexProgramServiceDescriptor_serviceName = (MultiplexProgramServiceDescriptor -> Text)
-> (MultiplexProgramServiceDescriptor
    -> Text -> MultiplexProgramServiceDescriptor)
-> Lens
     MultiplexProgramServiceDescriptor
     MultiplexProgramServiceDescriptor
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexProgramServiceDescriptor' {Text
serviceName :: Text
$sel:serviceName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
serviceName} -> Text
serviceName) (\s :: MultiplexProgramServiceDescriptor
s@MultiplexProgramServiceDescriptor' {} Text
a -> MultiplexProgramServiceDescriptor
s {$sel:serviceName:MultiplexProgramServiceDescriptor' :: Text
serviceName = Text
a} :: MultiplexProgramServiceDescriptor)

instance
  Core.FromJSON
    MultiplexProgramServiceDescriptor
  where
  parseJSON :: Value -> Parser MultiplexProgramServiceDescriptor
parseJSON =
    String
-> (Object -> Parser MultiplexProgramServiceDescriptor)
-> Value
-> Parser MultiplexProgramServiceDescriptor
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MultiplexProgramServiceDescriptor"
      ( \Object
x ->
          Text -> Text -> MultiplexProgramServiceDescriptor
MultiplexProgramServiceDescriptor'
            (Text -> Text -> MultiplexProgramServiceDescriptor)
-> Parser Text
-> Parser (Text -> MultiplexProgramServiceDescriptor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"providerName")
            Parser (Text -> MultiplexProgramServiceDescriptor)
-> Parser Text -> Parser MultiplexProgramServiceDescriptor
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"serviceName")
      )

instance
  Prelude.Hashable
    MultiplexProgramServiceDescriptor

instance
  Prelude.NFData
    MultiplexProgramServiceDescriptor

instance
  Core.ToJSON
    MultiplexProgramServiceDescriptor
  where
  toJSON :: MultiplexProgramServiceDescriptor -> Value
toJSON MultiplexProgramServiceDescriptor' {Text
serviceName :: Text
providerName :: Text
$sel:serviceName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
$sel:providerName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"providerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
providerName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"serviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceName)
          ]
      )