{-# 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.MediaLive.Types.Scte35SpliceInsert
-- 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.MediaLive.Types.Scte35SpliceInsert where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.Scte35SpliceInsertNoRegionalBlackoutBehavior
import Amazonka.MediaLive.Types.Scte35SpliceInsertWebDeliveryAllowedBehavior
import qualified Amazonka.Prelude as Prelude

-- | Scte35 Splice Insert
--
-- /See:/ 'newScte35SpliceInsert' smart constructor.
data Scte35SpliceInsert = Scte35SpliceInsert'
  { -- | When specified, this offset (in milliseconds) is added to the input Ad
    -- Avail PTS time. This only applies to embedded SCTE 104\/35 messages and
    -- does not apply to OOB messages.
    Scte35SpliceInsert -> Maybe Int
adAvailOffset :: Prelude.Maybe Prelude.Int,
    -- | When set to ignore, Segment Descriptors with noRegionalBlackoutFlag set
    -- to 0 will no longer trigger blackouts or Ad Avail slates
    Scte35SpliceInsert
-> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag :: Prelude.Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior,
    -- | When set to ignore, Segment Descriptors with webDeliveryAllowedFlag set
    -- to 0 will no longer trigger blackouts or Ad Avail slates
    Scte35SpliceInsert
-> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag :: Prelude.Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
  }
  deriving (Scte35SpliceInsert -> Scte35SpliceInsert -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte35SpliceInsert -> Scte35SpliceInsert -> Bool
$c/= :: Scte35SpliceInsert -> Scte35SpliceInsert -> Bool
== :: Scte35SpliceInsert -> Scte35SpliceInsert -> Bool
$c== :: Scte35SpliceInsert -> Scte35SpliceInsert -> Bool
Prelude.Eq, ReadPrec [Scte35SpliceInsert]
ReadPrec Scte35SpliceInsert
Int -> ReadS Scte35SpliceInsert
ReadS [Scte35SpliceInsert]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte35SpliceInsert]
$creadListPrec :: ReadPrec [Scte35SpliceInsert]
readPrec :: ReadPrec Scte35SpliceInsert
$creadPrec :: ReadPrec Scte35SpliceInsert
readList :: ReadS [Scte35SpliceInsert]
$creadList :: ReadS [Scte35SpliceInsert]
readsPrec :: Int -> ReadS Scte35SpliceInsert
$creadsPrec :: Int -> ReadS Scte35SpliceInsert
Prelude.Read, Int -> Scte35SpliceInsert -> ShowS
[Scte35SpliceInsert] -> ShowS
Scte35SpliceInsert -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte35SpliceInsert] -> ShowS
$cshowList :: [Scte35SpliceInsert] -> ShowS
show :: Scte35SpliceInsert -> String
$cshow :: Scte35SpliceInsert -> String
showsPrec :: Int -> Scte35SpliceInsert -> ShowS
$cshowsPrec :: Int -> Scte35SpliceInsert -> ShowS
Prelude.Show, forall x. Rep Scte35SpliceInsert x -> Scte35SpliceInsert
forall x. Scte35SpliceInsert -> Rep Scte35SpliceInsert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scte35SpliceInsert x -> Scte35SpliceInsert
$cfrom :: forall x. Scte35SpliceInsert -> Rep Scte35SpliceInsert x
Prelude.Generic)

-- |
-- Create a value of 'Scte35SpliceInsert' 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:
--
-- 'adAvailOffset', 'scte35SpliceInsert_adAvailOffset' - When specified, this offset (in milliseconds) is added to the input Ad
-- Avail PTS time. This only applies to embedded SCTE 104\/35 messages and
-- does not apply to OOB messages.
--
-- 'noRegionalBlackoutFlag', 'scte35SpliceInsert_noRegionalBlackoutFlag' - When set to ignore, Segment Descriptors with noRegionalBlackoutFlag set
-- to 0 will no longer trigger blackouts or Ad Avail slates
--
-- 'webDeliveryAllowedFlag', 'scte35SpliceInsert_webDeliveryAllowedFlag' - When set to ignore, Segment Descriptors with webDeliveryAllowedFlag set
-- to 0 will no longer trigger blackouts or Ad Avail slates
newScte35SpliceInsert ::
  Scte35SpliceInsert
newScte35SpliceInsert :: Scte35SpliceInsert
newScte35SpliceInsert =
  Scte35SpliceInsert'
    { $sel:adAvailOffset:Scte35SpliceInsert' :: Maybe Int
adAvailOffset =
        forall a. Maybe a
Prelude.Nothing,
      $sel:noRegionalBlackoutFlag:Scte35SpliceInsert' :: Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag = forall a. Maybe a
Prelude.Nothing,
      $sel:webDeliveryAllowedFlag:Scte35SpliceInsert' :: Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag = forall a. Maybe a
Prelude.Nothing
    }

-- | When specified, this offset (in milliseconds) is added to the input Ad
-- Avail PTS time. This only applies to embedded SCTE 104\/35 messages and
-- does not apply to OOB messages.
scte35SpliceInsert_adAvailOffset :: Lens.Lens' Scte35SpliceInsert (Prelude.Maybe Prelude.Int)
scte35SpliceInsert_adAvailOffset :: Lens' Scte35SpliceInsert (Maybe Int)
scte35SpliceInsert_adAvailOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35SpliceInsert' {Maybe Int
adAvailOffset :: Maybe Int
$sel:adAvailOffset:Scte35SpliceInsert' :: Scte35SpliceInsert -> Maybe Int
adAvailOffset} -> Maybe Int
adAvailOffset) (\s :: Scte35SpliceInsert
s@Scte35SpliceInsert' {} Maybe Int
a -> Scte35SpliceInsert
s {$sel:adAvailOffset:Scte35SpliceInsert' :: Maybe Int
adAvailOffset = Maybe Int
a} :: Scte35SpliceInsert)

-- | When set to ignore, Segment Descriptors with noRegionalBlackoutFlag set
-- to 0 will no longer trigger blackouts or Ad Avail slates
scte35SpliceInsert_noRegionalBlackoutFlag :: Lens.Lens' Scte35SpliceInsert (Prelude.Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior)
scte35SpliceInsert_noRegionalBlackoutFlag :: Lens'
  Scte35SpliceInsert
  (Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior)
scte35SpliceInsert_noRegionalBlackoutFlag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35SpliceInsert' {Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag :: Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
$sel:noRegionalBlackoutFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag} -> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag) (\s :: Scte35SpliceInsert
s@Scte35SpliceInsert' {} Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
a -> Scte35SpliceInsert
s {$sel:noRegionalBlackoutFlag:Scte35SpliceInsert' :: Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag = Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
a} :: Scte35SpliceInsert)

-- | When set to ignore, Segment Descriptors with webDeliveryAllowedFlag set
-- to 0 will no longer trigger blackouts or Ad Avail slates
scte35SpliceInsert_webDeliveryAllowedFlag :: Lens.Lens' Scte35SpliceInsert (Prelude.Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior)
scte35SpliceInsert_webDeliveryAllowedFlag :: Lens'
  Scte35SpliceInsert
  (Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior)
scte35SpliceInsert_webDeliveryAllowedFlag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35SpliceInsert' {Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag :: Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
$sel:webDeliveryAllowedFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag} -> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag) (\s :: Scte35SpliceInsert
s@Scte35SpliceInsert' {} Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
a -> Scte35SpliceInsert
s {$sel:webDeliveryAllowedFlag:Scte35SpliceInsert' :: Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag = Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
a} :: Scte35SpliceInsert)

instance Data.FromJSON Scte35SpliceInsert where
  parseJSON :: Value -> Parser Scte35SpliceInsert
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Scte35SpliceInsert"
      ( \Object
x ->
          Maybe Int
-> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
-> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
-> Scte35SpliceInsert
Scte35SpliceInsert'
            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
"adAvailOffset")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"noRegionalBlackoutFlag")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"webDeliveryAllowedFlag")
      )

instance Prelude.Hashable Scte35SpliceInsert where
  hashWithSalt :: Int -> Scte35SpliceInsert -> Int
hashWithSalt Int
_salt Scte35SpliceInsert' {Maybe Int
Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag :: Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
noRegionalBlackoutFlag :: Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
adAvailOffset :: Maybe Int
$sel:webDeliveryAllowedFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
$sel:noRegionalBlackoutFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
$sel:adAvailOffset:Scte35SpliceInsert' :: Scte35SpliceInsert -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
adAvailOffset
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag

instance Prelude.NFData Scte35SpliceInsert where
  rnf :: Scte35SpliceInsert -> ()
rnf Scte35SpliceInsert' {Maybe Int
Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag :: Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
noRegionalBlackoutFlag :: Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
adAvailOffset :: Maybe Int
$sel:webDeliveryAllowedFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
$sel:noRegionalBlackoutFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
$sel:adAvailOffset:Scte35SpliceInsert' :: Scte35SpliceInsert -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
adAvailOffset
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag

instance Data.ToJSON Scte35SpliceInsert where
  toJSON :: Scte35SpliceInsert -> Value
toJSON Scte35SpliceInsert' {Maybe Int
Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag :: Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
noRegionalBlackoutFlag :: Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
adAvailOffset :: Maybe Int
$sel:webDeliveryAllowedFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertWebDeliveryAllowedBehavior
$sel:noRegionalBlackoutFlag:Scte35SpliceInsert' :: Scte35SpliceInsert
-> Maybe Scte35SpliceInsertNoRegionalBlackoutBehavior
$sel:adAvailOffset:Scte35SpliceInsert' :: Scte35SpliceInsert -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"adAvailOffset" 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 Int
adAvailOffset,
            (Key
"noRegionalBlackoutFlag" 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 Scte35SpliceInsertNoRegionalBlackoutBehavior
noRegionalBlackoutFlag,
            (Key
"webDeliveryAllowedFlag" 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 Scte35SpliceInsertWebDeliveryAllowedBehavior
webDeliveryAllowedFlag
          ]
      )