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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.Scte35AposNoRegionalBlackoutBehavior
import Amazonka.MediaLive.Types.Scte35AposWebDeliveryAllowedBehavior
import qualified Amazonka.Prelude as Prelude

-- | Scte35 Time Signal Apos
--
-- /See:/ 'newScte35TimeSignalApos' smart constructor.
data Scte35TimeSignalApos = Scte35TimeSignalApos'
  { -- | When set to ignore, Segment Descriptors with webDeliveryAllowedFlag set
    -- to 0 will no longer trigger blackouts or Ad Avail slates
    Scte35TimeSignalApos -> Maybe Scte35AposWebDeliveryAllowedBehavior
webDeliveryAllowedFlag :: Prelude.Maybe Scte35AposWebDeliveryAllowedBehavior,
    -- | 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.
    Scte35TimeSignalApos -> 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
    Scte35TimeSignalApos -> Maybe Scte35AposNoRegionalBlackoutBehavior
noRegionalBlackoutFlag :: Prelude.Maybe Scte35AposNoRegionalBlackoutBehavior
  }
  deriving (Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool
(Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool)
-> (Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool)
-> Eq Scte35TimeSignalApos
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool
$c/= :: Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool
== :: Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool
$c== :: Scte35TimeSignalApos -> Scte35TimeSignalApos -> Bool
Prelude.Eq, ReadPrec [Scte35TimeSignalApos]
ReadPrec Scte35TimeSignalApos
Int -> ReadS Scte35TimeSignalApos
ReadS [Scte35TimeSignalApos]
(Int -> ReadS Scte35TimeSignalApos)
-> ReadS [Scte35TimeSignalApos]
-> ReadPrec Scte35TimeSignalApos
-> ReadPrec [Scte35TimeSignalApos]
-> Read Scte35TimeSignalApos
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte35TimeSignalApos]
$creadListPrec :: ReadPrec [Scte35TimeSignalApos]
readPrec :: ReadPrec Scte35TimeSignalApos
$creadPrec :: ReadPrec Scte35TimeSignalApos
readList :: ReadS [Scte35TimeSignalApos]
$creadList :: ReadS [Scte35TimeSignalApos]
readsPrec :: Int -> ReadS Scte35TimeSignalApos
$creadsPrec :: Int -> ReadS Scte35TimeSignalApos
Prelude.Read, Int -> Scte35TimeSignalApos -> ShowS
[Scte35TimeSignalApos] -> ShowS
Scte35TimeSignalApos -> String
(Int -> Scte35TimeSignalApos -> ShowS)
-> (Scte35TimeSignalApos -> String)
-> ([Scte35TimeSignalApos] -> ShowS)
-> Show Scte35TimeSignalApos
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte35TimeSignalApos] -> ShowS
$cshowList :: [Scte35TimeSignalApos] -> ShowS
show :: Scte35TimeSignalApos -> String
$cshow :: Scte35TimeSignalApos -> String
showsPrec :: Int -> Scte35TimeSignalApos -> ShowS
$cshowsPrec :: Int -> Scte35TimeSignalApos -> ShowS
Prelude.Show, (forall x. Scte35TimeSignalApos -> Rep Scte35TimeSignalApos x)
-> (forall x. Rep Scte35TimeSignalApos x -> Scte35TimeSignalApos)
-> Generic Scte35TimeSignalApos
forall x. Rep Scte35TimeSignalApos x -> Scte35TimeSignalApos
forall x. Scte35TimeSignalApos -> Rep Scte35TimeSignalApos x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scte35TimeSignalApos x -> Scte35TimeSignalApos
$cfrom :: forall x. Scte35TimeSignalApos -> Rep Scte35TimeSignalApos x
Prelude.Generic)

-- |
-- Create a value of 'Scte35TimeSignalApos' 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:
--
-- 'webDeliveryAllowedFlag', 'scte35TimeSignalApos_webDeliveryAllowedFlag' - When set to ignore, Segment Descriptors with webDeliveryAllowedFlag set
-- to 0 will no longer trigger blackouts or Ad Avail slates
--
-- 'adAvailOffset', 'scte35TimeSignalApos_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', 'scte35TimeSignalApos_noRegionalBlackoutFlag' - When set to ignore, Segment Descriptors with noRegionalBlackoutFlag set
-- to 0 will no longer trigger blackouts or Ad Avail slates
newScte35TimeSignalApos ::
  Scte35TimeSignalApos
newScte35TimeSignalApos :: Scte35TimeSignalApos
newScte35TimeSignalApos =
  Scte35TimeSignalApos' :: Maybe Scte35AposWebDeliveryAllowedBehavior
-> Maybe Int
-> Maybe Scte35AposNoRegionalBlackoutBehavior
-> Scte35TimeSignalApos
Scte35TimeSignalApos'
    { $sel:webDeliveryAllowedFlag:Scte35TimeSignalApos' :: Maybe Scte35AposWebDeliveryAllowedBehavior
webDeliveryAllowedFlag =
        Maybe Scte35AposWebDeliveryAllowedBehavior
forall a. Maybe a
Prelude.Nothing,
      $sel:adAvailOffset:Scte35TimeSignalApos' :: Maybe Int
adAvailOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:noRegionalBlackoutFlag:Scte35TimeSignalApos' :: Maybe Scte35AposNoRegionalBlackoutBehavior
noRegionalBlackoutFlag = Maybe Scte35AposNoRegionalBlackoutBehavior
forall a. Maybe a
Prelude.Nothing
    }

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

-- | 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.
scte35TimeSignalApos_adAvailOffset :: Lens.Lens' Scte35TimeSignalApos (Prelude.Maybe Prelude.Int)
scte35TimeSignalApos_adAvailOffset :: (Maybe Int -> f (Maybe Int))
-> Scte35TimeSignalApos -> f Scte35TimeSignalApos
scte35TimeSignalApos_adAvailOffset = (Scte35TimeSignalApos -> Maybe Int)
-> (Scte35TimeSignalApos -> Maybe Int -> Scte35TimeSignalApos)
-> Lens
     Scte35TimeSignalApos Scte35TimeSignalApos (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35TimeSignalApos' {Maybe Int
adAvailOffset :: Maybe Int
$sel:adAvailOffset:Scte35TimeSignalApos' :: Scte35TimeSignalApos -> Maybe Int
adAvailOffset} -> Maybe Int
adAvailOffset) (\s :: Scte35TimeSignalApos
s@Scte35TimeSignalApos' {} Maybe Int
a -> Scte35TimeSignalApos
s {$sel:adAvailOffset:Scte35TimeSignalApos' :: Maybe Int
adAvailOffset = Maybe Int
a} :: Scte35TimeSignalApos)

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

instance Core.FromJSON Scte35TimeSignalApos where
  parseJSON :: Value -> Parser Scte35TimeSignalApos
parseJSON =
    String
-> (Object -> Parser Scte35TimeSignalApos)
-> Value
-> Parser Scte35TimeSignalApos
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Scte35TimeSignalApos"
      ( \Object
x ->
          Maybe Scte35AposWebDeliveryAllowedBehavior
-> Maybe Int
-> Maybe Scte35AposNoRegionalBlackoutBehavior
-> Scte35TimeSignalApos
Scte35TimeSignalApos'
            (Maybe Scte35AposWebDeliveryAllowedBehavior
 -> Maybe Int
 -> Maybe Scte35AposNoRegionalBlackoutBehavior
 -> Scte35TimeSignalApos)
-> Parser (Maybe Scte35AposWebDeliveryAllowedBehavior)
-> Parser
     (Maybe Int
      -> Maybe Scte35AposNoRegionalBlackoutBehavior
      -> Scte35TimeSignalApos)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe Scte35AposWebDeliveryAllowedBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"webDeliveryAllowedFlag")
            Parser
  (Maybe Int
   -> Maybe Scte35AposNoRegionalBlackoutBehavior
   -> Scte35TimeSignalApos)
-> Parser (Maybe Int)
-> Parser
     (Maybe Scte35AposNoRegionalBlackoutBehavior
      -> Scte35TimeSignalApos)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"adAvailOffset")
            Parser
  (Maybe Scte35AposNoRegionalBlackoutBehavior
   -> Scte35TimeSignalApos)
-> Parser (Maybe Scte35AposNoRegionalBlackoutBehavior)
-> Parser Scte35TimeSignalApos
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe Scte35AposNoRegionalBlackoutBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"noRegionalBlackoutFlag")
      )

instance Prelude.Hashable Scte35TimeSignalApos

instance Prelude.NFData Scte35TimeSignalApos

instance Core.ToJSON Scte35TimeSignalApos where
  toJSON :: Scte35TimeSignalApos -> Value
toJSON Scte35TimeSignalApos' {Maybe Int
Maybe Scte35AposNoRegionalBlackoutBehavior
Maybe Scte35AposWebDeliveryAllowedBehavior
noRegionalBlackoutFlag :: Maybe Scte35AposNoRegionalBlackoutBehavior
adAvailOffset :: Maybe Int
webDeliveryAllowedFlag :: Maybe Scte35AposWebDeliveryAllowedBehavior
$sel:noRegionalBlackoutFlag:Scte35TimeSignalApos' :: Scte35TimeSignalApos -> Maybe Scte35AposNoRegionalBlackoutBehavior
$sel:adAvailOffset:Scte35TimeSignalApos' :: Scte35TimeSignalApos -> Maybe Int
$sel:webDeliveryAllowedFlag:Scte35TimeSignalApos' :: Scte35TimeSignalApos -> Maybe Scte35AposWebDeliveryAllowedBehavior
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"webDeliveryAllowedFlag" Text -> Scte35AposWebDeliveryAllowedBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Scte35AposWebDeliveryAllowedBehavior -> Pair)
-> Maybe Scte35AposWebDeliveryAllowedBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Scte35AposWebDeliveryAllowedBehavior
webDeliveryAllowedFlag,
            (Text
"adAvailOffset" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
adAvailOffset,
            (Text
"noRegionalBlackoutFlag" Text -> Scte35AposNoRegionalBlackoutBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Scte35AposNoRegionalBlackoutBehavior -> Pair)
-> Maybe Scte35AposNoRegionalBlackoutBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Scte35AposNoRegionalBlackoutBehavior
noRegionalBlackoutFlag
          ]
      )