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

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

-- | Settings for a SCTE-35 splice_insert message.
--
-- /See:/ 'newScte35SpliceInsertScheduleActionSettings' smart constructor.
data Scte35SpliceInsertScheduleActionSettings = Scte35SpliceInsertScheduleActionSettings'
  { -- | Optional, the duration for the splice_insert, in 90 KHz ticks. To
    -- convert seconds to ticks, multiple the seconds by 90,000. If you enter a
    -- duration, there is an expectation that the downstream system can read
    -- the duration and cue in at that time. If you do not enter a duration,
    -- the splice_insert will continue indefinitely and there is an expectation
    -- that you will enter a return_to_network to end the splice_insert at the
    -- appropriate time.
    Scte35SpliceInsertScheduleActionSettings -> Maybe Natural
duration :: Prelude.Maybe Prelude.Natural,
    -- | The splice_event_id for the SCTE-35 splice_insert, as defined in
    -- SCTE-35.
    Scte35SpliceInsertScheduleActionSettings -> Natural
spliceEventId :: Prelude.Natural
  }
  deriving (Scte35SpliceInsertScheduleActionSettings
-> Scte35SpliceInsertScheduleActionSettings -> Bool
(Scte35SpliceInsertScheduleActionSettings
 -> Scte35SpliceInsertScheduleActionSettings -> Bool)
-> (Scte35SpliceInsertScheduleActionSettings
    -> Scte35SpliceInsertScheduleActionSettings -> Bool)
-> Eq Scte35SpliceInsertScheduleActionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte35SpliceInsertScheduleActionSettings
-> Scte35SpliceInsertScheduleActionSettings -> Bool
$c/= :: Scte35SpliceInsertScheduleActionSettings
-> Scte35SpliceInsertScheduleActionSettings -> Bool
== :: Scte35SpliceInsertScheduleActionSettings
-> Scte35SpliceInsertScheduleActionSettings -> Bool
$c== :: Scte35SpliceInsertScheduleActionSettings
-> Scte35SpliceInsertScheduleActionSettings -> Bool
Prelude.Eq, ReadPrec [Scte35SpliceInsertScheduleActionSettings]
ReadPrec Scte35SpliceInsertScheduleActionSettings
Int -> ReadS Scte35SpliceInsertScheduleActionSettings
ReadS [Scte35SpliceInsertScheduleActionSettings]
(Int -> ReadS Scte35SpliceInsertScheduleActionSettings)
-> ReadS [Scte35SpliceInsertScheduleActionSettings]
-> ReadPrec Scte35SpliceInsertScheduleActionSettings
-> ReadPrec [Scte35SpliceInsertScheduleActionSettings]
-> Read Scte35SpliceInsertScheduleActionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte35SpliceInsertScheduleActionSettings]
$creadListPrec :: ReadPrec [Scte35SpliceInsertScheduleActionSettings]
readPrec :: ReadPrec Scte35SpliceInsertScheduleActionSettings
$creadPrec :: ReadPrec Scte35SpliceInsertScheduleActionSettings
readList :: ReadS [Scte35SpliceInsertScheduleActionSettings]
$creadList :: ReadS [Scte35SpliceInsertScheduleActionSettings]
readsPrec :: Int -> ReadS Scte35SpliceInsertScheduleActionSettings
$creadsPrec :: Int -> ReadS Scte35SpliceInsertScheduleActionSettings
Prelude.Read, Int -> Scte35SpliceInsertScheduleActionSettings -> ShowS
[Scte35SpliceInsertScheduleActionSettings] -> ShowS
Scte35SpliceInsertScheduleActionSettings -> String
(Int -> Scte35SpliceInsertScheduleActionSettings -> ShowS)
-> (Scte35SpliceInsertScheduleActionSettings -> String)
-> ([Scte35SpliceInsertScheduleActionSettings] -> ShowS)
-> Show Scte35SpliceInsertScheduleActionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte35SpliceInsertScheduleActionSettings] -> ShowS
$cshowList :: [Scte35SpliceInsertScheduleActionSettings] -> ShowS
show :: Scte35SpliceInsertScheduleActionSettings -> String
$cshow :: Scte35SpliceInsertScheduleActionSettings -> String
showsPrec :: Int -> Scte35SpliceInsertScheduleActionSettings -> ShowS
$cshowsPrec :: Int -> Scte35SpliceInsertScheduleActionSettings -> ShowS
Prelude.Show, (forall x.
 Scte35SpliceInsertScheduleActionSettings
 -> Rep Scte35SpliceInsertScheduleActionSettings x)
-> (forall x.
    Rep Scte35SpliceInsertScheduleActionSettings x
    -> Scte35SpliceInsertScheduleActionSettings)
-> Generic Scte35SpliceInsertScheduleActionSettings
forall x.
Rep Scte35SpliceInsertScheduleActionSettings x
-> Scte35SpliceInsertScheduleActionSettings
forall x.
Scte35SpliceInsertScheduleActionSettings
-> Rep Scte35SpliceInsertScheduleActionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep Scte35SpliceInsertScheduleActionSettings x
-> Scte35SpliceInsertScheduleActionSettings
$cfrom :: forall x.
Scte35SpliceInsertScheduleActionSettings
-> Rep Scte35SpliceInsertScheduleActionSettings x
Prelude.Generic)

-- |
-- Create a value of 'Scte35SpliceInsertScheduleActionSettings' 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:
--
-- 'duration', 'scte35SpliceInsertScheduleActionSettings_duration' - Optional, the duration for the splice_insert, in 90 KHz ticks. To
-- convert seconds to ticks, multiple the seconds by 90,000. If you enter a
-- duration, there is an expectation that the downstream system can read
-- the duration and cue in at that time. If you do not enter a duration,
-- the splice_insert will continue indefinitely and there is an expectation
-- that you will enter a return_to_network to end the splice_insert at the
-- appropriate time.
--
-- 'spliceEventId', 'scte35SpliceInsertScheduleActionSettings_spliceEventId' - The splice_event_id for the SCTE-35 splice_insert, as defined in
-- SCTE-35.
newScte35SpliceInsertScheduleActionSettings ::
  -- | 'spliceEventId'
  Prelude.Natural ->
  Scte35SpliceInsertScheduleActionSettings
newScte35SpliceInsertScheduleActionSettings :: Natural -> Scte35SpliceInsertScheduleActionSettings
newScte35SpliceInsertScheduleActionSettings
  Natural
pSpliceEventId_ =
    Scte35SpliceInsertScheduleActionSettings' :: Maybe Natural
-> Natural -> Scte35SpliceInsertScheduleActionSettings
Scte35SpliceInsertScheduleActionSettings'
      { $sel:duration:Scte35SpliceInsertScheduleActionSettings' :: Maybe Natural
duration =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:spliceEventId:Scte35SpliceInsertScheduleActionSettings' :: Natural
spliceEventId = Natural
pSpliceEventId_
      }

-- | Optional, the duration for the splice_insert, in 90 KHz ticks. To
-- convert seconds to ticks, multiple the seconds by 90,000. If you enter a
-- duration, there is an expectation that the downstream system can read
-- the duration and cue in at that time. If you do not enter a duration,
-- the splice_insert will continue indefinitely and there is an expectation
-- that you will enter a return_to_network to end the splice_insert at the
-- appropriate time.
scte35SpliceInsertScheduleActionSettings_duration :: Lens.Lens' Scte35SpliceInsertScheduleActionSettings (Prelude.Maybe Prelude.Natural)
scte35SpliceInsertScheduleActionSettings_duration :: (Maybe Natural -> f (Maybe Natural))
-> Scte35SpliceInsertScheduleActionSettings
-> f Scte35SpliceInsertScheduleActionSettings
scte35SpliceInsertScheduleActionSettings_duration = (Scte35SpliceInsertScheduleActionSettings -> Maybe Natural)
-> (Scte35SpliceInsertScheduleActionSettings
    -> Maybe Natural -> Scte35SpliceInsertScheduleActionSettings)
-> Lens
     Scte35SpliceInsertScheduleActionSettings
     Scte35SpliceInsertScheduleActionSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35SpliceInsertScheduleActionSettings' {Maybe Natural
duration :: Maybe Natural
$sel:duration:Scte35SpliceInsertScheduleActionSettings' :: Scte35SpliceInsertScheduleActionSettings -> Maybe Natural
duration} -> Maybe Natural
duration) (\s :: Scte35SpliceInsertScheduleActionSettings
s@Scte35SpliceInsertScheduleActionSettings' {} Maybe Natural
a -> Scte35SpliceInsertScheduleActionSettings
s {$sel:duration:Scte35SpliceInsertScheduleActionSettings' :: Maybe Natural
duration = Maybe Natural
a} :: Scte35SpliceInsertScheduleActionSettings)

-- | The splice_event_id for the SCTE-35 splice_insert, as defined in
-- SCTE-35.
scte35SpliceInsertScheduleActionSettings_spliceEventId :: Lens.Lens' Scte35SpliceInsertScheduleActionSettings Prelude.Natural
scte35SpliceInsertScheduleActionSettings_spliceEventId :: (Natural -> f Natural)
-> Scte35SpliceInsertScheduleActionSettings
-> f Scte35SpliceInsertScheduleActionSettings
scte35SpliceInsertScheduleActionSettings_spliceEventId = (Scte35SpliceInsertScheduleActionSettings -> Natural)
-> (Scte35SpliceInsertScheduleActionSettings
    -> Natural -> Scte35SpliceInsertScheduleActionSettings)
-> Lens
     Scte35SpliceInsertScheduleActionSettings
     Scte35SpliceInsertScheduleActionSettings
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35SpliceInsertScheduleActionSettings' {Natural
spliceEventId :: Natural
$sel:spliceEventId:Scte35SpliceInsertScheduleActionSettings' :: Scte35SpliceInsertScheduleActionSettings -> Natural
spliceEventId} -> Natural
spliceEventId) (\s :: Scte35SpliceInsertScheduleActionSettings
s@Scte35SpliceInsertScheduleActionSettings' {} Natural
a -> Scte35SpliceInsertScheduleActionSettings
s {$sel:spliceEventId:Scte35SpliceInsertScheduleActionSettings' :: Natural
spliceEventId = Natural
a} :: Scte35SpliceInsertScheduleActionSettings)

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

instance
  Prelude.Hashable
    Scte35SpliceInsertScheduleActionSettings

instance
  Prelude.NFData
    Scte35SpliceInsertScheduleActionSettings

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