{-# 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.StandardHlsSettings
-- 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.MediaLive.Types.StandardHlsSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.M3u8Settings
import qualified Amazonka.Prelude as Prelude

-- | Standard Hls Settings
--
-- /See:/ 'newStandardHlsSettings' smart constructor.
data StandardHlsSettings = StandardHlsSettings'
  { -- | List all the audio groups that are used with the video output stream.
    -- Input all the audio GROUP-IDs that are associated to the video, separate
    -- by \',\'.
    StandardHlsSettings -> Maybe Text
audioRenditionSets :: Prelude.Maybe Prelude.Text,
    StandardHlsSettings -> M3u8Settings
m3u8Settings :: M3u8Settings
  }
  deriving (StandardHlsSettings -> StandardHlsSettings -> Bool
(StandardHlsSettings -> StandardHlsSettings -> Bool)
-> (StandardHlsSettings -> StandardHlsSettings -> Bool)
-> Eq StandardHlsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StandardHlsSettings -> StandardHlsSettings -> Bool
$c/= :: StandardHlsSettings -> StandardHlsSettings -> Bool
== :: StandardHlsSettings -> StandardHlsSettings -> Bool
$c== :: StandardHlsSettings -> StandardHlsSettings -> Bool
Prelude.Eq, ReadPrec [StandardHlsSettings]
ReadPrec StandardHlsSettings
Int -> ReadS StandardHlsSettings
ReadS [StandardHlsSettings]
(Int -> ReadS StandardHlsSettings)
-> ReadS [StandardHlsSettings]
-> ReadPrec StandardHlsSettings
-> ReadPrec [StandardHlsSettings]
-> Read StandardHlsSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StandardHlsSettings]
$creadListPrec :: ReadPrec [StandardHlsSettings]
readPrec :: ReadPrec StandardHlsSettings
$creadPrec :: ReadPrec StandardHlsSettings
readList :: ReadS [StandardHlsSettings]
$creadList :: ReadS [StandardHlsSettings]
readsPrec :: Int -> ReadS StandardHlsSettings
$creadsPrec :: Int -> ReadS StandardHlsSettings
Prelude.Read, Int -> StandardHlsSettings -> ShowS
[StandardHlsSettings] -> ShowS
StandardHlsSettings -> String
(Int -> StandardHlsSettings -> ShowS)
-> (StandardHlsSettings -> String)
-> ([StandardHlsSettings] -> ShowS)
-> Show StandardHlsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StandardHlsSettings] -> ShowS
$cshowList :: [StandardHlsSettings] -> ShowS
show :: StandardHlsSettings -> String
$cshow :: StandardHlsSettings -> String
showsPrec :: Int -> StandardHlsSettings -> ShowS
$cshowsPrec :: Int -> StandardHlsSettings -> ShowS
Prelude.Show, (forall x. StandardHlsSettings -> Rep StandardHlsSettings x)
-> (forall x. Rep StandardHlsSettings x -> StandardHlsSettings)
-> Generic StandardHlsSettings
forall x. Rep StandardHlsSettings x -> StandardHlsSettings
forall x. StandardHlsSettings -> Rep StandardHlsSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StandardHlsSettings x -> StandardHlsSettings
$cfrom :: forall x. StandardHlsSettings -> Rep StandardHlsSettings x
Prelude.Generic)

-- |
-- Create a value of 'StandardHlsSettings' 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:
--
-- 'audioRenditionSets', 'standardHlsSettings_audioRenditionSets' - List all the audio groups that are used with the video output stream.
-- Input all the audio GROUP-IDs that are associated to the video, separate
-- by \',\'.
--
-- 'm3u8Settings', 'standardHlsSettings_m3u8Settings' - Undocumented member.
newStandardHlsSettings ::
  -- | 'm3u8Settings'
  M3u8Settings ->
  StandardHlsSettings
newStandardHlsSettings :: M3u8Settings -> StandardHlsSettings
newStandardHlsSettings M3u8Settings
pM3u8Settings_ =
  StandardHlsSettings' :: Maybe Text -> M3u8Settings -> StandardHlsSettings
StandardHlsSettings'
    { $sel:audioRenditionSets:StandardHlsSettings' :: Maybe Text
audioRenditionSets =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:m3u8Settings:StandardHlsSettings' :: M3u8Settings
m3u8Settings = M3u8Settings
pM3u8Settings_
    }

-- | List all the audio groups that are used with the video output stream.
-- Input all the audio GROUP-IDs that are associated to the video, separate
-- by \',\'.
standardHlsSettings_audioRenditionSets :: Lens.Lens' StandardHlsSettings (Prelude.Maybe Prelude.Text)
standardHlsSettings_audioRenditionSets :: (Maybe Text -> f (Maybe Text))
-> StandardHlsSettings -> f StandardHlsSettings
standardHlsSettings_audioRenditionSets = (StandardHlsSettings -> Maybe Text)
-> (StandardHlsSettings -> Maybe Text -> StandardHlsSettings)
-> Lens
     StandardHlsSettings StandardHlsSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardHlsSettings' {Maybe Text
audioRenditionSets :: Maybe Text
$sel:audioRenditionSets:StandardHlsSettings' :: StandardHlsSettings -> Maybe Text
audioRenditionSets} -> Maybe Text
audioRenditionSets) (\s :: StandardHlsSettings
s@StandardHlsSettings' {} Maybe Text
a -> StandardHlsSettings
s {$sel:audioRenditionSets:StandardHlsSettings' :: Maybe Text
audioRenditionSets = Maybe Text
a} :: StandardHlsSettings)

-- | Undocumented member.
standardHlsSettings_m3u8Settings :: Lens.Lens' StandardHlsSettings M3u8Settings
standardHlsSettings_m3u8Settings :: (M3u8Settings -> f M3u8Settings)
-> StandardHlsSettings -> f StandardHlsSettings
standardHlsSettings_m3u8Settings = (StandardHlsSettings -> M3u8Settings)
-> (StandardHlsSettings -> M3u8Settings -> StandardHlsSettings)
-> Lens
     StandardHlsSettings StandardHlsSettings M3u8Settings M3u8Settings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardHlsSettings' {M3u8Settings
m3u8Settings :: M3u8Settings
$sel:m3u8Settings:StandardHlsSettings' :: StandardHlsSettings -> M3u8Settings
m3u8Settings} -> M3u8Settings
m3u8Settings) (\s :: StandardHlsSettings
s@StandardHlsSettings' {} M3u8Settings
a -> StandardHlsSettings
s {$sel:m3u8Settings:StandardHlsSettings' :: M3u8Settings
m3u8Settings = M3u8Settings
a} :: StandardHlsSettings)

instance Core.FromJSON StandardHlsSettings where
  parseJSON :: Value -> Parser StandardHlsSettings
parseJSON =
    String
-> (Object -> Parser StandardHlsSettings)
-> Value
-> Parser StandardHlsSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StandardHlsSettings"
      ( \Object
x ->
          Maybe Text -> M3u8Settings -> StandardHlsSettings
StandardHlsSettings'
            (Maybe Text -> M3u8Settings -> StandardHlsSettings)
-> Parser (Maybe Text)
-> Parser (M3u8Settings -> StandardHlsSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audioRenditionSets")
            Parser (M3u8Settings -> StandardHlsSettings)
-> Parser M3u8Settings -> Parser StandardHlsSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser M3u8Settings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"m3u8Settings")
      )

instance Prelude.Hashable StandardHlsSettings

instance Prelude.NFData StandardHlsSettings

instance Core.ToJSON StandardHlsSettings where
  toJSON :: StandardHlsSettings -> Value
toJSON StandardHlsSettings' {Maybe Text
M3u8Settings
m3u8Settings :: M3u8Settings
audioRenditionSets :: Maybe Text
$sel:m3u8Settings:StandardHlsSettings' :: StandardHlsSettings -> M3u8Settings
$sel:audioRenditionSets:StandardHlsSettings' :: StandardHlsSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"audioRenditionSets" 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
audioRenditionSets,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"m3u8Settings" Text -> M3u8Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= M3u8Settings
m3u8Settings)
          ]
      )