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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.DolbyEProgramSelection
import qualified Amazonka.Prelude as Prelude

-- | Audio Dolby EDecode
--
-- /See:/ 'newAudioDolbyEDecode' smart constructor.
data AudioDolbyEDecode = AudioDolbyEDecode'
  { -- | Applies only to Dolby E. Enter the program ID (according to the metadata
    -- in the audio) of the Dolby E program to extract from the specified
    -- track. One program extracted per audio selector. To select multiple
    -- programs, create multiple selectors with the same Track and different
    -- Program numbers. “All channels” means to ignore the program IDs and
    -- include all the channels in this selector; useful if metadata is known
    -- to be incorrect.
    AudioDolbyEDecode -> DolbyEProgramSelection
programSelection :: DolbyEProgramSelection
  }
  deriving (AudioDolbyEDecode -> AudioDolbyEDecode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioDolbyEDecode -> AudioDolbyEDecode -> Bool
$c/= :: AudioDolbyEDecode -> AudioDolbyEDecode -> Bool
== :: AudioDolbyEDecode -> AudioDolbyEDecode -> Bool
$c== :: AudioDolbyEDecode -> AudioDolbyEDecode -> Bool
Prelude.Eq, ReadPrec [AudioDolbyEDecode]
ReadPrec AudioDolbyEDecode
Int -> ReadS AudioDolbyEDecode
ReadS [AudioDolbyEDecode]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioDolbyEDecode]
$creadListPrec :: ReadPrec [AudioDolbyEDecode]
readPrec :: ReadPrec AudioDolbyEDecode
$creadPrec :: ReadPrec AudioDolbyEDecode
readList :: ReadS [AudioDolbyEDecode]
$creadList :: ReadS [AudioDolbyEDecode]
readsPrec :: Int -> ReadS AudioDolbyEDecode
$creadsPrec :: Int -> ReadS AudioDolbyEDecode
Prelude.Read, Int -> AudioDolbyEDecode -> ShowS
[AudioDolbyEDecode] -> ShowS
AudioDolbyEDecode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioDolbyEDecode] -> ShowS
$cshowList :: [AudioDolbyEDecode] -> ShowS
show :: AudioDolbyEDecode -> String
$cshow :: AudioDolbyEDecode -> String
showsPrec :: Int -> AudioDolbyEDecode -> ShowS
$cshowsPrec :: Int -> AudioDolbyEDecode -> ShowS
Prelude.Show, forall x. Rep AudioDolbyEDecode x -> AudioDolbyEDecode
forall x. AudioDolbyEDecode -> Rep AudioDolbyEDecode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioDolbyEDecode x -> AudioDolbyEDecode
$cfrom :: forall x. AudioDolbyEDecode -> Rep AudioDolbyEDecode x
Prelude.Generic)

-- |
-- Create a value of 'AudioDolbyEDecode' 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:
--
-- 'programSelection', 'audioDolbyEDecode_programSelection' - Applies only to Dolby E. Enter the program ID (according to the metadata
-- in the audio) of the Dolby E program to extract from the specified
-- track. One program extracted per audio selector. To select multiple
-- programs, create multiple selectors with the same Track and different
-- Program numbers. “All channels” means to ignore the program IDs and
-- include all the channels in this selector; useful if metadata is known
-- to be incorrect.
newAudioDolbyEDecode ::
  -- | 'programSelection'
  DolbyEProgramSelection ->
  AudioDolbyEDecode
newAudioDolbyEDecode :: DolbyEProgramSelection -> AudioDolbyEDecode
newAudioDolbyEDecode DolbyEProgramSelection
pProgramSelection_ =
  AudioDolbyEDecode'
    { $sel:programSelection:AudioDolbyEDecode' :: DolbyEProgramSelection
programSelection =
        DolbyEProgramSelection
pProgramSelection_
    }

-- | Applies only to Dolby E. Enter the program ID (according to the metadata
-- in the audio) of the Dolby E program to extract from the specified
-- track. One program extracted per audio selector. To select multiple
-- programs, create multiple selectors with the same Track and different
-- Program numbers. “All channels” means to ignore the program IDs and
-- include all the channels in this selector; useful if metadata is known
-- to be incorrect.
audioDolbyEDecode_programSelection :: Lens.Lens' AudioDolbyEDecode DolbyEProgramSelection
audioDolbyEDecode_programSelection :: Lens' AudioDolbyEDecode DolbyEProgramSelection
audioDolbyEDecode_programSelection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioDolbyEDecode' {DolbyEProgramSelection
programSelection :: DolbyEProgramSelection
$sel:programSelection:AudioDolbyEDecode' :: AudioDolbyEDecode -> DolbyEProgramSelection
programSelection} -> DolbyEProgramSelection
programSelection) (\s :: AudioDolbyEDecode
s@AudioDolbyEDecode' {} DolbyEProgramSelection
a -> AudioDolbyEDecode
s {$sel:programSelection:AudioDolbyEDecode' :: DolbyEProgramSelection
programSelection = DolbyEProgramSelection
a} :: AudioDolbyEDecode)

instance Data.FromJSON AudioDolbyEDecode where
  parseJSON :: Value -> Parser AudioDolbyEDecode
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioDolbyEDecode"
      ( \Object
x ->
          DolbyEProgramSelection -> AudioDolbyEDecode
AudioDolbyEDecode'
            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
"programSelection")
      )

instance Prelude.Hashable AudioDolbyEDecode where
  hashWithSalt :: Int -> AudioDolbyEDecode -> Int
hashWithSalt Int
_salt AudioDolbyEDecode' {DolbyEProgramSelection
programSelection :: DolbyEProgramSelection
$sel:programSelection:AudioDolbyEDecode' :: AudioDolbyEDecode -> DolbyEProgramSelection
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DolbyEProgramSelection
programSelection

instance Prelude.NFData AudioDolbyEDecode where
  rnf :: AudioDolbyEDecode -> ()
rnf AudioDolbyEDecode' {DolbyEProgramSelection
programSelection :: DolbyEProgramSelection
$sel:programSelection:AudioDolbyEDecode' :: AudioDolbyEDecode -> DolbyEProgramSelection
..} =
    forall a. NFData a => a -> ()
Prelude.rnf DolbyEProgramSelection
programSelection

instance Data.ToJSON AudioDolbyEDecode where
  toJSON :: AudioDolbyEDecode -> Value
toJSON AudioDolbyEDecode' {DolbyEProgramSelection
programSelection :: DolbyEProgramSelection
$sel:programSelection:AudioDolbyEDecode' :: AudioDolbyEDecode -> DolbyEProgramSelection
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"programSelection" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DolbyEProgramSelection
programSelection)
          ]
      )