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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.LanguageCode
import qualified Amazonka.Prelude as Prelude

-- | Settings specific to audio sources in an HLS alternate rendition group.
-- Specify the properties (renditionGroupId, renditionName or
-- renditionLanguageCode) to identify the unique audio track among the
-- alternative rendition groups present in the HLS manifest. If no unique
-- track is found, or multiple tracks match the properties provided, the
-- job fails. If no properties in hlsRenditionGroupSettings are specified,
-- the default audio track within the video segment is chosen. If there is
-- no audio within video segment, the alternative audio with DEFAULT=YES is
-- chosen instead.
--
-- /See:/ 'newHlsRenditionGroupSettings' smart constructor.
data HlsRenditionGroupSettings = HlsRenditionGroupSettings'
  { -- | Optional. Specify media name
    HlsRenditionGroupSettings -> Maybe Text
renditionName :: Prelude.Maybe Prelude.Text,
    -- | Optional. Specify alternative group ID
    HlsRenditionGroupSettings -> Maybe Text
renditionGroupId :: Prelude.Maybe Prelude.Text,
    -- | Optional. Specify ISO 639-2 or ISO 639-3 code in the language property
    HlsRenditionGroupSettings -> Maybe LanguageCode
renditionLanguageCode :: Prelude.Maybe LanguageCode
  }
  deriving (HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool
(HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool)
-> (HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool)
-> Eq HlsRenditionGroupSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool
$c/= :: HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool
== :: HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool
$c== :: HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool
Prelude.Eq, ReadPrec [HlsRenditionGroupSettings]
ReadPrec HlsRenditionGroupSettings
Int -> ReadS HlsRenditionGroupSettings
ReadS [HlsRenditionGroupSettings]
(Int -> ReadS HlsRenditionGroupSettings)
-> ReadS [HlsRenditionGroupSettings]
-> ReadPrec HlsRenditionGroupSettings
-> ReadPrec [HlsRenditionGroupSettings]
-> Read HlsRenditionGroupSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsRenditionGroupSettings]
$creadListPrec :: ReadPrec [HlsRenditionGroupSettings]
readPrec :: ReadPrec HlsRenditionGroupSettings
$creadPrec :: ReadPrec HlsRenditionGroupSettings
readList :: ReadS [HlsRenditionGroupSettings]
$creadList :: ReadS [HlsRenditionGroupSettings]
readsPrec :: Int -> ReadS HlsRenditionGroupSettings
$creadsPrec :: Int -> ReadS HlsRenditionGroupSettings
Prelude.Read, Int -> HlsRenditionGroupSettings -> ShowS
[HlsRenditionGroupSettings] -> ShowS
HlsRenditionGroupSettings -> String
(Int -> HlsRenditionGroupSettings -> ShowS)
-> (HlsRenditionGroupSettings -> String)
-> ([HlsRenditionGroupSettings] -> ShowS)
-> Show HlsRenditionGroupSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsRenditionGroupSettings] -> ShowS
$cshowList :: [HlsRenditionGroupSettings] -> ShowS
show :: HlsRenditionGroupSettings -> String
$cshow :: HlsRenditionGroupSettings -> String
showsPrec :: Int -> HlsRenditionGroupSettings -> ShowS
$cshowsPrec :: Int -> HlsRenditionGroupSettings -> ShowS
Prelude.Show, (forall x.
 HlsRenditionGroupSettings -> Rep HlsRenditionGroupSettings x)
-> (forall x.
    Rep HlsRenditionGroupSettings x -> HlsRenditionGroupSettings)
-> Generic HlsRenditionGroupSettings
forall x.
Rep HlsRenditionGroupSettings x -> HlsRenditionGroupSettings
forall x.
HlsRenditionGroupSettings -> Rep HlsRenditionGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HlsRenditionGroupSettings x -> HlsRenditionGroupSettings
$cfrom :: forall x.
HlsRenditionGroupSettings -> Rep HlsRenditionGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'HlsRenditionGroupSettings' 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:
--
-- 'renditionName', 'hlsRenditionGroupSettings_renditionName' - Optional. Specify media name
--
-- 'renditionGroupId', 'hlsRenditionGroupSettings_renditionGroupId' - Optional. Specify alternative group ID
--
-- 'renditionLanguageCode', 'hlsRenditionGroupSettings_renditionLanguageCode' - Optional. Specify ISO 639-2 or ISO 639-3 code in the language property
newHlsRenditionGroupSettings ::
  HlsRenditionGroupSettings
newHlsRenditionGroupSettings :: HlsRenditionGroupSettings
newHlsRenditionGroupSettings =
  HlsRenditionGroupSettings' :: Maybe Text
-> Maybe Text -> Maybe LanguageCode -> HlsRenditionGroupSettings
HlsRenditionGroupSettings'
    { $sel:renditionName:HlsRenditionGroupSettings' :: Maybe Text
renditionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:renditionGroupId:HlsRenditionGroupSettings' :: Maybe Text
renditionGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:renditionLanguageCode:HlsRenditionGroupSettings' :: Maybe LanguageCode
renditionLanguageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing
    }

-- | Optional. Specify media name
hlsRenditionGroupSettings_renditionName :: Lens.Lens' HlsRenditionGroupSettings (Prelude.Maybe Prelude.Text)
hlsRenditionGroupSettings_renditionName :: (Maybe Text -> f (Maybe Text))
-> HlsRenditionGroupSettings -> f HlsRenditionGroupSettings
hlsRenditionGroupSettings_renditionName = (HlsRenditionGroupSettings -> Maybe Text)
-> (HlsRenditionGroupSettings
    -> Maybe Text -> HlsRenditionGroupSettings)
-> Lens
     HlsRenditionGroupSettings
     HlsRenditionGroupSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsRenditionGroupSettings' {Maybe Text
renditionName :: Maybe Text
$sel:renditionName:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
renditionName} -> Maybe Text
renditionName) (\s :: HlsRenditionGroupSettings
s@HlsRenditionGroupSettings' {} Maybe Text
a -> HlsRenditionGroupSettings
s {$sel:renditionName:HlsRenditionGroupSettings' :: Maybe Text
renditionName = Maybe Text
a} :: HlsRenditionGroupSettings)

-- | Optional. Specify alternative group ID
hlsRenditionGroupSettings_renditionGroupId :: Lens.Lens' HlsRenditionGroupSettings (Prelude.Maybe Prelude.Text)
hlsRenditionGroupSettings_renditionGroupId :: (Maybe Text -> f (Maybe Text))
-> HlsRenditionGroupSettings -> f HlsRenditionGroupSettings
hlsRenditionGroupSettings_renditionGroupId = (HlsRenditionGroupSettings -> Maybe Text)
-> (HlsRenditionGroupSettings
    -> Maybe Text -> HlsRenditionGroupSettings)
-> Lens
     HlsRenditionGroupSettings
     HlsRenditionGroupSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsRenditionGroupSettings' {Maybe Text
renditionGroupId :: Maybe Text
$sel:renditionGroupId:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
renditionGroupId} -> Maybe Text
renditionGroupId) (\s :: HlsRenditionGroupSettings
s@HlsRenditionGroupSettings' {} Maybe Text
a -> HlsRenditionGroupSettings
s {$sel:renditionGroupId:HlsRenditionGroupSettings' :: Maybe Text
renditionGroupId = Maybe Text
a} :: HlsRenditionGroupSettings)

-- | Optional. Specify ISO 639-2 or ISO 639-3 code in the language property
hlsRenditionGroupSettings_renditionLanguageCode :: Lens.Lens' HlsRenditionGroupSettings (Prelude.Maybe LanguageCode)
hlsRenditionGroupSettings_renditionLanguageCode :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> HlsRenditionGroupSettings -> f HlsRenditionGroupSettings
hlsRenditionGroupSettings_renditionLanguageCode = (HlsRenditionGroupSettings -> Maybe LanguageCode)
-> (HlsRenditionGroupSettings
    -> Maybe LanguageCode -> HlsRenditionGroupSettings)
-> Lens
     HlsRenditionGroupSettings
     HlsRenditionGroupSettings
     (Maybe LanguageCode)
     (Maybe LanguageCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsRenditionGroupSettings' {Maybe LanguageCode
renditionLanguageCode :: Maybe LanguageCode
$sel:renditionLanguageCode:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe LanguageCode
renditionLanguageCode} -> Maybe LanguageCode
renditionLanguageCode) (\s :: HlsRenditionGroupSettings
s@HlsRenditionGroupSettings' {} Maybe LanguageCode
a -> HlsRenditionGroupSettings
s {$sel:renditionLanguageCode:HlsRenditionGroupSettings' :: Maybe LanguageCode
renditionLanguageCode = Maybe LanguageCode
a} :: HlsRenditionGroupSettings)

instance Core.FromJSON HlsRenditionGroupSettings where
  parseJSON :: Value -> Parser HlsRenditionGroupSettings
parseJSON =
    String
-> (Object -> Parser HlsRenditionGroupSettings)
-> Value
-> Parser HlsRenditionGroupSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsRenditionGroupSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe LanguageCode -> HlsRenditionGroupSettings
HlsRenditionGroupSettings'
            (Maybe Text
 -> Maybe Text -> Maybe LanguageCode -> HlsRenditionGroupSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe LanguageCode -> HlsRenditionGroupSettings)
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
"renditionName")
            Parser
  (Maybe Text -> Maybe LanguageCode -> HlsRenditionGroupSettings)
-> Parser (Maybe Text)
-> Parser (Maybe LanguageCode -> HlsRenditionGroupSettings)
forall (f :: * -> *) a b. Applicative f => 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
"renditionGroupId")
            Parser (Maybe LanguageCode -> HlsRenditionGroupSettings)
-> Parser (Maybe LanguageCode) -> Parser HlsRenditionGroupSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LanguageCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"renditionLanguageCode")
      )

instance Prelude.Hashable HlsRenditionGroupSettings

instance Prelude.NFData HlsRenditionGroupSettings

instance Core.ToJSON HlsRenditionGroupSettings where
  toJSON :: HlsRenditionGroupSettings -> Value
toJSON HlsRenditionGroupSettings' {Maybe Text
Maybe LanguageCode
renditionLanguageCode :: Maybe LanguageCode
renditionGroupId :: Maybe Text
renditionName :: Maybe Text
$sel:renditionLanguageCode:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe LanguageCode
$sel:renditionGroupId:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
$sel:renditionName:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"renditionName" 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
renditionName,
            (Text
"renditionGroupId" 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
renditionGroupId,
            (Text
"renditionLanguageCode" Text -> LanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LanguageCode -> Pair) -> Maybe LanguageCode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LanguageCode
renditionLanguageCode
          ]
      )