{-# 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.DashAdditionalManifest
-- 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.DashAdditionalManifest 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 DASH 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:/ 'newDashAdditionalManifest' smart constructor.
data DashAdditionalManifest = DashAdditionalManifest'
  { -- | 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 DASH group is film-name.mpd. 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.mpd.
    DashAdditionalManifest -> Maybe Text
manifestNameModifier :: Prelude.Maybe Prelude.Text,
    -- | Specify the outputs that you want this additional top-level manifest to
    -- reference.
    DashAdditionalManifest -> Maybe [Text]
selectedOutputs :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DashAdditionalManifest -> DashAdditionalManifest -> Bool
(DashAdditionalManifest -> DashAdditionalManifest -> Bool)
-> (DashAdditionalManifest -> DashAdditionalManifest -> Bool)
-> Eq DashAdditionalManifest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashAdditionalManifest -> DashAdditionalManifest -> Bool
$c/= :: DashAdditionalManifest -> DashAdditionalManifest -> Bool
== :: DashAdditionalManifest -> DashAdditionalManifest -> Bool
$c== :: DashAdditionalManifest -> DashAdditionalManifest -> Bool
Prelude.Eq, ReadPrec [DashAdditionalManifest]
ReadPrec DashAdditionalManifest
Int -> ReadS DashAdditionalManifest
ReadS [DashAdditionalManifest]
(Int -> ReadS DashAdditionalManifest)
-> ReadS [DashAdditionalManifest]
-> ReadPrec DashAdditionalManifest
-> ReadPrec [DashAdditionalManifest]
-> Read DashAdditionalManifest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashAdditionalManifest]
$creadListPrec :: ReadPrec [DashAdditionalManifest]
readPrec :: ReadPrec DashAdditionalManifest
$creadPrec :: ReadPrec DashAdditionalManifest
readList :: ReadS [DashAdditionalManifest]
$creadList :: ReadS [DashAdditionalManifest]
readsPrec :: Int -> ReadS DashAdditionalManifest
$creadsPrec :: Int -> ReadS DashAdditionalManifest
Prelude.Read, Int -> DashAdditionalManifest -> ShowS
[DashAdditionalManifest] -> ShowS
DashAdditionalManifest -> String
(Int -> DashAdditionalManifest -> ShowS)
-> (DashAdditionalManifest -> String)
-> ([DashAdditionalManifest] -> ShowS)
-> Show DashAdditionalManifest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashAdditionalManifest] -> ShowS
$cshowList :: [DashAdditionalManifest] -> ShowS
show :: DashAdditionalManifest -> String
$cshow :: DashAdditionalManifest -> String
showsPrec :: Int -> DashAdditionalManifest -> ShowS
$cshowsPrec :: Int -> DashAdditionalManifest -> ShowS
Prelude.Show, (forall x. DashAdditionalManifest -> Rep DashAdditionalManifest x)
-> (forall x.
    Rep DashAdditionalManifest x -> DashAdditionalManifest)
-> Generic DashAdditionalManifest
forall x. Rep DashAdditionalManifest x -> DashAdditionalManifest
forall x. DashAdditionalManifest -> Rep DashAdditionalManifest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashAdditionalManifest x -> DashAdditionalManifest
$cfrom :: forall x. DashAdditionalManifest -> Rep DashAdditionalManifest x
Prelude.Generic)

-- |
-- Create a value of 'DashAdditionalManifest' 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', 'dashAdditionalManifest_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 DASH group is film-name.mpd. 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.mpd.
--
-- 'selectedOutputs', 'dashAdditionalManifest_selectedOutputs' - Specify the outputs that you want this additional top-level manifest to
-- reference.
newDashAdditionalManifest ::
  DashAdditionalManifest
newDashAdditionalManifest :: DashAdditionalManifest
newDashAdditionalManifest =
  DashAdditionalManifest' :: Maybe Text -> Maybe [Text] -> DashAdditionalManifest
DashAdditionalManifest'
    { $sel:manifestNameModifier:DashAdditionalManifest' :: Maybe Text
manifestNameModifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:selectedOutputs:DashAdditionalManifest' :: 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 DASH group is film-name.mpd. 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.mpd.
dashAdditionalManifest_manifestNameModifier :: Lens.Lens' DashAdditionalManifest (Prelude.Maybe Prelude.Text)
dashAdditionalManifest_manifestNameModifier :: (Maybe Text -> f (Maybe Text))
-> DashAdditionalManifest -> f DashAdditionalManifest
dashAdditionalManifest_manifestNameModifier = (DashAdditionalManifest -> Maybe Text)
-> (DashAdditionalManifest -> Maybe Text -> DashAdditionalManifest)
-> Lens
     DashAdditionalManifest
     DashAdditionalManifest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashAdditionalManifest' {Maybe Text
manifestNameModifier :: Maybe Text
$sel:manifestNameModifier:DashAdditionalManifest' :: DashAdditionalManifest -> Maybe Text
manifestNameModifier} -> Maybe Text
manifestNameModifier) (\s :: DashAdditionalManifest
s@DashAdditionalManifest' {} Maybe Text
a -> DashAdditionalManifest
s {$sel:manifestNameModifier:DashAdditionalManifest' :: Maybe Text
manifestNameModifier = Maybe Text
a} :: DashAdditionalManifest)

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

instance Prelude.NFData DashAdditionalManifest

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