{-# 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.AdMarkerPassthrough
-- 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.AdMarkerPassthrough where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | 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.
--
-- /See:/ 'newAdMarkerPassthrough' smart constructor.
data AdMarkerPassthrough = AdMarkerPassthrough'
  { -- | Enables ad marker passthrough for your configuration.
    AdMarkerPassthrough -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (AdMarkerPassthrough -> AdMarkerPassthrough -> Bool
(AdMarkerPassthrough -> AdMarkerPassthrough -> Bool)
-> (AdMarkerPassthrough -> AdMarkerPassthrough -> Bool)
-> Eq AdMarkerPassthrough
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdMarkerPassthrough -> AdMarkerPassthrough -> Bool
$c/= :: AdMarkerPassthrough -> AdMarkerPassthrough -> Bool
== :: AdMarkerPassthrough -> AdMarkerPassthrough -> Bool
$c== :: AdMarkerPassthrough -> AdMarkerPassthrough -> Bool
Prelude.Eq, ReadPrec [AdMarkerPassthrough]
ReadPrec AdMarkerPassthrough
Int -> ReadS AdMarkerPassthrough
ReadS [AdMarkerPassthrough]
(Int -> ReadS AdMarkerPassthrough)
-> ReadS [AdMarkerPassthrough]
-> ReadPrec AdMarkerPassthrough
-> ReadPrec [AdMarkerPassthrough]
-> Read AdMarkerPassthrough
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdMarkerPassthrough]
$creadListPrec :: ReadPrec [AdMarkerPassthrough]
readPrec :: ReadPrec AdMarkerPassthrough
$creadPrec :: ReadPrec AdMarkerPassthrough
readList :: ReadS [AdMarkerPassthrough]
$creadList :: ReadS [AdMarkerPassthrough]
readsPrec :: Int -> ReadS AdMarkerPassthrough
$creadsPrec :: Int -> ReadS AdMarkerPassthrough
Prelude.Read, Int -> AdMarkerPassthrough -> ShowS
[AdMarkerPassthrough] -> ShowS
AdMarkerPassthrough -> String
(Int -> AdMarkerPassthrough -> ShowS)
-> (AdMarkerPassthrough -> String)
-> ([AdMarkerPassthrough] -> ShowS)
-> Show AdMarkerPassthrough
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdMarkerPassthrough] -> ShowS
$cshowList :: [AdMarkerPassthrough] -> ShowS
show :: AdMarkerPassthrough -> String
$cshow :: AdMarkerPassthrough -> String
showsPrec :: Int -> AdMarkerPassthrough -> ShowS
$cshowsPrec :: Int -> AdMarkerPassthrough -> ShowS
Prelude.Show, (forall x. AdMarkerPassthrough -> Rep AdMarkerPassthrough x)
-> (forall x. Rep AdMarkerPassthrough x -> AdMarkerPassthrough)
-> Generic AdMarkerPassthrough
forall x. Rep AdMarkerPassthrough x -> AdMarkerPassthrough
forall x. AdMarkerPassthrough -> Rep AdMarkerPassthrough x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdMarkerPassthrough x -> AdMarkerPassthrough
$cfrom :: forall x. AdMarkerPassthrough -> Rep AdMarkerPassthrough x
Prelude.Generic)

-- |
-- Create a value of 'AdMarkerPassthrough' 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:
--
-- 'enabled', 'adMarkerPassthrough_enabled' - Enables ad marker passthrough for your configuration.
newAdMarkerPassthrough ::
  AdMarkerPassthrough
newAdMarkerPassthrough :: AdMarkerPassthrough
newAdMarkerPassthrough =
  AdMarkerPassthrough' :: Maybe Bool -> AdMarkerPassthrough
AdMarkerPassthrough' {$sel:enabled:AdMarkerPassthrough' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing}

-- | Enables ad marker passthrough for your configuration.
adMarkerPassthrough_enabled :: Lens.Lens' AdMarkerPassthrough (Prelude.Maybe Prelude.Bool)
adMarkerPassthrough_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AdMarkerPassthrough -> f AdMarkerPassthrough
adMarkerPassthrough_enabled = (AdMarkerPassthrough -> Maybe Bool)
-> (AdMarkerPassthrough -> Maybe Bool -> AdMarkerPassthrough)
-> Lens
     AdMarkerPassthrough AdMarkerPassthrough (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdMarkerPassthrough' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AdMarkerPassthrough' :: AdMarkerPassthrough -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AdMarkerPassthrough
s@AdMarkerPassthrough' {} Maybe Bool
a -> AdMarkerPassthrough
s {$sel:enabled:AdMarkerPassthrough' :: Maybe Bool
enabled = Maybe Bool
a} :: AdMarkerPassthrough)

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

instance Prelude.Hashable AdMarkerPassthrough

instance Prelude.NFData AdMarkerPassthrough

instance Core.ToJSON AdMarkerPassthrough where
  toJSON :: AdMarkerPassthrough -> Value
toJSON AdMarkerPassthrough' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AdMarkerPassthrough' :: AdMarkerPassthrough -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled]
      )