{-# 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.MediaTailor.Types.RequestOutputItem
-- 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.MediaTailor.Types.RequestOutputItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.DashPlaylistSettings
import Amazonka.MediaTailor.Types.HlsPlaylistSettings
import qualified Amazonka.Prelude as Prelude

-- | The output configuration for this channel.
--
-- /See:/ 'newRequestOutputItem' smart constructor.
data RequestOutputItem = RequestOutputItem'
  { -- | HLS playlist configuration parameters.
    RequestOutputItem -> Maybe HlsPlaylistSettings
hlsPlaylistSettings :: Prelude.Maybe HlsPlaylistSettings,
    -- | DASH manifest configuration parameters.
    RequestOutputItem -> Maybe DashPlaylistSettings
dashPlaylistSettings :: Prelude.Maybe DashPlaylistSettings,
    -- | The name of the manifest for the channel. The name appears in the
    -- PlaybackUrl.
    RequestOutputItem -> Text
manifestName :: Prelude.Text,
    -- | A string used to match which HttpPackageConfiguration is used for each
    -- VodSource.
    RequestOutputItem -> Text
sourceGroup :: Prelude.Text
  }
  deriving (RequestOutputItem -> RequestOutputItem -> Bool
(RequestOutputItem -> RequestOutputItem -> Bool)
-> (RequestOutputItem -> RequestOutputItem -> Bool)
-> Eq RequestOutputItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestOutputItem -> RequestOutputItem -> Bool
$c/= :: RequestOutputItem -> RequestOutputItem -> Bool
== :: RequestOutputItem -> RequestOutputItem -> Bool
$c== :: RequestOutputItem -> RequestOutputItem -> Bool
Prelude.Eq, ReadPrec [RequestOutputItem]
ReadPrec RequestOutputItem
Int -> ReadS RequestOutputItem
ReadS [RequestOutputItem]
(Int -> ReadS RequestOutputItem)
-> ReadS [RequestOutputItem]
-> ReadPrec RequestOutputItem
-> ReadPrec [RequestOutputItem]
-> Read RequestOutputItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestOutputItem]
$creadListPrec :: ReadPrec [RequestOutputItem]
readPrec :: ReadPrec RequestOutputItem
$creadPrec :: ReadPrec RequestOutputItem
readList :: ReadS [RequestOutputItem]
$creadList :: ReadS [RequestOutputItem]
readsPrec :: Int -> ReadS RequestOutputItem
$creadsPrec :: Int -> ReadS RequestOutputItem
Prelude.Read, Int -> RequestOutputItem -> ShowS
[RequestOutputItem] -> ShowS
RequestOutputItem -> String
(Int -> RequestOutputItem -> ShowS)
-> (RequestOutputItem -> String)
-> ([RequestOutputItem] -> ShowS)
-> Show RequestOutputItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestOutputItem] -> ShowS
$cshowList :: [RequestOutputItem] -> ShowS
show :: RequestOutputItem -> String
$cshow :: RequestOutputItem -> String
showsPrec :: Int -> RequestOutputItem -> ShowS
$cshowsPrec :: Int -> RequestOutputItem -> ShowS
Prelude.Show, (forall x. RequestOutputItem -> Rep RequestOutputItem x)
-> (forall x. Rep RequestOutputItem x -> RequestOutputItem)
-> Generic RequestOutputItem
forall x. Rep RequestOutputItem x -> RequestOutputItem
forall x. RequestOutputItem -> Rep RequestOutputItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequestOutputItem x -> RequestOutputItem
$cfrom :: forall x. RequestOutputItem -> Rep RequestOutputItem x
Prelude.Generic)

-- |
-- Create a value of 'RequestOutputItem' 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:
--
-- 'hlsPlaylistSettings', 'requestOutputItem_hlsPlaylistSettings' - HLS playlist configuration parameters.
--
-- 'dashPlaylistSettings', 'requestOutputItem_dashPlaylistSettings' - DASH manifest configuration parameters.
--
-- 'manifestName', 'requestOutputItem_manifestName' - The name of the manifest for the channel. The name appears in the
-- PlaybackUrl.
--
-- 'sourceGroup', 'requestOutputItem_sourceGroup' - A string used to match which HttpPackageConfiguration is used for each
-- VodSource.
newRequestOutputItem ::
  -- | 'manifestName'
  Prelude.Text ->
  -- | 'sourceGroup'
  Prelude.Text ->
  RequestOutputItem
newRequestOutputItem :: Text -> Text -> RequestOutputItem
newRequestOutputItem Text
pManifestName_ Text
pSourceGroup_ =
  RequestOutputItem' :: Maybe HlsPlaylistSettings
-> Maybe DashPlaylistSettings -> Text -> Text -> RequestOutputItem
RequestOutputItem'
    { $sel:hlsPlaylistSettings:RequestOutputItem' :: Maybe HlsPlaylistSettings
hlsPlaylistSettings =
        Maybe HlsPlaylistSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:dashPlaylistSettings:RequestOutputItem' :: Maybe DashPlaylistSettings
dashPlaylistSettings = Maybe DashPlaylistSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:manifestName:RequestOutputItem' :: Text
manifestName = Text
pManifestName_,
      $sel:sourceGroup:RequestOutputItem' :: Text
sourceGroup = Text
pSourceGroup_
    }

-- | HLS playlist configuration parameters.
requestOutputItem_hlsPlaylistSettings :: Lens.Lens' RequestOutputItem (Prelude.Maybe HlsPlaylistSettings)
requestOutputItem_hlsPlaylistSettings :: (Maybe HlsPlaylistSettings -> f (Maybe HlsPlaylistSettings))
-> RequestOutputItem -> f RequestOutputItem
requestOutputItem_hlsPlaylistSettings = (RequestOutputItem -> Maybe HlsPlaylistSettings)
-> (RequestOutputItem
    -> Maybe HlsPlaylistSettings -> RequestOutputItem)
-> Lens
     RequestOutputItem
     RequestOutputItem
     (Maybe HlsPlaylistSettings)
     (Maybe HlsPlaylistSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestOutputItem' {Maybe HlsPlaylistSettings
hlsPlaylistSettings :: Maybe HlsPlaylistSettings
$sel:hlsPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe HlsPlaylistSettings
hlsPlaylistSettings} -> Maybe HlsPlaylistSettings
hlsPlaylistSettings) (\s :: RequestOutputItem
s@RequestOutputItem' {} Maybe HlsPlaylistSettings
a -> RequestOutputItem
s {$sel:hlsPlaylistSettings:RequestOutputItem' :: Maybe HlsPlaylistSettings
hlsPlaylistSettings = Maybe HlsPlaylistSettings
a} :: RequestOutputItem)

-- | DASH manifest configuration parameters.
requestOutputItem_dashPlaylistSettings :: Lens.Lens' RequestOutputItem (Prelude.Maybe DashPlaylistSettings)
requestOutputItem_dashPlaylistSettings :: (Maybe DashPlaylistSettings -> f (Maybe DashPlaylistSettings))
-> RequestOutputItem -> f RequestOutputItem
requestOutputItem_dashPlaylistSettings = (RequestOutputItem -> Maybe DashPlaylistSettings)
-> (RequestOutputItem
    -> Maybe DashPlaylistSettings -> RequestOutputItem)
-> Lens
     RequestOutputItem
     RequestOutputItem
     (Maybe DashPlaylistSettings)
     (Maybe DashPlaylistSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestOutputItem' {Maybe DashPlaylistSettings
dashPlaylistSettings :: Maybe DashPlaylistSettings
$sel:dashPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe DashPlaylistSettings
dashPlaylistSettings} -> Maybe DashPlaylistSettings
dashPlaylistSettings) (\s :: RequestOutputItem
s@RequestOutputItem' {} Maybe DashPlaylistSettings
a -> RequestOutputItem
s {$sel:dashPlaylistSettings:RequestOutputItem' :: Maybe DashPlaylistSettings
dashPlaylistSettings = Maybe DashPlaylistSettings
a} :: RequestOutputItem)

-- | The name of the manifest for the channel. The name appears in the
-- PlaybackUrl.
requestOutputItem_manifestName :: Lens.Lens' RequestOutputItem Prelude.Text
requestOutputItem_manifestName :: (Text -> f Text) -> RequestOutputItem -> f RequestOutputItem
requestOutputItem_manifestName = (RequestOutputItem -> Text)
-> (RequestOutputItem -> Text -> RequestOutputItem)
-> Lens RequestOutputItem RequestOutputItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestOutputItem' {Text
manifestName :: Text
$sel:manifestName:RequestOutputItem' :: RequestOutputItem -> Text
manifestName} -> Text
manifestName) (\s :: RequestOutputItem
s@RequestOutputItem' {} Text
a -> RequestOutputItem
s {$sel:manifestName:RequestOutputItem' :: Text
manifestName = Text
a} :: RequestOutputItem)

-- | A string used to match which HttpPackageConfiguration is used for each
-- VodSource.
requestOutputItem_sourceGroup :: Lens.Lens' RequestOutputItem Prelude.Text
requestOutputItem_sourceGroup :: (Text -> f Text) -> RequestOutputItem -> f RequestOutputItem
requestOutputItem_sourceGroup = (RequestOutputItem -> Text)
-> (RequestOutputItem -> Text -> RequestOutputItem)
-> Lens RequestOutputItem RequestOutputItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestOutputItem' {Text
sourceGroup :: Text
$sel:sourceGroup:RequestOutputItem' :: RequestOutputItem -> Text
sourceGroup} -> Text
sourceGroup) (\s :: RequestOutputItem
s@RequestOutputItem' {} Text
a -> RequestOutputItem
s {$sel:sourceGroup:RequestOutputItem' :: Text
sourceGroup = Text
a} :: RequestOutputItem)

instance Prelude.Hashable RequestOutputItem

instance Prelude.NFData RequestOutputItem

instance Core.ToJSON RequestOutputItem where
  toJSON :: RequestOutputItem -> Value
toJSON RequestOutputItem' {Maybe DashPlaylistSettings
Maybe HlsPlaylistSettings
Text
sourceGroup :: Text
manifestName :: Text
dashPlaylistSettings :: Maybe DashPlaylistSettings
hlsPlaylistSettings :: Maybe HlsPlaylistSettings
$sel:sourceGroup:RequestOutputItem' :: RequestOutputItem -> Text
$sel:manifestName:RequestOutputItem' :: RequestOutputItem -> Text
$sel:dashPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe DashPlaylistSettings
$sel:hlsPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe HlsPlaylistSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HlsPlaylistSettings" Text -> HlsPlaylistSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HlsPlaylistSettings -> Pair)
-> Maybe HlsPlaylistSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsPlaylistSettings
hlsPlaylistSettings,
            (Text
"DashPlaylistSettings" Text -> DashPlaylistSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DashPlaylistSettings -> Pair)
-> Maybe DashPlaylistSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DashPlaylistSettings
dashPlaylistSettings,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ManifestName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
manifestName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SourceGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceGroup)
          ]
      )