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

-- | Audio Hls Rendition Selection
--
-- /See:/ 'newAudioHlsRenditionSelection' smart constructor.
data AudioHlsRenditionSelection = AudioHlsRenditionSelection'
  { -- | Specifies the NAME in the #EXT-X-MEDIA tag of the target HLS audio
    -- rendition.
    AudioHlsRenditionSelection -> Text
name :: Prelude.Text,
    -- | Specifies the GROUP-ID in the #EXT-X-MEDIA tag of the target HLS audio
    -- rendition.
    AudioHlsRenditionSelection -> Text
groupId :: Prelude.Text
  }
  deriving (AudioHlsRenditionSelection -> AudioHlsRenditionSelection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioHlsRenditionSelection -> AudioHlsRenditionSelection -> Bool
$c/= :: AudioHlsRenditionSelection -> AudioHlsRenditionSelection -> Bool
== :: AudioHlsRenditionSelection -> AudioHlsRenditionSelection -> Bool
$c== :: AudioHlsRenditionSelection -> AudioHlsRenditionSelection -> Bool
Prelude.Eq, ReadPrec [AudioHlsRenditionSelection]
ReadPrec AudioHlsRenditionSelection
Int -> ReadS AudioHlsRenditionSelection
ReadS [AudioHlsRenditionSelection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioHlsRenditionSelection]
$creadListPrec :: ReadPrec [AudioHlsRenditionSelection]
readPrec :: ReadPrec AudioHlsRenditionSelection
$creadPrec :: ReadPrec AudioHlsRenditionSelection
readList :: ReadS [AudioHlsRenditionSelection]
$creadList :: ReadS [AudioHlsRenditionSelection]
readsPrec :: Int -> ReadS AudioHlsRenditionSelection
$creadsPrec :: Int -> ReadS AudioHlsRenditionSelection
Prelude.Read, Int -> AudioHlsRenditionSelection -> ShowS
[AudioHlsRenditionSelection] -> ShowS
AudioHlsRenditionSelection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioHlsRenditionSelection] -> ShowS
$cshowList :: [AudioHlsRenditionSelection] -> ShowS
show :: AudioHlsRenditionSelection -> String
$cshow :: AudioHlsRenditionSelection -> String
showsPrec :: Int -> AudioHlsRenditionSelection -> ShowS
$cshowsPrec :: Int -> AudioHlsRenditionSelection -> ShowS
Prelude.Show, forall x.
Rep AudioHlsRenditionSelection x -> AudioHlsRenditionSelection
forall x.
AudioHlsRenditionSelection -> Rep AudioHlsRenditionSelection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AudioHlsRenditionSelection x -> AudioHlsRenditionSelection
$cfrom :: forall x.
AudioHlsRenditionSelection -> Rep AudioHlsRenditionSelection x
Prelude.Generic)

-- |
-- Create a value of 'AudioHlsRenditionSelection' 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:
--
-- 'name', 'audioHlsRenditionSelection_name' - Specifies the NAME in the #EXT-X-MEDIA tag of the target HLS audio
-- rendition.
--
-- 'groupId', 'audioHlsRenditionSelection_groupId' - Specifies the GROUP-ID in the #EXT-X-MEDIA tag of the target HLS audio
-- rendition.
newAudioHlsRenditionSelection ::
  -- | 'name'
  Prelude.Text ->
  -- | 'groupId'
  Prelude.Text ->
  AudioHlsRenditionSelection
newAudioHlsRenditionSelection :: Text -> Text -> AudioHlsRenditionSelection
newAudioHlsRenditionSelection Text
pName_ Text
pGroupId_ =
  AudioHlsRenditionSelection'
    { $sel:name:AudioHlsRenditionSelection' :: Text
name = Text
pName_,
      $sel:groupId:AudioHlsRenditionSelection' :: Text
groupId = Text
pGroupId_
    }

-- | Specifies the NAME in the #EXT-X-MEDIA tag of the target HLS audio
-- rendition.
audioHlsRenditionSelection_name :: Lens.Lens' AudioHlsRenditionSelection Prelude.Text
audioHlsRenditionSelection_name :: Lens' AudioHlsRenditionSelection Text
audioHlsRenditionSelection_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioHlsRenditionSelection' {Text
name :: Text
$sel:name:AudioHlsRenditionSelection' :: AudioHlsRenditionSelection -> Text
name} -> Text
name) (\s :: AudioHlsRenditionSelection
s@AudioHlsRenditionSelection' {} Text
a -> AudioHlsRenditionSelection
s {$sel:name:AudioHlsRenditionSelection' :: Text
name = Text
a} :: AudioHlsRenditionSelection)

-- | Specifies the GROUP-ID in the #EXT-X-MEDIA tag of the target HLS audio
-- rendition.
audioHlsRenditionSelection_groupId :: Lens.Lens' AudioHlsRenditionSelection Prelude.Text
audioHlsRenditionSelection_groupId :: Lens' AudioHlsRenditionSelection Text
audioHlsRenditionSelection_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioHlsRenditionSelection' {Text
groupId :: Text
$sel:groupId:AudioHlsRenditionSelection' :: AudioHlsRenditionSelection -> Text
groupId} -> Text
groupId) (\s :: AudioHlsRenditionSelection
s@AudioHlsRenditionSelection' {} Text
a -> AudioHlsRenditionSelection
s {$sel:groupId:AudioHlsRenditionSelection' :: Text
groupId = Text
a} :: AudioHlsRenditionSelection)

instance Data.FromJSON AudioHlsRenditionSelection where
  parseJSON :: Value -> Parser AudioHlsRenditionSelection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioHlsRenditionSelection"
      ( \Object
x ->
          Text -> Text -> AudioHlsRenditionSelection
AudioHlsRenditionSelection'
            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
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"groupId")
      )

instance Prelude.Hashable AudioHlsRenditionSelection where
  hashWithSalt :: Int -> AudioHlsRenditionSelection -> Int
hashWithSalt Int
_salt AudioHlsRenditionSelection' {Text
groupId :: Text
name :: Text
$sel:groupId:AudioHlsRenditionSelection' :: AudioHlsRenditionSelection -> Text
$sel:name:AudioHlsRenditionSelection' :: AudioHlsRenditionSelection -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId

instance Prelude.NFData AudioHlsRenditionSelection where
  rnf :: AudioHlsRenditionSelection -> ()
rnf AudioHlsRenditionSelection' {Text
groupId :: Text
name :: Text
$sel:groupId:AudioHlsRenditionSelection' :: AudioHlsRenditionSelection -> Text
$sel:name:AudioHlsRenditionSelection' :: AudioHlsRenditionSelection -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
groupId

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