{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaTailor.Types.RequestOutputItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | DASH manifest configuration parameters.
    RequestOutputItem -> Maybe DashPlaylistSettings
dashPlaylistSettings :: Prelude.Maybe DashPlaylistSettings,
    -- | HLS playlist configuration parameters.
    RequestOutputItem -> Maybe HlsPlaylistSettings
hlsPlaylistSettings :: Prelude.Maybe HlsPlaylistSettings,
    -- | 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
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]
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
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. 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:
--
-- 'dashPlaylistSettings', 'requestOutputItem_dashPlaylistSettings' - DASH manifest configuration parameters.
--
-- 'hlsPlaylistSettings', 'requestOutputItem_hlsPlaylistSettings' - HLS playlist 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'
    { $sel:dashPlaylistSettings:RequestOutputItem' :: Maybe DashPlaylistSettings
dashPlaylistSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:hlsPlaylistSettings:RequestOutputItem' :: Maybe HlsPlaylistSettings
hlsPlaylistSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:manifestName:RequestOutputItem' :: Text
manifestName = Text
pManifestName_,
      $sel:sourceGroup:RequestOutputItem' :: Text
sourceGroup = Text
pSourceGroup_
    }

-- | DASH manifest configuration parameters.
requestOutputItem_dashPlaylistSettings :: Lens.Lens' RequestOutputItem (Prelude.Maybe DashPlaylistSettings)
requestOutputItem_dashPlaylistSettings :: Lens' RequestOutputItem (Maybe DashPlaylistSettings)
requestOutputItem_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)

-- | HLS playlist configuration parameters.
requestOutputItem_hlsPlaylistSettings :: Lens.Lens' RequestOutputItem (Prelude.Maybe HlsPlaylistSettings)
requestOutputItem_hlsPlaylistSettings :: Lens' RequestOutputItem (Maybe HlsPlaylistSettings)
requestOutputItem_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)

-- | The name of the manifest for the channel. The name appears in the
-- @PlaybackUrl@.
requestOutputItem_manifestName :: Lens.Lens' RequestOutputItem Prelude.Text
requestOutputItem_manifestName :: Lens' RequestOutputItem Text
requestOutputItem_manifestName = 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 :: Lens' RequestOutputItem Text
requestOutputItem_sourceGroup = 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 where
  hashWithSalt :: Int -> RequestOutputItem -> Int
hashWithSalt Int
_salt RequestOutputItem' {Maybe DashPlaylistSettings
Maybe HlsPlaylistSettings
Text
sourceGroup :: Text
manifestName :: Text
hlsPlaylistSettings :: Maybe HlsPlaylistSettings
dashPlaylistSettings :: Maybe DashPlaylistSettings
$sel:sourceGroup:RequestOutputItem' :: RequestOutputItem -> Text
$sel:manifestName:RequestOutputItem' :: RequestOutputItem -> Text
$sel:hlsPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe HlsPlaylistSettings
$sel:dashPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe DashPlaylistSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DashPlaylistSettings
dashPlaylistSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HlsPlaylistSettings
hlsPlaylistSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
manifestName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceGroup

instance Prelude.NFData RequestOutputItem where
  rnf :: RequestOutputItem -> ()
rnf RequestOutputItem' {Maybe DashPlaylistSettings
Maybe HlsPlaylistSettings
Text
sourceGroup :: Text
manifestName :: Text
hlsPlaylistSettings :: Maybe HlsPlaylistSettings
dashPlaylistSettings :: Maybe DashPlaylistSettings
$sel:sourceGroup:RequestOutputItem' :: RequestOutputItem -> Text
$sel:manifestName:RequestOutputItem' :: RequestOutputItem -> Text
$sel:hlsPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe HlsPlaylistSettings
$sel:dashPlaylistSettings:RequestOutputItem' :: RequestOutputItem -> Maybe DashPlaylistSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DashPlaylistSettings
dashPlaylistSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HlsPlaylistSettings
hlsPlaylistSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
manifestName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceGroup

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