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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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,
    -- | Optional. Specify media name
    HlsRenditionGroupSettings -> Maybe Text
renditionName :: Prelude.Maybe Prelude.Text
  }
  deriving (HlsRenditionGroupSettings -> HlsRenditionGroupSettings -> Bool
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]
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
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.
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:
--
-- '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
--
-- 'renditionName', 'hlsRenditionGroupSettings_renditionName' - Optional. Specify media name
newHlsRenditionGroupSettings ::
  HlsRenditionGroupSettings
newHlsRenditionGroupSettings :: HlsRenditionGroupSettings
newHlsRenditionGroupSettings =
  HlsRenditionGroupSettings'
    { $sel:renditionGroupId:HlsRenditionGroupSettings' :: Maybe Text
renditionGroupId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:renditionLanguageCode:HlsRenditionGroupSettings' :: Maybe LanguageCode
renditionLanguageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:renditionName:HlsRenditionGroupSettings' :: Maybe Text
renditionName = forall a. Maybe a
Prelude.Nothing
    }

-- | Optional. Specify alternative group ID
hlsRenditionGroupSettings_renditionGroupId :: Lens.Lens' HlsRenditionGroupSettings (Prelude.Maybe Prelude.Text)
hlsRenditionGroupSettings_renditionGroupId :: Lens' HlsRenditionGroupSettings (Maybe Text)
hlsRenditionGroupSettings_renditionGroupId = 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 :: Lens' HlsRenditionGroupSettings (Maybe LanguageCode)
hlsRenditionGroupSettings_renditionLanguageCode = 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)

-- | Optional. Specify media name
hlsRenditionGroupSettings_renditionName :: Lens.Lens' HlsRenditionGroupSettings (Prelude.Maybe Prelude.Text)
hlsRenditionGroupSettings_renditionName :: Lens' HlsRenditionGroupSettings (Maybe Text)
hlsRenditionGroupSettings_renditionName = 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)

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

instance Prelude.Hashable HlsRenditionGroupSettings where
  hashWithSalt :: Int -> HlsRenditionGroupSettings -> Int
hashWithSalt Int
_salt HlsRenditionGroupSettings' {Maybe Text
Maybe LanguageCode
renditionName :: Maybe Text
renditionLanguageCode :: Maybe LanguageCode
renditionGroupId :: Maybe Text
$sel:renditionName:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
$sel:renditionLanguageCode:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe LanguageCode
$sel:renditionGroupId:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
renditionGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LanguageCode
renditionLanguageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
renditionName

instance Prelude.NFData HlsRenditionGroupSettings where
  rnf :: HlsRenditionGroupSettings -> ()
rnf HlsRenditionGroupSettings' {Maybe Text
Maybe LanguageCode
renditionName :: Maybe Text
renditionLanguageCode :: Maybe LanguageCode
renditionGroupId :: Maybe Text
$sel:renditionName:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
$sel:renditionLanguageCode:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe LanguageCode
$sel:renditionGroupId:HlsRenditionGroupSettings' :: HlsRenditionGroupSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
renditionGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LanguageCode
renditionLanguageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
renditionName

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