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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $sel:duration:Scte35SpliceInsertScheduleActionSettings' :: Maybe Natural
duration =
          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 :: Lens' Scte35SpliceInsertScheduleActionSettings (Maybe Natural)
scte35SpliceInsertScheduleActionSettings_duration = 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 :: Lens' Scte35SpliceInsertScheduleActionSettings Natural
scte35SpliceInsertScheduleActionSettings_spliceEventId = 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
  Data.FromJSON
    Scte35SpliceInsertScheduleActionSettings
  where
  parseJSON :: Value -> Parser Scte35SpliceInsertScheduleActionSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Scte35SpliceInsertScheduleActionSettings"
      ( \Object
x ->
          Maybe Natural
-> Natural -> Scte35SpliceInsertScheduleActionSettings
Scte35SpliceInsertScheduleActionSettings'
            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
"duration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"spliceEventId")
      )

instance
  Prelude.Hashable
    Scte35SpliceInsertScheduleActionSettings
  where
  hashWithSalt :: Int -> Scte35SpliceInsertScheduleActionSettings -> Int
hashWithSalt
    Int
_salt
    Scte35SpliceInsertScheduleActionSettings' {Natural
Maybe Natural
spliceEventId :: Natural
duration :: Maybe Natural
$sel:spliceEventId:Scte35SpliceInsertScheduleActionSettings' :: Scte35SpliceInsertScheduleActionSettings -> Natural
$sel:duration:Scte35SpliceInsertScheduleActionSettings' :: Scte35SpliceInsertScheduleActionSettings -> Maybe Natural
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
duration
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
spliceEventId

instance
  Prelude.NFData
    Scte35SpliceInsertScheduleActionSettings
  where
  rnf :: Scte35SpliceInsertScheduleActionSettings -> ()
rnf Scte35SpliceInsertScheduleActionSettings' {Natural
Maybe Natural
spliceEventId :: Natural
duration :: Maybe Natural
$sel:spliceEventId:Scte35SpliceInsertScheduleActionSettings' :: Scte35SpliceInsertScheduleActionSettings -> Natural
$sel:duration:Scte35SpliceInsertScheduleActionSettings' :: Scte35SpliceInsertScheduleActionSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
duration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
spliceEventId

instance
  Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"duration" 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 Natural
duration,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"spliceEventId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
spliceEventId)
          ]
      )