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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.OutputLocationRef
import qualified Amazonka.Prelude as Prelude

-- | Multiplex Output Settings
--
-- /See:/ 'newMultiplexOutputSettings' smart constructor.
data MultiplexOutputSettings = MultiplexOutputSettings'
  { -- | Destination is a Multiplex.
    MultiplexOutputSettings -> OutputLocationRef
destination :: OutputLocationRef
  }
  deriving (MultiplexOutputSettings -> MultiplexOutputSettings -> Bool
(MultiplexOutputSettings -> MultiplexOutputSettings -> Bool)
-> (MultiplexOutputSettings -> MultiplexOutputSettings -> Bool)
-> Eq MultiplexOutputSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexOutputSettings -> MultiplexOutputSettings -> Bool
$c/= :: MultiplexOutputSettings -> MultiplexOutputSettings -> Bool
== :: MultiplexOutputSettings -> MultiplexOutputSettings -> Bool
$c== :: MultiplexOutputSettings -> MultiplexOutputSettings -> Bool
Prelude.Eq, ReadPrec [MultiplexOutputSettings]
ReadPrec MultiplexOutputSettings
Int -> ReadS MultiplexOutputSettings
ReadS [MultiplexOutputSettings]
(Int -> ReadS MultiplexOutputSettings)
-> ReadS [MultiplexOutputSettings]
-> ReadPrec MultiplexOutputSettings
-> ReadPrec [MultiplexOutputSettings]
-> Read MultiplexOutputSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexOutputSettings]
$creadListPrec :: ReadPrec [MultiplexOutputSettings]
readPrec :: ReadPrec MultiplexOutputSettings
$creadPrec :: ReadPrec MultiplexOutputSettings
readList :: ReadS [MultiplexOutputSettings]
$creadList :: ReadS [MultiplexOutputSettings]
readsPrec :: Int -> ReadS MultiplexOutputSettings
$creadsPrec :: Int -> ReadS MultiplexOutputSettings
Prelude.Read, Int -> MultiplexOutputSettings -> ShowS
[MultiplexOutputSettings] -> ShowS
MultiplexOutputSettings -> String
(Int -> MultiplexOutputSettings -> ShowS)
-> (MultiplexOutputSettings -> String)
-> ([MultiplexOutputSettings] -> ShowS)
-> Show MultiplexOutputSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexOutputSettings] -> ShowS
$cshowList :: [MultiplexOutputSettings] -> ShowS
show :: MultiplexOutputSettings -> String
$cshow :: MultiplexOutputSettings -> String
showsPrec :: Int -> MultiplexOutputSettings -> ShowS
$cshowsPrec :: Int -> MultiplexOutputSettings -> ShowS
Prelude.Show, (forall x.
 MultiplexOutputSettings -> Rep MultiplexOutputSettings x)
-> (forall x.
    Rep MultiplexOutputSettings x -> MultiplexOutputSettings)
-> Generic MultiplexOutputSettings
forall x. Rep MultiplexOutputSettings x -> MultiplexOutputSettings
forall x. MultiplexOutputSettings -> Rep MultiplexOutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MultiplexOutputSettings x -> MultiplexOutputSettings
$cfrom :: forall x. MultiplexOutputSettings -> Rep MultiplexOutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexOutputSettings' 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:
--
-- 'destination', 'multiplexOutputSettings_destination' - Destination is a Multiplex.
newMultiplexOutputSettings ::
  -- | 'destination'
  OutputLocationRef ->
  MultiplexOutputSettings
newMultiplexOutputSettings :: OutputLocationRef -> MultiplexOutputSettings
newMultiplexOutputSettings OutputLocationRef
pDestination_ =
  MultiplexOutputSettings' :: OutputLocationRef -> MultiplexOutputSettings
MultiplexOutputSettings'
    { $sel:destination:MultiplexOutputSettings' :: OutputLocationRef
destination =
        OutputLocationRef
pDestination_
    }

-- | Destination is a Multiplex.
multiplexOutputSettings_destination :: Lens.Lens' MultiplexOutputSettings OutputLocationRef
multiplexOutputSettings_destination :: (OutputLocationRef -> f OutputLocationRef)
-> MultiplexOutputSettings -> f MultiplexOutputSettings
multiplexOutputSettings_destination = (MultiplexOutputSettings -> OutputLocationRef)
-> (MultiplexOutputSettings
    -> OutputLocationRef -> MultiplexOutputSettings)
-> Lens
     MultiplexOutputSettings
     MultiplexOutputSettings
     OutputLocationRef
     OutputLocationRef
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexOutputSettings' {OutputLocationRef
destination :: OutputLocationRef
$sel:destination:MultiplexOutputSettings' :: MultiplexOutputSettings -> OutputLocationRef
destination} -> OutputLocationRef
destination) (\s :: MultiplexOutputSettings
s@MultiplexOutputSettings' {} OutputLocationRef
a -> MultiplexOutputSettings
s {$sel:destination:MultiplexOutputSettings' :: OutputLocationRef
destination = OutputLocationRef
a} :: MultiplexOutputSettings)

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

instance Prelude.Hashable MultiplexOutputSettings

instance Prelude.NFData MultiplexOutputSettings

instance Core.ToJSON MultiplexOutputSettings where
  toJSON :: MultiplexOutputSettings -> Value
toJSON MultiplexOutputSettings' {OutputLocationRef
destination :: OutputLocationRef
$sel:destination:MultiplexOutputSettings' :: MultiplexOutputSettings -> OutputLocationRef
..} =
    [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
"destination" Text -> OutputLocationRef -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OutputLocationRef
destination)]
      )