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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(AudioSelectorGroup -> AudioSelectorGroup -> Bool)
-> (AudioSelectorGroup -> AudioSelectorGroup -> Bool)
-> Eq AudioSelectorGroup
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]
(Int -> ReadS AudioSelectorGroup)
-> ReadS [AudioSelectorGroup]
-> ReadPrec AudioSelectorGroup
-> ReadPrec [AudioSelectorGroup]
-> Read 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
(Int -> AudioSelectorGroup -> ShowS)
-> (AudioSelectorGroup -> String)
-> ([AudioSelectorGroup] -> ShowS)
-> Show AudioSelectorGroup
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. AudioSelectorGroup -> Rep AudioSelectorGroup x)
-> (forall x. Rep AudioSelectorGroup x -> AudioSelectorGroup)
-> Generic AudioSelectorGroup
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' :: Maybe [Text] -> AudioSelectorGroup
AudioSelectorGroup'
    { $sel:audioSelectorNames:AudioSelectorGroup' :: Maybe [Text]
audioSelectorNames =
        Maybe [Text]
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 :: (Maybe [Text] -> f (Maybe [Text]))
-> AudioSelectorGroup -> f AudioSelectorGroup
audioSelectorGroup_audioSelectorNames = (AudioSelectorGroup -> Maybe [Text])
-> (AudioSelectorGroup -> Maybe [Text] -> AudioSelectorGroup)
-> Lens
     AudioSelectorGroup AudioSelectorGroup (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> AudioSelectorGroup -> f AudioSelectorGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AudioSelectorGroup
-> f AudioSelectorGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AudioSelectorGroup where
  parseJSON :: Value -> Parser AudioSelectorGroup
parseJSON =
    String
-> (Object -> Parser AudioSelectorGroup)
-> Value
-> Parser AudioSelectorGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AudioSelectorGroup"
      ( \Object
x ->
          Maybe [Text] -> AudioSelectorGroup
AudioSelectorGroup'
            (Maybe [Text] -> AudioSelectorGroup)
-> Parser (Maybe [Text]) -> Parser AudioSelectorGroup
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audioSelectorNames"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AudioSelectorGroup

instance Prelude.NFData AudioSelectorGroup

instance Core.ToJSON AudioSelectorGroup where
  toJSON :: AudioSelectorGroup -> Value
toJSON AudioSelectorGroup' {Maybe [Text]
audioSelectorNames :: Maybe [Text]
$sel:audioSelectorNames:AudioSelectorGroup' :: AudioSelectorGroup -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"audioSelectorNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
audioSelectorNames
          ]
      )