{-# 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.ManifestProcessingRules
-- 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.ManifestProcessingRules 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.AdMarkerPassthrough
import qualified Amazonka.Prelude as Prelude

-- | The configuration for manifest processing rules. Manifest processing
-- rules enable customization of the personalized manifests created by
-- MediaTailor.
--
-- /See:/ 'newManifestProcessingRules' smart constructor.
data ManifestProcessingRules = ManifestProcessingRules'
  { -- | For HLS, when set to @true@, MediaTailor passes through @EXT-X-CUE-IN@,
    -- @EXT-X-CUE-OUT@, and @EXT-X-SPLICEPOINT-SCTE35@ ad markers from the
    -- origin manifest to the MediaTailor personalized manifest.
    --
    -- No logic is applied to these ad markers. For example, if @EXT-X-CUE-OUT@
    -- has a value of @60@, but no ads are filled for that ad break,
    -- MediaTailor will not set the value to @0@.
    ManifestProcessingRules -> Maybe AdMarkerPassthrough
adMarkerPassthrough :: Prelude.Maybe AdMarkerPassthrough
  }
  deriving (ManifestProcessingRules -> ManifestProcessingRules -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManifestProcessingRules -> ManifestProcessingRules -> Bool
$c/= :: ManifestProcessingRules -> ManifestProcessingRules -> Bool
== :: ManifestProcessingRules -> ManifestProcessingRules -> Bool
$c== :: ManifestProcessingRules -> ManifestProcessingRules -> Bool
Prelude.Eq, ReadPrec [ManifestProcessingRules]
ReadPrec ManifestProcessingRules
Int -> ReadS ManifestProcessingRules
ReadS [ManifestProcessingRules]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManifestProcessingRules]
$creadListPrec :: ReadPrec [ManifestProcessingRules]
readPrec :: ReadPrec ManifestProcessingRules
$creadPrec :: ReadPrec ManifestProcessingRules
readList :: ReadS [ManifestProcessingRules]
$creadList :: ReadS [ManifestProcessingRules]
readsPrec :: Int -> ReadS ManifestProcessingRules
$creadsPrec :: Int -> ReadS ManifestProcessingRules
Prelude.Read, Int -> ManifestProcessingRules -> ShowS
[ManifestProcessingRules] -> ShowS
ManifestProcessingRules -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManifestProcessingRules] -> ShowS
$cshowList :: [ManifestProcessingRules] -> ShowS
show :: ManifestProcessingRules -> String
$cshow :: ManifestProcessingRules -> String
showsPrec :: Int -> ManifestProcessingRules -> ShowS
$cshowsPrec :: Int -> ManifestProcessingRules -> ShowS
Prelude.Show, forall x. Rep ManifestProcessingRules x -> ManifestProcessingRules
forall x. ManifestProcessingRules -> Rep ManifestProcessingRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManifestProcessingRules x -> ManifestProcessingRules
$cfrom :: forall x. ManifestProcessingRules -> Rep ManifestProcessingRules x
Prelude.Generic)

-- |
-- Create a value of 'ManifestProcessingRules' 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:
--
-- 'adMarkerPassthrough', 'manifestProcessingRules_adMarkerPassthrough' - For HLS, when set to @true@, MediaTailor passes through @EXT-X-CUE-IN@,
-- @EXT-X-CUE-OUT@, and @EXT-X-SPLICEPOINT-SCTE35@ ad markers from the
-- origin manifest to the MediaTailor personalized manifest.
--
-- No logic is applied to these ad markers. For example, if @EXT-X-CUE-OUT@
-- has a value of @60@, but no ads are filled for that ad break,
-- MediaTailor will not set the value to @0@.
newManifestProcessingRules ::
  ManifestProcessingRules
newManifestProcessingRules :: ManifestProcessingRules
newManifestProcessingRules =
  ManifestProcessingRules'
    { $sel:adMarkerPassthrough:ManifestProcessingRules' :: Maybe AdMarkerPassthrough
adMarkerPassthrough =
        forall a. Maybe a
Prelude.Nothing
    }

-- | For HLS, when set to @true@, MediaTailor passes through @EXT-X-CUE-IN@,
-- @EXT-X-CUE-OUT@, and @EXT-X-SPLICEPOINT-SCTE35@ ad markers from the
-- origin manifest to the MediaTailor personalized manifest.
--
-- No logic is applied to these ad markers. For example, if @EXT-X-CUE-OUT@
-- has a value of @60@, but no ads are filled for that ad break,
-- MediaTailor will not set the value to @0@.
manifestProcessingRules_adMarkerPassthrough :: Lens.Lens' ManifestProcessingRules (Prelude.Maybe AdMarkerPassthrough)
manifestProcessingRules_adMarkerPassthrough :: Lens' ManifestProcessingRules (Maybe AdMarkerPassthrough)
manifestProcessingRules_adMarkerPassthrough = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManifestProcessingRules' {Maybe AdMarkerPassthrough
adMarkerPassthrough :: Maybe AdMarkerPassthrough
$sel:adMarkerPassthrough:ManifestProcessingRules' :: ManifestProcessingRules -> Maybe AdMarkerPassthrough
adMarkerPassthrough} -> Maybe AdMarkerPassthrough
adMarkerPassthrough) (\s :: ManifestProcessingRules
s@ManifestProcessingRules' {} Maybe AdMarkerPassthrough
a -> ManifestProcessingRules
s {$sel:adMarkerPassthrough:ManifestProcessingRules' :: Maybe AdMarkerPassthrough
adMarkerPassthrough = Maybe AdMarkerPassthrough
a} :: ManifestProcessingRules)

instance Data.FromJSON ManifestProcessingRules where
  parseJSON :: Value -> Parser ManifestProcessingRules
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ManifestProcessingRules"
      ( \Object
x ->
          Maybe AdMarkerPassthrough -> ManifestProcessingRules
ManifestProcessingRules'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AdMarkerPassthrough")
      )

instance Prelude.Hashable ManifestProcessingRules where
  hashWithSalt :: Int -> ManifestProcessingRules -> Int
hashWithSalt Int
_salt ManifestProcessingRules' {Maybe AdMarkerPassthrough
adMarkerPassthrough :: Maybe AdMarkerPassthrough
$sel:adMarkerPassthrough:ManifestProcessingRules' :: ManifestProcessingRules -> Maybe AdMarkerPassthrough
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AdMarkerPassthrough
adMarkerPassthrough

instance Prelude.NFData ManifestProcessingRules where
  rnf :: ManifestProcessingRules -> ()
rnf ManifestProcessingRules' {Maybe AdMarkerPassthrough
adMarkerPassthrough :: Maybe AdMarkerPassthrough
$sel:adMarkerPassthrough:ManifestProcessingRules' :: ManifestProcessingRules -> Maybe AdMarkerPassthrough
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AdMarkerPassthrough
adMarkerPassthrough

instance Data.ToJSON ManifestProcessingRules where
  toJSON :: ManifestProcessingRules -> Value
toJSON ManifestProcessingRules' {Maybe AdMarkerPassthrough
adMarkerPassthrough :: Maybe AdMarkerPassthrough
$sel:adMarkerPassthrough:ManifestProcessingRules' :: ManifestProcessingRules -> Maybe AdMarkerPassthrough
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AdMarkerPassthrough" 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 AdMarkerPassthrough
adMarkerPassthrough
          ]
      )