{-# 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 #-}
module Amazonka.MediaLive.Types.AudioChannelMapping where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.InputChannelLevel
import qualified Amazonka.Prelude as Prelude
data AudioChannelMapping = AudioChannelMapping'
{
AudioChannelMapping -> Natural
outputChannel :: Prelude.Natural,
AudioChannelMapping -> [InputChannelLevel]
inputChannelLevels :: [InputChannelLevel]
}
deriving (AudioChannelMapping -> AudioChannelMapping -> Bool
(AudioChannelMapping -> AudioChannelMapping -> Bool)
-> (AudioChannelMapping -> AudioChannelMapping -> Bool)
-> Eq AudioChannelMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioChannelMapping -> AudioChannelMapping -> Bool
$c/= :: AudioChannelMapping -> AudioChannelMapping -> Bool
== :: AudioChannelMapping -> AudioChannelMapping -> Bool
$c== :: AudioChannelMapping -> AudioChannelMapping -> Bool
Prelude.Eq, ReadPrec [AudioChannelMapping]
ReadPrec AudioChannelMapping
Int -> ReadS AudioChannelMapping
ReadS [AudioChannelMapping]
(Int -> ReadS AudioChannelMapping)
-> ReadS [AudioChannelMapping]
-> ReadPrec AudioChannelMapping
-> ReadPrec [AudioChannelMapping]
-> Read AudioChannelMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioChannelMapping]
$creadListPrec :: ReadPrec [AudioChannelMapping]
readPrec :: ReadPrec AudioChannelMapping
$creadPrec :: ReadPrec AudioChannelMapping
readList :: ReadS [AudioChannelMapping]
$creadList :: ReadS [AudioChannelMapping]
readsPrec :: Int -> ReadS AudioChannelMapping
$creadsPrec :: Int -> ReadS AudioChannelMapping
Prelude.Read, Int -> AudioChannelMapping -> ShowS
[AudioChannelMapping] -> ShowS
AudioChannelMapping -> String
(Int -> AudioChannelMapping -> ShowS)
-> (AudioChannelMapping -> String)
-> ([AudioChannelMapping] -> ShowS)
-> Show AudioChannelMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioChannelMapping] -> ShowS
$cshowList :: [AudioChannelMapping] -> ShowS
show :: AudioChannelMapping -> String
$cshow :: AudioChannelMapping -> String
showsPrec :: Int -> AudioChannelMapping -> ShowS
$cshowsPrec :: Int -> AudioChannelMapping -> ShowS
Prelude.Show, (forall x. AudioChannelMapping -> Rep AudioChannelMapping x)
-> (forall x. Rep AudioChannelMapping x -> AudioChannelMapping)
-> Generic AudioChannelMapping
forall x. Rep AudioChannelMapping x -> AudioChannelMapping
forall x. AudioChannelMapping -> Rep AudioChannelMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioChannelMapping x -> AudioChannelMapping
$cfrom :: forall x. AudioChannelMapping -> Rep AudioChannelMapping x
Prelude.Generic)
newAudioChannelMapping ::
Prelude.Natural ->
AudioChannelMapping
newAudioChannelMapping :: Natural -> AudioChannelMapping
newAudioChannelMapping Natural
pOutputChannel_ =
AudioChannelMapping' :: Natural -> [InputChannelLevel] -> AudioChannelMapping
AudioChannelMapping'
{ $sel:outputChannel:AudioChannelMapping' :: Natural
outputChannel =
Natural
pOutputChannel_,
$sel:inputChannelLevels:AudioChannelMapping' :: [InputChannelLevel]
inputChannelLevels = [InputChannelLevel]
forall a. Monoid a => a
Prelude.mempty
}
audioChannelMapping_outputChannel :: Lens.Lens' AudioChannelMapping Prelude.Natural
audioChannelMapping_outputChannel :: (Natural -> f Natural)
-> AudioChannelMapping -> f AudioChannelMapping
audioChannelMapping_outputChannel = (AudioChannelMapping -> Natural)
-> (AudioChannelMapping -> Natural -> AudioChannelMapping)
-> Lens AudioChannelMapping AudioChannelMapping Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioChannelMapping' {Natural
outputChannel :: Natural
$sel:outputChannel:AudioChannelMapping' :: AudioChannelMapping -> Natural
outputChannel} -> Natural
outputChannel) (\s :: AudioChannelMapping
s@AudioChannelMapping' {} Natural
a -> AudioChannelMapping
s {$sel:outputChannel:AudioChannelMapping' :: Natural
outputChannel = Natural
a} :: AudioChannelMapping)
audioChannelMapping_inputChannelLevels :: Lens.Lens' AudioChannelMapping [InputChannelLevel]
audioChannelMapping_inputChannelLevels :: ([InputChannelLevel] -> f [InputChannelLevel])
-> AudioChannelMapping -> f AudioChannelMapping
audioChannelMapping_inputChannelLevels = (AudioChannelMapping -> [InputChannelLevel])
-> (AudioChannelMapping
-> [InputChannelLevel] -> AudioChannelMapping)
-> Lens
AudioChannelMapping
AudioChannelMapping
[InputChannelLevel]
[InputChannelLevel]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioChannelMapping' {[InputChannelLevel]
inputChannelLevels :: [InputChannelLevel]
$sel:inputChannelLevels:AudioChannelMapping' :: AudioChannelMapping -> [InputChannelLevel]
inputChannelLevels} -> [InputChannelLevel]
inputChannelLevels) (\s :: AudioChannelMapping
s@AudioChannelMapping' {} [InputChannelLevel]
a -> AudioChannelMapping
s {$sel:inputChannelLevels:AudioChannelMapping' :: [InputChannelLevel]
inputChannelLevels = [InputChannelLevel]
a} :: AudioChannelMapping) (([InputChannelLevel] -> f [InputChannelLevel])
-> AudioChannelMapping -> f AudioChannelMapping)
-> (([InputChannelLevel] -> f [InputChannelLevel])
-> [InputChannelLevel] -> f [InputChannelLevel])
-> ([InputChannelLevel] -> f [InputChannelLevel])
-> AudioChannelMapping
-> f AudioChannelMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([InputChannelLevel] -> f [InputChannelLevel])
-> [InputChannelLevel] -> f [InputChannelLevel]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AudioChannelMapping where
parseJSON :: Value -> Parser AudioChannelMapping
parseJSON =
String
-> (Object -> Parser AudioChannelMapping)
-> Value
-> Parser AudioChannelMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AudioChannelMapping"
( \Object
x ->
Natural -> [InputChannelLevel] -> AudioChannelMapping
AudioChannelMapping'
(Natural -> [InputChannelLevel] -> AudioChannelMapping)
-> Parser Natural
-> Parser ([InputChannelLevel] -> AudioChannelMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"outputChannel")
Parser ([InputChannelLevel] -> AudioChannelMapping)
-> Parser [InputChannelLevel] -> Parser AudioChannelMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [InputChannelLevel])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputChannelLevels"
Parser (Maybe [InputChannelLevel])
-> [InputChannelLevel] -> Parser [InputChannelLevel]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [InputChannelLevel]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable AudioChannelMapping
instance Prelude.NFData AudioChannelMapping
instance Core.ToJSON AudioChannelMapping where
toJSON :: AudioChannelMapping -> Value
toJSON AudioChannelMapping' {Natural
[InputChannelLevel]
inputChannelLevels :: [InputChannelLevel]
outputChannel :: Natural
$sel:inputChannelLevels:AudioChannelMapping' :: AudioChannelMapping -> [InputChannelLevel]
$sel:outputChannel:AudioChannelMapping' :: AudioChannelMapping -> Natural
..} =
[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
"outputChannel" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
outputChannel),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"inputChannelLevels" Text -> [InputChannelLevel] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [InputChannelLevel]
inputChannelLevels)
]
)