{-# 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.MediaConvert.Types.OutputChannelMapping
-- 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.MediaConvert.Types.OutputChannelMapping 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

-- | OutputChannel mapping settings.
--
-- /See:/ 'newOutputChannelMapping' smart constructor.
data OutputChannelMapping = OutputChannelMapping'
  { -- | Use this setting to specify your remix values when they are integers,
    -- such as -10, 0, or 4.
    OutputChannelMapping -> Maybe [Int]
inputChannels :: Prelude.Maybe [Prelude.Int],
    -- | Use this setting to specify your remix values when they have a decimal
    -- component, such as -10.312, 0.08, or 4.9. MediaConvert rounds your
    -- remixing values to the nearest thousandth.
    OutputChannelMapping -> Maybe [Double]
inputChannelsFineTune :: Prelude.Maybe [Prelude.Double]
  }
  deriving (OutputChannelMapping -> OutputChannelMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputChannelMapping -> OutputChannelMapping -> Bool
$c/= :: OutputChannelMapping -> OutputChannelMapping -> Bool
== :: OutputChannelMapping -> OutputChannelMapping -> Bool
$c== :: OutputChannelMapping -> OutputChannelMapping -> Bool
Prelude.Eq, ReadPrec [OutputChannelMapping]
ReadPrec OutputChannelMapping
Int -> ReadS OutputChannelMapping
ReadS [OutputChannelMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputChannelMapping]
$creadListPrec :: ReadPrec [OutputChannelMapping]
readPrec :: ReadPrec OutputChannelMapping
$creadPrec :: ReadPrec OutputChannelMapping
readList :: ReadS [OutputChannelMapping]
$creadList :: ReadS [OutputChannelMapping]
readsPrec :: Int -> ReadS OutputChannelMapping
$creadsPrec :: Int -> ReadS OutputChannelMapping
Prelude.Read, Int -> OutputChannelMapping -> ShowS
[OutputChannelMapping] -> ShowS
OutputChannelMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputChannelMapping] -> ShowS
$cshowList :: [OutputChannelMapping] -> ShowS
show :: OutputChannelMapping -> String
$cshow :: OutputChannelMapping -> String
showsPrec :: Int -> OutputChannelMapping -> ShowS
$cshowsPrec :: Int -> OutputChannelMapping -> ShowS
Prelude.Show, forall x. Rep OutputChannelMapping x -> OutputChannelMapping
forall x. OutputChannelMapping -> Rep OutputChannelMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputChannelMapping x -> OutputChannelMapping
$cfrom :: forall x. OutputChannelMapping -> Rep OutputChannelMapping x
Prelude.Generic)

-- |
-- Create a value of 'OutputChannelMapping' 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:
--
-- 'inputChannels', 'outputChannelMapping_inputChannels' - Use this setting to specify your remix values when they are integers,
-- such as -10, 0, or 4.
--
-- 'inputChannelsFineTune', 'outputChannelMapping_inputChannelsFineTune' - Use this setting to specify your remix values when they have a decimal
-- component, such as -10.312, 0.08, or 4.9. MediaConvert rounds your
-- remixing values to the nearest thousandth.
newOutputChannelMapping ::
  OutputChannelMapping
newOutputChannelMapping :: OutputChannelMapping
newOutputChannelMapping =
  OutputChannelMapping'
    { $sel:inputChannels:OutputChannelMapping' :: Maybe [Int]
inputChannels =
        forall a. Maybe a
Prelude.Nothing,
      $sel:inputChannelsFineTune:OutputChannelMapping' :: Maybe [Double]
inputChannelsFineTune = forall a. Maybe a
Prelude.Nothing
    }

-- | Use this setting to specify your remix values when they are integers,
-- such as -10, 0, or 4.
outputChannelMapping_inputChannels :: Lens.Lens' OutputChannelMapping (Prelude.Maybe [Prelude.Int])
outputChannelMapping_inputChannels :: Lens' OutputChannelMapping (Maybe [Int])
outputChannelMapping_inputChannels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputChannelMapping' {Maybe [Int]
inputChannels :: Maybe [Int]
$sel:inputChannels:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Int]
inputChannels} -> Maybe [Int]
inputChannels) (\s :: OutputChannelMapping
s@OutputChannelMapping' {} Maybe [Int]
a -> OutputChannelMapping
s {$sel:inputChannels:OutputChannelMapping' :: Maybe [Int]
inputChannels = Maybe [Int]
a} :: OutputChannelMapping) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Use this setting to specify your remix values when they have a decimal
-- component, such as -10.312, 0.08, or 4.9. MediaConvert rounds your
-- remixing values to the nearest thousandth.
outputChannelMapping_inputChannelsFineTune :: Lens.Lens' OutputChannelMapping (Prelude.Maybe [Prelude.Double])
outputChannelMapping_inputChannelsFineTune :: Lens' OutputChannelMapping (Maybe [Double])
outputChannelMapping_inputChannelsFineTune = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputChannelMapping' {Maybe [Double]
inputChannelsFineTune :: Maybe [Double]
$sel:inputChannelsFineTune:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Double]
inputChannelsFineTune} -> Maybe [Double]
inputChannelsFineTune) (\s :: OutputChannelMapping
s@OutputChannelMapping' {} Maybe [Double]
a -> OutputChannelMapping
s {$sel:inputChannelsFineTune:OutputChannelMapping' :: Maybe [Double]
inputChannelsFineTune = Maybe [Double]
a} :: OutputChannelMapping) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON OutputChannelMapping where
  parseJSON :: Value -> Parser OutputChannelMapping
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputChannelMapping"
      ( \Object
x ->
          Maybe [Int] -> Maybe [Double] -> OutputChannelMapping
OutputChannelMapping'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"inputChannels" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"inputChannelsFineTune"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable OutputChannelMapping where
  hashWithSalt :: Int -> OutputChannelMapping -> Int
hashWithSalt Int
_salt OutputChannelMapping' {Maybe [Double]
Maybe [Int]
inputChannelsFineTune :: Maybe [Double]
inputChannels :: Maybe [Int]
$sel:inputChannelsFineTune:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Double]
$sel:inputChannels:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Int]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Int]
inputChannels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Double]
inputChannelsFineTune

instance Prelude.NFData OutputChannelMapping where
  rnf :: OutputChannelMapping -> ()
rnf OutputChannelMapping' {Maybe [Double]
Maybe [Int]
inputChannelsFineTune :: Maybe [Double]
inputChannels :: Maybe [Int]
$sel:inputChannelsFineTune:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Double]
$sel:inputChannels:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Int]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Int]
inputChannels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Double]
inputChannelsFineTune

instance Data.ToJSON OutputChannelMapping where
  toJSON :: OutputChannelMapping -> Value
toJSON OutputChannelMapping' {Maybe [Double]
Maybe [Int]
inputChannelsFineTune :: Maybe [Double]
inputChannels :: Maybe [Int]
$sel:inputChannelsFineTune:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Double]
$sel:inputChannels:OutputChannelMapping' :: OutputChannelMapping -> Maybe [Int]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"inputChannels" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Int]
inputChannels,
            (Key
"inputChannelsFineTune" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Double]
inputChannelsFineTune
          ]
      )