{-# 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.UdpGroupSettings
-- 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.UdpGroupSettings 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.InputLossActionForUdpOut
import Amazonka.MediaLive.Types.UdpTimedMetadataId3Frame
import qualified Amazonka.Prelude as Prelude

-- | Udp Group Settings
--
-- /See:/ 'newUdpGroupSettings' smart constructor.
data UdpGroupSettings = UdpGroupSettings'
  { -- | Specifies behavior of last resort when input video is lost, and no more
    -- backup inputs are available. When dropTs is selected the entire
    -- transport stream will stop being emitted. When dropProgram is selected
    -- the program can be dropped from the transport stream (and replaced with
    -- null packets to meet the TS bitrate requirement). Or, when emitProgram
    -- is chosen the transport stream will continue to be produced normally
    -- with repeat frames, black frames, or slate frames substituted for the
    -- absent input video.
    UdpGroupSettings -> Maybe InputLossActionForUdpOut
inputLossAction :: Prelude.Maybe InputLossActionForUdpOut,
    -- | Indicates ID3 frame that has the timecode.
    UdpGroupSettings -> Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame :: Prelude.Maybe UdpTimedMetadataId3Frame,
    -- | Timed Metadata interval in seconds.
    UdpGroupSettings -> Maybe Natural
timedMetadataId3Period :: Prelude.Maybe Prelude.Natural
  }
  deriving (UdpGroupSettings -> UdpGroupSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UdpGroupSettings -> UdpGroupSettings -> Bool
$c/= :: UdpGroupSettings -> UdpGroupSettings -> Bool
== :: UdpGroupSettings -> UdpGroupSettings -> Bool
$c== :: UdpGroupSettings -> UdpGroupSettings -> Bool
Prelude.Eq, ReadPrec [UdpGroupSettings]
ReadPrec UdpGroupSettings
Int -> ReadS UdpGroupSettings
ReadS [UdpGroupSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UdpGroupSettings]
$creadListPrec :: ReadPrec [UdpGroupSettings]
readPrec :: ReadPrec UdpGroupSettings
$creadPrec :: ReadPrec UdpGroupSettings
readList :: ReadS [UdpGroupSettings]
$creadList :: ReadS [UdpGroupSettings]
readsPrec :: Int -> ReadS UdpGroupSettings
$creadsPrec :: Int -> ReadS UdpGroupSettings
Prelude.Read, Int -> UdpGroupSettings -> ShowS
[UdpGroupSettings] -> ShowS
UdpGroupSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UdpGroupSettings] -> ShowS
$cshowList :: [UdpGroupSettings] -> ShowS
show :: UdpGroupSettings -> String
$cshow :: UdpGroupSettings -> String
showsPrec :: Int -> UdpGroupSettings -> ShowS
$cshowsPrec :: Int -> UdpGroupSettings -> ShowS
Prelude.Show, forall x. Rep UdpGroupSettings x -> UdpGroupSettings
forall x. UdpGroupSettings -> Rep UdpGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UdpGroupSettings x -> UdpGroupSettings
$cfrom :: forall x. UdpGroupSettings -> Rep UdpGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'UdpGroupSettings' 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:
--
-- 'inputLossAction', 'udpGroupSettings_inputLossAction' - Specifies behavior of last resort when input video is lost, and no more
-- backup inputs are available. When dropTs is selected the entire
-- transport stream will stop being emitted. When dropProgram is selected
-- the program can be dropped from the transport stream (and replaced with
-- null packets to meet the TS bitrate requirement). Or, when emitProgram
-- is chosen the transport stream will continue to be produced normally
-- with repeat frames, black frames, or slate frames substituted for the
-- absent input video.
--
-- 'timedMetadataId3Frame', 'udpGroupSettings_timedMetadataId3Frame' - Indicates ID3 frame that has the timecode.
--
-- 'timedMetadataId3Period', 'udpGroupSettings_timedMetadataId3Period' - Timed Metadata interval in seconds.
newUdpGroupSettings ::
  UdpGroupSettings
newUdpGroupSettings :: UdpGroupSettings
newUdpGroupSettings =
  UdpGroupSettings'
    { $sel:inputLossAction:UdpGroupSettings' :: Maybe InputLossActionForUdpOut
inputLossAction =
        forall a. Maybe a
Prelude.Nothing,
      $sel:timedMetadataId3Frame:UdpGroupSettings' :: Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame = forall a. Maybe a
Prelude.Nothing,
      $sel:timedMetadataId3Period:UdpGroupSettings' :: Maybe Natural
timedMetadataId3Period = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies behavior of last resort when input video is lost, and no more
-- backup inputs are available. When dropTs is selected the entire
-- transport stream will stop being emitted. When dropProgram is selected
-- the program can be dropped from the transport stream (and replaced with
-- null packets to meet the TS bitrate requirement). Or, when emitProgram
-- is chosen the transport stream will continue to be produced normally
-- with repeat frames, black frames, or slate frames substituted for the
-- absent input video.
udpGroupSettings_inputLossAction :: Lens.Lens' UdpGroupSettings (Prelude.Maybe InputLossActionForUdpOut)
udpGroupSettings_inputLossAction :: Lens' UdpGroupSettings (Maybe InputLossActionForUdpOut)
udpGroupSettings_inputLossAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UdpGroupSettings' {Maybe InputLossActionForUdpOut
inputLossAction :: Maybe InputLossActionForUdpOut
$sel:inputLossAction:UdpGroupSettings' :: UdpGroupSettings -> Maybe InputLossActionForUdpOut
inputLossAction} -> Maybe InputLossActionForUdpOut
inputLossAction) (\s :: UdpGroupSettings
s@UdpGroupSettings' {} Maybe InputLossActionForUdpOut
a -> UdpGroupSettings
s {$sel:inputLossAction:UdpGroupSettings' :: Maybe InputLossActionForUdpOut
inputLossAction = Maybe InputLossActionForUdpOut
a} :: UdpGroupSettings)

-- | Indicates ID3 frame that has the timecode.
udpGroupSettings_timedMetadataId3Frame :: Lens.Lens' UdpGroupSettings (Prelude.Maybe UdpTimedMetadataId3Frame)
udpGroupSettings_timedMetadataId3Frame :: Lens' UdpGroupSettings (Maybe UdpTimedMetadataId3Frame)
udpGroupSettings_timedMetadataId3Frame = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UdpGroupSettings' {Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame :: Maybe UdpTimedMetadataId3Frame
$sel:timedMetadataId3Frame:UdpGroupSettings' :: UdpGroupSettings -> Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame} -> Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame) (\s :: UdpGroupSettings
s@UdpGroupSettings' {} Maybe UdpTimedMetadataId3Frame
a -> UdpGroupSettings
s {$sel:timedMetadataId3Frame:UdpGroupSettings' :: Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame = Maybe UdpTimedMetadataId3Frame
a} :: UdpGroupSettings)

-- | Timed Metadata interval in seconds.
udpGroupSettings_timedMetadataId3Period :: Lens.Lens' UdpGroupSettings (Prelude.Maybe Prelude.Natural)
udpGroupSettings_timedMetadataId3Period :: Lens' UdpGroupSettings (Maybe Natural)
udpGroupSettings_timedMetadataId3Period = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UdpGroupSettings' {Maybe Natural
timedMetadataId3Period :: Maybe Natural
$sel:timedMetadataId3Period:UdpGroupSettings' :: UdpGroupSettings -> Maybe Natural
timedMetadataId3Period} -> Maybe Natural
timedMetadataId3Period) (\s :: UdpGroupSettings
s@UdpGroupSettings' {} Maybe Natural
a -> UdpGroupSettings
s {$sel:timedMetadataId3Period:UdpGroupSettings' :: Maybe Natural
timedMetadataId3Period = Maybe Natural
a} :: UdpGroupSettings)

instance Data.FromJSON UdpGroupSettings where
  parseJSON :: Value -> Parser UdpGroupSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UdpGroupSettings"
      ( \Object
x ->
          Maybe InputLossActionForUdpOut
-> Maybe UdpTimedMetadataId3Frame
-> Maybe Natural
-> UdpGroupSettings
UdpGroupSettings'
            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
"inputLossAction")
            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
"timedMetadataId3Frame")
            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
"timedMetadataId3Period")
      )

instance Prelude.Hashable UdpGroupSettings where
  hashWithSalt :: Int -> UdpGroupSettings -> Int
hashWithSalt Int
_salt UdpGroupSettings' {Maybe Natural
Maybe InputLossActionForUdpOut
Maybe UdpTimedMetadataId3Frame
timedMetadataId3Period :: Maybe Natural
timedMetadataId3Frame :: Maybe UdpTimedMetadataId3Frame
inputLossAction :: Maybe InputLossActionForUdpOut
$sel:timedMetadataId3Period:UdpGroupSettings' :: UdpGroupSettings -> Maybe Natural
$sel:timedMetadataId3Frame:UdpGroupSettings' :: UdpGroupSettings -> Maybe UdpTimedMetadataId3Frame
$sel:inputLossAction:UdpGroupSettings' :: UdpGroupSettings -> Maybe InputLossActionForUdpOut
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputLossActionForUdpOut
inputLossAction
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
timedMetadataId3Period

instance Prelude.NFData UdpGroupSettings where
  rnf :: UdpGroupSettings -> ()
rnf UdpGroupSettings' {Maybe Natural
Maybe InputLossActionForUdpOut
Maybe UdpTimedMetadataId3Frame
timedMetadataId3Period :: Maybe Natural
timedMetadataId3Frame :: Maybe UdpTimedMetadataId3Frame
inputLossAction :: Maybe InputLossActionForUdpOut
$sel:timedMetadataId3Period:UdpGroupSettings' :: UdpGroupSettings -> Maybe Natural
$sel:timedMetadataId3Frame:UdpGroupSettings' :: UdpGroupSettings -> Maybe UdpTimedMetadataId3Frame
$sel:inputLossAction:UdpGroupSettings' :: UdpGroupSettings -> Maybe InputLossActionForUdpOut
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InputLossActionForUdpOut
inputLossAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UdpTimedMetadataId3Frame
timedMetadataId3Frame
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
timedMetadataId3Period

instance Data.ToJSON UdpGroupSettings where
  toJSON :: UdpGroupSettings -> Value
toJSON UdpGroupSettings' {Maybe Natural
Maybe InputLossActionForUdpOut
Maybe UdpTimedMetadataId3Frame
timedMetadataId3Period :: Maybe Natural
timedMetadataId3Frame :: Maybe UdpTimedMetadataId3Frame
inputLossAction :: Maybe InputLossActionForUdpOut
$sel:timedMetadataId3Period:UdpGroupSettings' :: UdpGroupSettings -> Maybe Natural
$sel:timedMetadataId3Frame:UdpGroupSettings' :: UdpGroupSettings -> Maybe UdpTimedMetadataId3Frame
$sel:inputLossAction:UdpGroupSettings' :: UdpGroupSettings -> Maybe InputLossActionForUdpOut
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"inputLossAction" 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 InputLossActionForUdpOut
inputLossAction,
            (Key
"timedMetadataId3Frame" 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 UdpTimedMetadataId3Frame
timedMetadataId3Frame,
            (Key
"timedMetadataId3Period" 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
timedMetadataId3Period
          ]
      )