{-# 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.MediaPackageVOD.Types.DashManifest
-- 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.MediaPackageVOD.Types.DashManifest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackageVOD.Types.ManifestLayout
import Amazonka.MediaPackageVOD.Types.Profile
import Amazonka.MediaPackageVOD.Types.StreamSelection
import qualified Amazonka.Prelude as Prelude

-- | A DASH manifest configuration.
--
-- /See:/ 'newDashManifest' smart constructor.
data DashManifest = DashManifest'
  { -- | Minimum duration (in seconds) that a player will buffer media before
    -- starting the presentation.
    DashManifest -> Maybe Int
minBufferTimeSeconds :: Prelude.Maybe Prelude.Int,
    -- | An optional string to include in the name of the manifest.
    DashManifest -> Maybe Text
manifestName :: Prelude.Maybe Prelude.Text,
    -- | The Dynamic Adaptive Streaming over HTTP (DASH) profile type. When set
    -- to \"HBBTV_1_5\", HbbTV 1.5 compliant output is enabled.
    DashManifest -> Maybe Profile
profile :: Prelude.Maybe Profile,
    DashManifest -> Maybe StreamSelection
streamSelection :: Prelude.Maybe StreamSelection,
    -- | Determines the position of some tags in the Media Presentation
    -- Description (MPD). When set to FULL, elements like SegmentTemplate and
    -- ContentProtection are included in each Representation. When set to
    -- COMPACT, duplicate elements are combined and presented at the
    -- AdaptationSet level.
    DashManifest -> Maybe ManifestLayout
manifestLayout :: Prelude.Maybe ManifestLayout
  }
  deriving (DashManifest -> DashManifest -> Bool
(DashManifest -> DashManifest -> Bool)
-> (DashManifest -> DashManifest -> Bool) -> Eq DashManifest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashManifest -> DashManifest -> Bool
$c/= :: DashManifest -> DashManifest -> Bool
== :: DashManifest -> DashManifest -> Bool
$c== :: DashManifest -> DashManifest -> Bool
Prelude.Eq, ReadPrec [DashManifest]
ReadPrec DashManifest
Int -> ReadS DashManifest
ReadS [DashManifest]
(Int -> ReadS DashManifest)
-> ReadS [DashManifest]
-> ReadPrec DashManifest
-> ReadPrec [DashManifest]
-> Read DashManifest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashManifest]
$creadListPrec :: ReadPrec [DashManifest]
readPrec :: ReadPrec DashManifest
$creadPrec :: ReadPrec DashManifest
readList :: ReadS [DashManifest]
$creadList :: ReadS [DashManifest]
readsPrec :: Int -> ReadS DashManifest
$creadsPrec :: Int -> ReadS DashManifest
Prelude.Read, Int -> DashManifest -> ShowS
[DashManifest] -> ShowS
DashManifest -> String
(Int -> DashManifest -> ShowS)
-> (DashManifest -> String)
-> ([DashManifest] -> ShowS)
-> Show DashManifest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashManifest] -> ShowS
$cshowList :: [DashManifest] -> ShowS
show :: DashManifest -> String
$cshow :: DashManifest -> String
showsPrec :: Int -> DashManifest -> ShowS
$cshowsPrec :: Int -> DashManifest -> ShowS
Prelude.Show, (forall x. DashManifest -> Rep DashManifest x)
-> (forall x. Rep DashManifest x -> DashManifest)
-> Generic DashManifest
forall x. Rep DashManifest x -> DashManifest
forall x. DashManifest -> Rep DashManifest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashManifest x -> DashManifest
$cfrom :: forall x. DashManifest -> Rep DashManifest x
Prelude.Generic)

-- |
-- Create a value of 'DashManifest' 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:
--
-- 'minBufferTimeSeconds', 'dashManifest_minBufferTimeSeconds' - Minimum duration (in seconds) that a player will buffer media before
-- starting the presentation.
--
-- 'manifestName', 'dashManifest_manifestName' - An optional string to include in the name of the manifest.
--
-- 'profile', 'dashManifest_profile' - The Dynamic Adaptive Streaming over HTTP (DASH) profile type. When set
-- to \"HBBTV_1_5\", HbbTV 1.5 compliant output is enabled.
--
-- 'streamSelection', 'dashManifest_streamSelection' - Undocumented member.
--
-- 'manifestLayout', 'dashManifest_manifestLayout' - Determines the position of some tags in the Media Presentation
-- Description (MPD). When set to FULL, elements like SegmentTemplate and
-- ContentProtection are included in each Representation. When set to
-- COMPACT, duplicate elements are combined and presented at the
-- AdaptationSet level.
newDashManifest ::
  DashManifest
newDashManifest :: DashManifest
newDashManifest =
  DashManifest' :: Maybe Int
-> Maybe Text
-> Maybe Profile
-> Maybe StreamSelection
-> Maybe ManifestLayout
-> DashManifest
DashManifest'
    { $sel:minBufferTimeSeconds:DashManifest' :: Maybe Int
minBufferTimeSeconds =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:manifestName:DashManifest' :: Maybe Text
manifestName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:profile:DashManifest' :: Maybe Profile
profile = Maybe Profile
forall a. Maybe a
Prelude.Nothing,
      $sel:streamSelection:DashManifest' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
forall a. Maybe a
Prelude.Nothing,
      $sel:manifestLayout:DashManifest' :: Maybe ManifestLayout
manifestLayout = Maybe ManifestLayout
forall a. Maybe a
Prelude.Nothing
    }

-- | Minimum duration (in seconds) that a player will buffer media before
-- starting the presentation.
dashManifest_minBufferTimeSeconds :: Lens.Lens' DashManifest (Prelude.Maybe Prelude.Int)
dashManifest_minBufferTimeSeconds :: (Maybe Int -> f (Maybe Int)) -> DashManifest -> f DashManifest
dashManifest_minBufferTimeSeconds = (DashManifest -> Maybe Int)
-> (DashManifest -> Maybe Int -> DashManifest)
-> Lens DashManifest DashManifest (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashManifest' {Maybe Int
minBufferTimeSeconds :: Maybe Int
$sel:minBufferTimeSeconds:DashManifest' :: DashManifest -> Maybe Int
minBufferTimeSeconds} -> Maybe Int
minBufferTimeSeconds) (\s :: DashManifest
s@DashManifest' {} Maybe Int
a -> DashManifest
s {$sel:minBufferTimeSeconds:DashManifest' :: Maybe Int
minBufferTimeSeconds = Maybe Int
a} :: DashManifest)

-- | An optional string to include in the name of the manifest.
dashManifest_manifestName :: Lens.Lens' DashManifest (Prelude.Maybe Prelude.Text)
dashManifest_manifestName :: (Maybe Text -> f (Maybe Text)) -> DashManifest -> f DashManifest
dashManifest_manifestName = (DashManifest -> Maybe Text)
-> (DashManifest -> Maybe Text -> DashManifest)
-> Lens DashManifest DashManifest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashManifest' {Maybe Text
manifestName :: Maybe Text
$sel:manifestName:DashManifest' :: DashManifest -> Maybe Text
manifestName} -> Maybe Text
manifestName) (\s :: DashManifest
s@DashManifest' {} Maybe Text
a -> DashManifest
s {$sel:manifestName:DashManifest' :: Maybe Text
manifestName = Maybe Text
a} :: DashManifest)

-- | The Dynamic Adaptive Streaming over HTTP (DASH) profile type. When set
-- to \"HBBTV_1_5\", HbbTV 1.5 compliant output is enabled.
dashManifest_profile :: Lens.Lens' DashManifest (Prelude.Maybe Profile)
dashManifest_profile :: (Maybe Profile -> f (Maybe Profile))
-> DashManifest -> f DashManifest
dashManifest_profile = (DashManifest -> Maybe Profile)
-> (DashManifest -> Maybe Profile -> DashManifest)
-> Lens DashManifest DashManifest (Maybe Profile) (Maybe Profile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashManifest' {Maybe Profile
profile :: Maybe Profile
$sel:profile:DashManifest' :: DashManifest -> Maybe Profile
profile} -> Maybe Profile
profile) (\s :: DashManifest
s@DashManifest' {} Maybe Profile
a -> DashManifest
s {$sel:profile:DashManifest' :: Maybe Profile
profile = Maybe Profile
a} :: DashManifest)

-- | Undocumented member.
dashManifest_streamSelection :: Lens.Lens' DashManifest (Prelude.Maybe StreamSelection)
dashManifest_streamSelection :: (Maybe StreamSelection -> f (Maybe StreamSelection))
-> DashManifest -> f DashManifest
dashManifest_streamSelection = (DashManifest -> Maybe StreamSelection)
-> (DashManifest -> Maybe StreamSelection -> DashManifest)
-> Lens
     DashManifest
     DashManifest
     (Maybe StreamSelection)
     (Maybe StreamSelection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashManifest' {Maybe StreamSelection
streamSelection :: Maybe StreamSelection
$sel:streamSelection:DashManifest' :: DashManifest -> Maybe StreamSelection
streamSelection} -> Maybe StreamSelection
streamSelection) (\s :: DashManifest
s@DashManifest' {} Maybe StreamSelection
a -> DashManifest
s {$sel:streamSelection:DashManifest' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
a} :: DashManifest)

-- | Determines the position of some tags in the Media Presentation
-- Description (MPD). When set to FULL, elements like SegmentTemplate and
-- ContentProtection are included in each Representation. When set to
-- COMPACT, duplicate elements are combined and presented at the
-- AdaptationSet level.
dashManifest_manifestLayout :: Lens.Lens' DashManifest (Prelude.Maybe ManifestLayout)
dashManifest_manifestLayout :: (Maybe ManifestLayout -> f (Maybe ManifestLayout))
-> DashManifest -> f DashManifest
dashManifest_manifestLayout = (DashManifest -> Maybe ManifestLayout)
-> (DashManifest -> Maybe ManifestLayout -> DashManifest)
-> Lens
     DashManifest
     DashManifest
     (Maybe ManifestLayout)
     (Maybe ManifestLayout)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashManifest' {Maybe ManifestLayout
manifestLayout :: Maybe ManifestLayout
$sel:manifestLayout:DashManifest' :: DashManifest -> Maybe ManifestLayout
manifestLayout} -> Maybe ManifestLayout
manifestLayout) (\s :: DashManifest
s@DashManifest' {} Maybe ManifestLayout
a -> DashManifest
s {$sel:manifestLayout:DashManifest' :: Maybe ManifestLayout
manifestLayout = Maybe ManifestLayout
a} :: DashManifest)

instance Core.FromJSON DashManifest where
  parseJSON :: Value -> Parser DashManifest
parseJSON =
    String
-> (Object -> Parser DashManifest) -> Value -> Parser DashManifest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DashManifest"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Profile
-> Maybe StreamSelection
-> Maybe ManifestLayout
-> DashManifest
DashManifest'
            (Maybe Int
 -> Maybe Text
 -> Maybe Profile
 -> Maybe StreamSelection
 -> Maybe ManifestLayout
 -> DashManifest)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Profile
      -> Maybe StreamSelection
      -> Maybe ManifestLayout
      -> DashManifest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minBufferTimeSeconds")
            Parser
  (Maybe Text
   -> Maybe Profile
   -> Maybe StreamSelection
   -> Maybe ManifestLayout
   -> DashManifest)
-> Parser (Maybe Text)
-> Parser
     (Maybe Profile
      -> Maybe StreamSelection -> Maybe ManifestLayout -> DashManifest)
forall (f :: * -> *) a b. Applicative f => 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
"manifestName")
            Parser
  (Maybe Profile
   -> Maybe StreamSelection -> Maybe ManifestLayout -> DashManifest)
-> Parser (Maybe Profile)
-> Parser
     (Maybe StreamSelection -> Maybe ManifestLayout -> DashManifest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Profile)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"profile")
            Parser
  (Maybe StreamSelection -> Maybe ManifestLayout -> DashManifest)
-> Parser (Maybe StreamSelection)
-> Parser (Maybe ManifestLayout -> DashManifest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamSelection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"streamSelection")
            Parser (Maybe ManifestLayout -> DashManifest)
-> Parser (Maybe ManifestLayout) -> Parser DashManifest
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ManifestLayout)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"manifestLayout")
      )

instance Prelude.Hashable DashManifest

instance Prelude.NFData DashManifest

instance Core.ToJSON DashManifest where
  toJSON :: DashManifest -> Value
toJSON DashManifest' {Maybe Int
Maybe Text
Maybe ManifestLayout
Maybe Profile
Maybe StreamSelection
manifestLayout :: Maybe ManifestLayout
streamSelection :: Maybe StreamSelection
profile :: Maybe Profile
manifestName :: Maybe Text
minBufferTimeSeconds :: Maybe Int
$sel:manifestLayout:DashManifest' :: DashManifest -> Maybe ManifestLayout
$sel:streamSelection:DashManifest' :: DashManifest -> Maybe StreamSelection
$sel:profile:DashManifest' :: DashManifest -> Maybe Profile
$sel:manifestName:DashManifest' :: DashManifest -> Maybe Text
$sel:minBufferTimeSeconds:DashManifest' :: DashManifest -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"minBufferTimeSeconds" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
minBufferTimeSeconds,
            (Text
"manifestName" 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
manifestName,
            (Text
"profile" Text -> Profile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Profile -> Pair) -> Maybe Profile -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Profile
profile,
            (Text
"streamSelection" Text -> StreamSelection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StreamSelection -> Pair) -> Maybe StreamSelection -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamSelection
streamSelection,
            (Text
"manifestLayout" Text -> ManifestLayout -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ManifestLayout -> Pair) -> Maybe ManifestLayout -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ManifestLayout
manifestLayout
          ]
      )