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

-- | Use audio selector groups to combine multiple sidecar audio inputs so
-- that you can assign them to a single output audio tab
-- (AudioDescription). Note that, if you\'re working with embedded audio,
-- it\'s simpler to assign multiple input tracks into a single audio
-- selector rather than use an audio selector group.
--
-- /See:/ 'newAudioSelectorGroup' smart constructor.
data AudioSelectorGroup = AudioSelectorGroup'
  { -- | Name of an Audio Selector within the same input to include in the group.
    -- Audio selector names are standardized, based on their order within the
    -- input (e.g., \"Audio Selector 1\"). The audio selector name parameter
    -- can be repeated to add any number of audio selectors to the group.
    AudioSelectorGroup -> Maybe [Text]
audioSelectorNames :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AudioSelectorGroup -> AudioSelectorGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioSelectorGroup -> AudioSelectorGroup -> Bool
$c/= :: AudioSelectorGroup -> AudioSelectorGroup -> Bool
== :: AudioSelectorGroup -> AudioSelectorGroup -> Bool
$c== :: AudioSelectorGroup -> AudioSelectorGroup -> Bool
Prelude.Eq, ReadPrec [AudioSelectorGroup]
ReadPrec AudioSelectorGroup
Int -> ReadS AudioSelectorGroup
ReadS [AudioSelectorGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioSelectorGroup]
$creadListPrec :: ReadPrec [AudioSelectorGroup]
readPrec :: ReadPrec AudioSelectorGroup
$creadPrec :: ReadPrec AudioSelectorGroup
readList :: ReadS [AudioSelectorGroup]
$creadList :: ReadS [AudioSelectorGroup]
readsPrec :: Int -> ReadS AudioSelectorGroup
$creadsPrec :: Int -> ReadS AudioSelectorGroup
Prelude.Read, Int -> AudioSelectorGroup -> ShowS
[AudioSelectorGroup] -> ShowS
AudioSelectorGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioSelectorGroup] -> ShowS
$cshowList :: [AudioSelectorGroup] -> ShowS
show :: AudioSelectorGroup -> String
$cshow :: AudioSelectorGroup -> String
showsPrec :: Int -> AudioSelectorGroup -> ShowS
$cshowsPrec :: Int -> AudioSelectorGroup -> ShowS
Prelude.Show, forall x. Rep AudioSelectorGroup x -> AudioSelectorGroup
forall x. AudioSelectorGroup -> Rep AudioSelectorGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioSelectorGroup x -> AudioSelectorGroup
$cfrom :: forall x. AudioSelectorGroup -> Rep AudioSelectorGroup x
Prelude.Generic)

-- |
-- Create a value of 'AudioSelectorGroup' 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:
--
-- 'audioSelectorNames', 'audioSelectorGroup_audioSelectorNames' - Name of an Audio Selector within the same input to include in the group.
-- Audio selector names are standardized, based on their order within the
-- input (e.g., \"Audio Selector 1\"). The audio selector name parameter
-- can be repeated to add any number of audio selectors to the group.
newAudioSelectorGroup ::
  AudioSelectorGroup
newAudioSelectorGroup :: AudioSelectorGroup
newAudioSelectorGroup =
  AudioSelectorGroup'
    { $sel:audioSelectorNames:AudioSelectorGroup' :: Maybe [Text]
audioSelectorNames =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Name of an Audio Selector within the same input to include in the group.
-- Audio selector names are standardized, based on their order within the
-- input (e.g., \"Audio Selector 1\"). The audio selector name parameter
-- can be repeated to add any number of audio selectors to the group.
audioSelectorGroup_audioSelectorNames :: Lens.Lens' AudioSelectorGroup (Prelude.Maybe [Prelude.Text])
audioSelectorGroup_audioSelectorNames :: Lens' AudioSelectorGroup (Maybe [Text])
audioSelectorGroup_audioSelectorNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioSelectorGroup' {Maybe [Text]
audioSelectorNames :: Maybe [Text]
$sel:audioSelectorNames:AudioSelectorGroup' :: AudioSelectorGroup -> Maybe [Text]
audioSelectorNames} -> Maybe [Text]
audioSelectorNames) (\s :: AudioSelectorGroup
s@AudioSelectorGroup' {} Maybe [Text]
a -> AudioSelectorGroup
s {$sel:audioSelectorNames:AudioSelectorGroup' :: Maybe [Text]
audioSelectorNames = Maybe [Text]
a} :: AudioSelectorGroup) 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 AudioSelectorGroup where
  parseJSON :: Value -> Parser AudioSelectorGroup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioSelectorGroup"
      ( \Object
x ->
          Maybe [Text] -> AudioSelectorGroup
AudioSelectorGroup'
            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
"audioSelectorNames"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AudioSelectorGroup where
  hashWithSalt :: Int -> AudioSelectorGroup -> Int
hashWithSalt Int
_salt AudioSelectorGroup' {Maybe [Text]
audioSelectorNames :: Maybe [Text]
$sel:audioSelectorNames:AudioSelectorGroup' :: AudioSelectorGroup -> Maybe [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
audioSelectorNames

instance Prelude.NFData AudioSelectorGroup where
  rnf :: AudioSelectorGroup -> ()
rnf AudioSelectorGroup' {Maybe [Text]
audioSelectorNames :: Maybe [Text]
$sel:audioSelectorNames:AudioSelectorGroup' :: AudioSelectorGroup -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
audioSelectorNames

instance Data.ToJSON AudioSelectorGroup where
  toJSON :: AudioSelectorGroup -> Value
toJSON AudioSelectorGroup' {Maybe [Text]
audioSelectorNames :: Maybe [Text]
$sel:audioSelectorNames:AudioSelectorGroup' :: AudioSelectorGroup -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"audioSelectorNames" 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 [Text]
audioSelectorNames
          ]
      )