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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specify the details for each additional HLS manifest that you want the
-- service to generate for this output group. Each manifest can reference a
-- different subset of outputs in the group.
--
-- /See:/ 'newHlsAdditionalManifest' smart constructor.
data HlsAdditionalManifest = HlsAdditionalManifest'
  { -- | Specify a name modifier that the service adds to the name of this
    -- manifest to make it different from the file names of the other main
    -- manifests in the output group. For example, say that the default main
    -- manifest for your HLS group is film-name.m3u8. If you enter
    -- \"-no-premium\" for this setting, then the file name the service
    -- generates for this top-level manifest is film-name-no-premium.m3u8. For
    -- HLS output groups, specify a manifestNameModifier that is different from
    -- the nameModifier of the output. The service uses the output name
    -- modifier to create unique names for the individual variant manifests.
    HlsAdditionalManifest -> Maybe Text
manifestNameModifier :: Prelude.Maybe Prelude.Text,
    -- | Specify the outputs that you want this additional top-level manifest to
    -- reference.
    HlsAdditionalManifest -> Maybe [Text]
selectedOutputs :: Prelude.Maybe [Prelude.Text]
  }
  deriving (HlsAdditionalManifest -> HlsAdditionalManifest -> Bool
(HlsAdditionalManifest -> HlsAdditionalManifest -> Bool)
-> (HlsAdditionalManifest -> HlsAdditionalManifest -> Bool)
-> Eq HlsAdditionalManifest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsAdditionalManifest -> HlsAdditionalManifest -> Bool
$c/= :: HlsAdditionalManifest -> HlsAdditionalManifest -> Bool
== :: HlsAdditionalManifest -> HlsAdditionalManifest -> Bool
$c== :: HlsAdditionalManifest -> HlsAdditionalManifest -> Bool
Prelude.Eq, ReadPrec [HlsAdditionalManifest]
ReadPrec HlsAdditionalManifest
Int -> ReadS HlsAdditionalManifest
ReadS [HlsAdditionalManifest]
(Int -> ReadS HlsAdditionalManifest)
-> ReadS [HlsAdditionalManifest]
-> ReadPrec HlsAdditionalManifest
-> ReadPrec [HlsAdditionalManifest]
-> Read HlsAdditionalManifest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsAdditionalManifest]
$creadListPrec :: ReadPrec [HlsAdditionalManifest]
readPrec :: ReadPrec HlsAdditionalManifest
$creadPrec :: ReadPrec HlsAdditionalManifest
readList :: ReadS [HlsAdditionalManifest]
$creadList :: ReadS [HlsAdditionalManifest]
readsPrec :: Int -> ReadS HlsAdditionalManifest
$creadsPrec :: Int -> ReadS HlsAdditionalManifest
Prelude.Read, Int -> HlsAdditionalManifest -> ShowS
[HlsAdditionalManifest] -> ShowS
HlsAdditionalManifest -> String
(Int -> HlsAdditionalManifest -> ShowS)
-> (HlsAdditionalManifest -> String)
-> ([HlsAdditionalManifest] -> ShowS)
-> Show HlsAdditionalManifest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsAdditionalManifest] -> ShowS
$cshowList :: [HlsAdditionalManifest] -> ShowS
show :: HlsAdditionalManifest -> String
$cshow :: HlsAdditionalManifest -> String
showsPrec :: Int -> HlsAdditionalManifest -> ShowS
$cshowsPrec :: Int -> HlsAdditionalManifest -> ShowS
Prelude.Show, (forall x. HlsAdditionalManifest -> Rep HlsAdditionalManifest x)
-> (forall x. Rep HlsAdditionalManifest x -> HlsAdditionalManifest)
-> Generic HlsAdditionalManifest
forall x. Rep HlsAdditionalManifest x -> HlsAdditionalManifest
forall x. HlsAdditionalManifest -> Rep HlsAdditionalManifest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsAdditionalManifest x -> HlsAdditionalManifest
$cfrom :: forall x. HlsAdditionalManifest -> Rep HlsAdditionalManifest x
Prelude.Generic)

-- |
-- Create a value of 'HlsAdditionalManifest' 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:
--
-- 'manifestNameModifier', 'hlsAdditionalManifest_manifestNameModifier' - Specify a name modifier that the service adds to the name of this
-- manifest to make it different from the file names of the other main
-- manifests in the output group. For example, say that the default main
-- manifest for your HLS group is film-name.m3u8. If you enter
-- \"-no-premium\" for this setting, then the file name the service
-- generates for this top-level manifest is film-name-no-premium.m3u8. For
-- HLS output groups, specify a manifestNameModifier that is different from
-- the nameModifier of the output. The service uses the output name
-- modifier to create unique names for the individual variant manifests.
--
-- 'selectedOutputs', 'hlsAdditionalManifest_selectedOutputs' - Specify the outputs that you want this additional top-level manifest to
-- reference.
newHlsAdditionalManifest ::
  HlsAdditionalManifest
newHlsAdditionalManifest :: HlsAdditionalManifest
newHlsAdditionalManifest =
  HlsAdditionalManifest' :: Maybe Text -> Maybe [Text] -> HlsAdditionalManifest
HlsAdditionalManifest'
    { $sel:manifestNameModifier:HlsAdditionalManifest' :: Maybe Text
manifestNameModifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:selectedOutputs:HlsAdditionalManifest' :: Maybe [Text]
selectedOutputs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify a name modifier that the service adds to the name of this
-- manifest to make it different from the file names of the other main
-- manifests in the output group. For example, say that the default main
-- manifest for your HLS group is film-name.m3u8. If you enter
-- \"-no-premium\" for this setting, then the file name the service
-- generates for this top-level manifest is film-name-no-premium.m3u8. For
-- HLS output groups, specify a manifestNameModifier that is different from
-- the nameModifier of the output. The service uses the output name
-- modifier to create unique names for the individual variant manifests.
hlsAdditionalManifest_manifestNameModifier :: Lens.Lens' HlsAdditionalManifest (Prelude.Maybe Prelude.Text)
hlsAdditionalManifest_manifestNameModifier :: (Maybe Text -> f (Maybe Text))
-> HlsAdditionalManifest -> f HlsAdditionalManifest
hlsAdditionalManifest_manifestNameModifier = (HlsAdditionalManifest -> Maybe Text)
-> (HlsAdditionalManifest -> Maybe Text -> HlsAdditionalManifest)
-> Lens
     HlsAdditionalManifest
     HlsAdditionalManifest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsAdditionalManifest' {Maybe Text
manifestNameModifier :: Maybe Text
$sel:manifestNameModifier:HlsAdditionalManifest' :: HlsAdditionalManifest -> Maybe Text
manifestNameModifier} -> Maybe Text
manifestNameModifier) (\s :: HlsAdditionalManifest
s@HlsAdditionalManifest' {} Maybe Text
a -> HlsAdditionalManifest
s {$sel:manifestNameModifier:HlsAdditionalManifest' :: Maybe Text
manifestNameModifier = Maybe Text
a} :: HlsAdditionalManifest)

-- | Specify the outputs that you want this additional top-level manifest to
-- reference.
hlsAdditionalManifest_selectedOutputs :: Lens.Lens' HlsAdditionalManifest (Prelude.Maybe [Prelude.Text])
hlsAdditionalManifest_selectedOutputs :: (Maybe [Text] -> f (Maybe [Text]))
-> HlsAdditionalManifest -> f HlsAdditionalManifest
hlsAdditionalManifest_selectedOutputs = (HlsAdditionalManifest -> Maybe [Text])
-> (HlsAdditionalManifest -> Maybe [Text] -> HlsAdditionalManifest)
-> Lens
     HlsAdditionalManifest
     HlsAdditionalManifest
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsAdditionalManifest' {Maybe [Text]
selectedOutputs :: Maybe [Text]
$sel:selectedOutputs:HlsAdditionalManifest' :: HlsAdditionalManifest -> Maybe [Text]
selectedOutputs} -> Maybe [Text]
selectedOutputs) (\s :: HlsAdditionalManifest
s@HlsAdditionalManifest' {} Maybe [Text]
a -> HlsAdditionalManifest
s {$sel:selectedOutputs:HlsAdditionalManifest' :: Maybe [Text]
selectedOutputs = Maybe [Text]
a} :: HlsAdditionalManifest) ((Maybe [Text] -> f (Maybe [Text]))
 -> HlsAdditionalManifest -> f HlsAdditionalManifest)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> HlsAdditionalManifest
-> f HlsAdditionalManifest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON HlsAdditionalManifest where
  parseJSON :: Value -> Parser HlsAdditionalManifest
parseJSON =
    String
-> (Object -> Parser HlsAdditionalManifest)
-> Value
-> Parser HlsAdditionalManifest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsAdditionalManifest"
      ( \Object
x ->
          Maybe Text -> Maybe [Text] -> HlsAdditionalManifest
HlsAdditionalManifest'
            (Maybe Text -> Maybe [Text] -> HlsAdditionalManifest)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> HlsAdditionalManifest)
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
"manifestNameModifier")
            Parser (Maybe [Text] -> HlsAdditionalManifest)
-> Parser (Maybe [Text]) -> Parser HlsAdditionalManifest
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"selectedOutputs"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable HlsAdditionalManifest

instance Prelude.NFData HlsAdditionalManifest

instance Core.ToJSON HlsAdditionalManifest where
  toJSON :: HlsAdditionalManifest -> Value
toJSON HlsAdditionalManifest' {Maybe [Text]
Maybe Text
selectedOutputs :: Maybe [Text]
manifestNameModifier :: Maybe Text
$sel:selectedOutputs:HlsAdditionalManifest' :: HlsAdditionalManifest -> Maybe [Text]
$sel:manifestNameModifier:HlsAdditionalManifest' :: HlsAdditionalManifest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"manifestNameModifier" 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
manifestNameModifier,
            (Text
"selectedOutputs" 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]
selectedOutputs
          ]
      )