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

-- | 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
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]
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
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.
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'
      { $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 :: Lens' MultiplexProgramServiceDescriptor Text
multiplexProgramServiceDescriptor_providerName = 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 :: Lens' MultiplexProgramServiceDescriptor Text
multiplexProgramServiceDescriptor_serviceName = 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
  Data.FromJSON
    MultiplexProgramServiceDescriptor
  where
  parseJSON :: Value -> Parser MultiplexProgramServiceDescriptor
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MultiplexProgramServiceDescriptor"
      ( \Object
x ->
          Text -> Text -> MultiplexProgramServiceDescriptor
MultiplexProgramServiceDescriptor'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"providerName")
            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
"serviceName")
      )

instance
  Prelude.Hashable
    MultiplexProgramServiceDescriptor
  where
  hashWithSalt :: Int -> MultiplexProgramServiceDescriptor -> Int
hashWithSalt
    Int
_salt
    MultiplexProgramServiceDescriptor' {Text
serviceName :: Text
providerName :: Text
$sel:serviceName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
$sel:providerName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
providerName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceName

instance
  Prelude.NFData
    MultiplexProgramServiceDescriptor
  where
  rnf :: MultiplexProgramServiceDescriptor -> ()
rnf MultiplexProgramServiceDescriptor' {Text
serviceName :: Text
providerName :: Text
$sel:serviceName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
$sel:providerName:MultiplexProgramServiceDescriptor' :: MultiplexProgramServiceDescriptor -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
providerName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serviceName

instance
  Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"providerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
providerName),
            forall a. a -> Maybe a
Prelude.Just (Key
"serviceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceName)
          ]
      )