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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.HlsH265PackagingType
import Amazonka.MediaLive.Types.HlsSettings
import qualified Amazonka.Prelude as Prelude

-- | Hls Output Settings
--
-- /See:/ 'newHlsOutputSettings' smart constructor.
data HlsOutputSettings = HlsOutputSettings'
  { -- | Only applicable when this output is referencing an H.265 video
    -- description. Specifies whether MP4 segments should be packaged as HEV1
    -- or HVC1.
    HlsOutputSettings -> Maybe HlsH265PackagingType
h265PackagingType :: Prelude.Maybe HlsH265PackagingType,
    -- | String concatenated to the end of the destination filename. Accepts
    -- \\\"Format Identifiers\\\":#formatIdentifierParameters.
    HlsOutputSettings -> Maybe Text
nameModifier :: Prelude.Maybe Prelude.Text,
    -- | String concatenated to end of segment filenames.
    HlsOutputSettings -> Maybe Text
segmentModifier :: Prelude.Maybe Prelude.Text,
    -- | Settings regarding the underlying stream. These settings are different
    -- for audio-only outputs.
    HlsOutputSettings -> HlsSettings
hlsSettings :: HlsSettings
  }
  deriving (HlsOutputSettings -> HlsOutputSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsOutputSettings -> HlsOutputSettings -> Bool
$c/= :: HlsOutputSettings -> HlsOutputSettings -> Bool
== :: HlsOutputSettings -> HlsOutputSettings -> Bool
$c== :: HlsOutputSettings -> HlsOutputSettings -> Bool
Prelude.Eq, ReadPrec [HlsOutputSettings]
ReadPrec HlsOutputSettings
Int -> ReadS HlsOutputSettings
ReadS [HlsOutputSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsOutputSettings]
$creadListPrec :: ReadPrec [HlsOutputSettings]
readPrec :: ReadPrec HlsOutputSettings
$creadPrec :: ReadPrec HlsOutputSettings
readList :: ReadS [HlsOutputSettings]
$creadList :: ReadS [HlsOutputSettings]
readsPrec :: Int -> ReadS HlsOutputSettings
$creadsPrec :: Int -> ReadS HlsOutputSettings
Prelude.Read, Int -> HlsOutputSettings -> ShowS
[HlsOutputSettings] -> ShowS
HlsOutputSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsOutputSettings] -> ShowS
$cshowList :: [HlsOutputSettings] -> ShowS
show :: HlsOutputSettings -> String
$cshow :: HlsOutputSettings -> String
showsPrec :: Int -> HlsOutputSettings -> ShowS
$cshowsPrec :: Int -> HlsOutputSettings -> ShowS
Prelude.Show, forall x. Rep HlsOutputSettings x -> HlsOutputSettings
forall x. HlsOutputSettings -> Rep HlsOutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsOutputSettings x -> HlsOutputSettings
$cfrom :: forall x. HlsOutputSettings -> Rep HlsOutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'HlsOutputSettings' 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:
--
-- 'h265PackagingType', 'hlsOutputSettings_h265PackagingType' - Only applicable when this output is referencing an H.265 video
-- description. Specifies whether MP4 segments should be packaged as HEV1
-- or HVC1.
--
-- 'nameModifier', 'hlsOutputSettings_nameModifier' - String concatenated to the end of the destination filename. Accepts
-- \\\"Format Identifiers\\\":#formatIdentifierParameters.
--
-- 'segmentModifier', 'hlsOutputSettings_segmentModifier' - String concatenated to end of segment filenames.
--
-- 'hlsSettings', 'hlsOutputSettings_hlsSettings' - Settings regarding the underlying stream. These settings are different
-- for audio-only outputs.
newHlsOutputSettings ::
  -- | 'hlsSettings'
  HlsSettings ->
  HlsOutputSettings
newHlsOutputSettings :: HlsSettings -> HlsOutputSettings
newHlsOutputSettings HlsSettings
pHlsSettings_ =
  HlsOutputSettings'
    { $sel:h265PackagingType:HlsOutputSettings' :: Maybe HlsH265PackagingType
h265PackagingType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nameModifier:HlsOutputSettings' :: Maybe Text
nameModifier = forall a. Maybe a
Prelude.Nothing,
      $sel:segmentModifier:HlsOutputSettings' :: Maybe Text
segmentModifier = forall a. Maybe a
Prelude.Nothing,
      $sel:hlsSettings:HlsOutputSettings' :: HlsSettings
hlsSettings = HlsSettings
pHlsSettings_
    }

-- | Only applicable when this output is referencing an H.265 video
-- description. Specifies whether MP4 segments should be packaged as HEV1
-- or HVC1.
hlsOutputSettings_h265PackagingType :: Lens.Lens' HlsOutputSettings (Prelude.Maybe HlsH265PackagingType)
hlsOutputSettings_h265PackagingType :: Lens' HlsOutputSettings (Maybe HlsH265PackagingType)
hlsOutputSettings_h265PackagingType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {Maybe HlsH265PackagingType
h265PackagingType :: Maybe HlsH265PackagingType
$sel:h265PackagingType:HlsOutputSettings' :: HlsOutputSettings -> Maybe HlsH265PackagingType
h265PackagingType} -> Maybe HlsH265PackagingType
h265PackagingType) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} Maybe HlsH265PackagingType
a -> HlsOutputSettings
s {$sel:h265PackagingType:HlsOutputSettings' :: Maybe HlsH265PackagingType
h265PackagingType = Maybe HlsH265PackagingType
a} :: HlsOutputSettings)

-- | String concatenated to the end of the destination filename. Accepts
-- \\\"Format Identifiers\\\":#formatIdentifierParameters.
hlsOutputSettings_nameModifier :: Lens.Lens' HlsOutputSettings (Prelude.Maybe Prelude.Text)
hlsOutputSettings_nameModifier :: Lens' HlsOutputSettings (Maybe Text)
hlsOutputSettings_nameModifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {Maybe Text
nameModifier :: Maybe Text
$sel:nameModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
nameModifier} -> Maybe Text
nameModifier) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} Maybe Text
a -> HlsOutputSettings
s {$sel:nameModifier:HlsOutputSettings' :: Maybe Text
nameModifier = Maybe Text
a} :: HlsOutputSettings)

-- | String concatenated to end of segment filenames.
hlsOutputSettings_segmentModifier :: Lens.Lens' HlsOutputSettings (Prelude.Maybe Prelude.Text)
hlsOutputSettings_segmentModifier :: Lens' HlsOutputSettings (Maybe Text)
hlsOutputSettings_segmentModifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {Maybe Text
segmentModifier :: Maybe Text
$sel:segmentModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
segmentModifier} -> Maybe Text
segmentModifier) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} Maybe Text
a -> HlsOutputSettings
s {$sel:segmentModifier:HlsOutputSettings' :: Maybe Text
segmentModifier = Maybe Text
a} :: HlsOutputSettings)

-- | Settings regarding the underlying stream. These settings are different
-- for audio-only outputs.
hlsOutputSettings_hlsSettings :: Lens.Lens' HlsOutputSettings HlsSettings
hlsOutputSettings_hlsSettings :: Lens' HlsOutputSettings HlsSettings
hlsOutputSettings_hlsSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {HlsSettings
hlsSettings :: HlsSettings
$sel:hlsSettings:HlsOutputSettings' :: HlsOutputSettings -> HlsSettings
hlsSettings} -> HlsSettings
hlsSettings) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} HlsSettings
a -> HlsOutputSettings
s {$sel:hlsSettings:HlsOutputSettings' :: HlsSettings
hlsSettings = HlsSettings
a} :: HlsOutputSettings)

instance Data.FromJSON HlsOutputSettings where
  parseJSON :: Value -> Parser HlsOutputSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HlsOutputSettings"
      ( \Object
x ->
          Maybe HlsH265PackagingType
-> Maybe Text -> Maybe Text -> HlsSettings -> HlsOutputSettings
HlsOutputSettings'
            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
"h265PackagingType")
            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
"nameModifier")
            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
"segmentModifier")
            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
"hlsSettings")
      )

instance Prelude.Hashable HlsOutputSettings where
  hashWithSalt :: Int -> HlsOutputSettings -> Int
hashWithSalt Int
_salt HlsOutputSettings' {Maybe Text
Maybe HlsH265PackagingType
HlsSettings
hlsSettings :: HlsSettings
segmentModifier :: Maybe Text
nameModifier :: Maybe Text
h265PackagingType :: Maybe HlsH265PackagingType
$sel:hlsSettings:HlsOutputSettings' :: HlsOutputSettings -> HlsSettings
$sel:segmentModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:nameModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:h265PackagingType:HlsOutputSettings' :: HlsOutputSettings -> Maybe HlsH265PackagingType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HlsH265PackagingType
h265PackagingType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nameModifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
segmentModifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HlsSettings
hlsSettings

instance Prelude.NFData HlsOutputSettings where
  rnf :: HlsOutputSettings -> ()
rnf HlsOutputSettings' {Maybe Text
Maybe HlsH265PackagingType
HlsSettings
hlsSettings :: HlsSettings
segmentModifier :: Maybe Text
nameModifier :: Maybe Text
h265PackagingType :: Maybe HlsH265PackagingType
$sel:hlsSettings:HlsOutputSettings' :: HlsOutputSettings -> HlsSettings
$sel:segmentModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:nameModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:h265PackagingType:HlsOutputSettings' :: HlsOutputSettings -> Maybe HlsH265PackagingType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HlsH265PackagingType
h265PackagingType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nameModifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
segmentModifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HlsSettings
hlsSettings

instance Data.ToJSON HlsOutputSettings where
  toJSON :: HlsOutputSettings -> Value
toJSON HlsOutputSettings' {Maybe Text
Maybe HlsH265PackagingType
HlsSettings
hlsSettings :: HlsSettings
segmentModifier :: Maybe Text
nameModifier :: Maybe Text
h265PackagingType :: Maybe HlsH265PackagingType
$sel:hlsSettings:HlsOutputSettings' :: HlsOutputSettings -> HlsSettings
$sel:segmentModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:nameModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:h265PackagingType:HlsOutputSettings' :: HlsOutputSettings -> Maybe HlsH265PackagingType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"h265PackagingType" 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 HlsH265PackagingType
h265PackagingType,
            (Key
"nameModifier" 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
nameModifier,
            (Key
"segmentModifier" 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
segmentModifier,
            forall a. a -> Maybe a
Prelude.Just (Key
"hlsSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HlsSettings
hlsSettings)
          ]
      )