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

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

-- | Specify the details for each pair of HLS and DASH additional manifests
-- that you want the service to generate for this CMAF output group. Each
-- pair of manifests can reference a different subset of outputs in the
-- group.
--
-- /See:/ 'newCmafAdditionalManifest' smart constructor.
data CmafAdditionalManifest = CmafAdditionalManifest'
  { -- | 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.
    CmafAdditionalManifest -> Maybe Text
manifestNameModifier :: Prelude.Maybe Prelude.Text,
    -- | Specify the outputs that you want this additional top-level manifest to
    -- reference.
    CmafAdditionalManifest -> Maybe [Text]
selectedOutputs :: Prelude.Maybe [Prelude.Text]
  }
  deriving (CmafAdditionalManifest -> CmafAdditionalManifest -> Bool
(CmafAdditionalManifest -> CmafAdditionalManifest -> Bool)
-> (CmafAdditionalManifest -> CmafAdditionalManifest -> Bool)
-> Eq CmafAdditionalManifest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmafAdditionalManifest -> CmafAdditionalManifest -> Bool
$c/= :: CmafAdditionalManifest -> CmafAdditionalManifest -> Bool
== :: CmafAdditionalManifest -> CmafAdditionalManifest -> Bool
$c== :: CmafAdditionalManifest -> CmafAdditionalManifest -> Bool
Prelude.Eq, ReadPrec [CmafAdditionalManifest]
ReadPrec CmafAdditionalManifest
Int -> ReadS CmafAdditionalManifest
ReadS [CmafAdditionalManifest]
(Int -> ReadS CmafAdditionalManifest)
-> ReadS [CmafAdditionalManifest]
-> ReadPrec CmafAdditionalManifest
-> ReadPrec [CmafAdditionalManifest]
-> Read CmafAdditionalManifest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmafAdditionalManifest]
$creadListPrec :: ReadPrec [CmafAdditionalManifest]
readPrec :: ReadPrec CmafAdditionalManifest
$creadPrec :: ReadPrec CmafAdditionalManifest
readList :: ReadS [CmafAdditionalManifest]
$creadList :: ReadS [CmafAdditionalManifest]
readsPrec :: Int -> ReadS CmafAdditionalManifest
$creadsPrec :: Int -> ReadS CmafAdditionalManifest
Prelude.Read, Int -> CmafAdditionalManifest -> ShowS
[CmafAdditionalManifest] -> ShowS
CmafAdditionalManifest -> String
(Int -> CmafAdditionalManifest -> ShowS)
-> (CmafAdditionalManifest -> String)
-> ([CmafAdditionalManifest] -> ShowS)
-> Show CmafAdditionalManifest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmafAdditionalManifest] -> ShowS
$cshowList :: [CmafAdditionalManifest] -> ShowS
show :: CmafAdditionalManifest -> String
$cshow :: CmafAdditionalManifest -> String
showsPrec :: Int -> CmafAdditionalManifest -> ShowS
$cshowsPrec :: Int -> CmafAdditionalManifest -> ShowS
Prelude.Show, (forall x. CmafAdditionalManifest -> Rep CmafAdditionalManifest x)
-> (forall x.
    Rep CmafAdditionalManifest x -> CmafAdditionalManifest)
-> Generic CmafAdditionalManifest
forall x. Rep CmafAdditionalManifest x -> CmafAdditionalManifest
forall x. CmafAdditionalManifest -> Rep CmafAdditionalManifest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CmafAdditionalManifest x -> CmafAdditionalManifest
$cfrom :: forall x. CmafAdditionalManifest -> Rep CmafAdditionalManifest x
Prelude.Generic)

-- |
-- Create a value of 'CmafAdditionalManifest' 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', 'cmafAdditionalManifest_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', 'cmafAdditionalManifest_selectedOutputs' - Specify the outputs that you want this additional top-level manifest to
-- reference.
newCmafAdditionalManifest ::
  CmafAdditionalManifest
newCmafAdditionalManifest :: CmafAdditionalManifest
newCmafAdditionalManifest =
  CmafAdditionalManifest' :: Maybe Text -> Maybe [Text] -> CmafAdditionalManifest
CmafAdditionalManifest'
    { $sel:manifestNameModifier:CmafAdditionalManifest' :: Maybe Text
manifestNameModifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:selectedOutputs:CmafAdditionalManifest' :: 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.
cmafAdditionalManifest_manifestNameModifier :: Lens.Lens' CmafAdditionalManifest (Prelude.Maybe Prelude.Text)
cmafAdditionalManifest_manifestNameModifier :: (Maybe Text -> f (Maybe Text))
-> CmafAdditionalManifest -> f CmafAdditionalManifest
cmafAdditionalManifest_manifestNameModifier = (CmafAdditionalManifest -> Maybe Text)
-> (CmafAdditionalManifest -> Maybe Text -> CmafAdditionalManifest)
-> Lens
     CmafAdditionalManifest
     CmafAdditionalManifest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafAdditionalManifest' {Maybe Text
manifestNameModifier :: Maybe Text
$sel:manifestNameModifier:CmafAdditionalManifest' :: CmafAdditionalManifest -> Maybe Text
manifestNameModifier} -> Maybe Text
manifestNameModifier) (\s :: CmafAdditionalManifest
s@CmafAdditionalManifest' {} Maybe Text
a -> CmafAdditionalManifest
s {$sel:manifestNameModifier:CmafAdditionalManifest' :: Maybe Text
manifestNameModifier = Maybe Text
a} :: CmafAdditionalManifest)

-- | Specify the outputs that you want this additional top-level manifest to
-- reference.
cmafAdditionalManifest_selectedOutputs :: Lens.Lens' CmafAdditionalManifest (Prelude.Maybe [Prelude.Text])
cmafAdditionalManifest_selectedOutputs :: (Maybe [Text] -> f (Maybe [Text]))
-> CmafAdditionalManifest -> f CmafAdditionalManifest
cmafAdditionalManifest_selectedOutputs = (CmafAdditionalManifest -> Maybe [Text])
-> (CmafAdditionalManifest
    -> Maybe [Text] -> CmafAdditionalManifest)
-> Lens
     CmafAdditionalManifest
     CmafAdditionalManifest
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafAdditionalManifest' {Maybe [Text]
selectedOutputs :: Maybe [Text]
$sel:selectedOutputs:CmafAdditionalManifest' :: CmafAdditionalManifest -> Maybe [Text]
selectedOutputs} -> Maybe [Text]
selectedOutputs) (\s :: CmafAdditionalManifest
s@CmafAdditionalManifest' {} Maybe [Text]
a -> CmafAdditionalManifest
s {$sel:selectedOutputs:CmafAdditionalManifest' :: Maybe [Text]
selectedOutputs = Maybe [Text]
a} :: CmafAdditionalManifest) ((Maybe [Text] -> f (Maybe [Text]))
 -> CmafAdditionalManifest -> f CmafAdditionalManifest)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CmafAdditionalManifest
-> f CmafAdditionalManifest
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 CmafAdditionalManifest where
  parseJSON :: Value -> Parser CmafAdditionalManifest
parseJSON =
    String
-> (Object -> Parser CmafAdditionalManifest)
-> Value
-> Parser CmafAdditionalManifest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CmafAdditionalManifest"
      ( \Object
x ->
          Maybe Text -> Maybe [Text] -> CmafAdditionalManifest
CmafAdditionalManifest'
            (Maybe Text -> Maybe [Text] -> CmafAdditionalManifest)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> CmafAdditionalManifest)
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] -> CmafAdditionalManifest)
-> Parser (Maybe [Text]) -> Parser CmafAdditionalManifest
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 CmafAdditionalManifest

instance Prelude.NFData CmafAdditionalManifest

instance Core.ToJSON CmafAdditionalManifest where
  toJSON :: CmafAdditionalManifest -> Value
toJSON CmafAdditionalManifest' {Maybe [Text]
Maybe Text
selectedOutputs :: Maybe [Text]
manifestNameModifier :: Maybe Text
$sel:selectedOutputs:CmafAdditionalManifest' :: CmafAdditionalManifest -> Maybe [Text]
$sel:manifestNameModifier:CmafAdditionalManifest' :: CmafAdditionalManifest -> 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
          ]
      )