{-# 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.MediaConvert.Types.DvbTdtSettings
-- 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.MediaConvert.Types.DvbTdtSettings where

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

-- | Use these settings to insert a DVB Time and Date Table (TDT) in the
-- transport stream of this output. When you work directly in your JSON job
-- specification, include this object only when your job has a transport
-- stream output and the container settings contain the object
-- M2tsSettings.
--
-- /See:/ 'newDvbTdtSettings' smart constructor.
data DvbTdtSettings = DvbTdtSettings'
  { -- | The number of milliseconds between instances of this table in the output
    -- transport stream.
    DvbTdtSettings -> Maybe Natural
tdtInterval :: Prelude.Maybe Prelude.Natural
  }
  deriving (DvbTdtSettings -> DvbTdtSettings -> Bool
(DvbTdtSettings -> DvbTdtSettings -> Bool)
-> (DvbTdtSettings -> DvbTdtSettings -> Bool) -> Eq DvbTdtSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DvbTdtSettings -> DvbTdtSettings -> Bool
$c/= :: DvbTdtSettings -> DvbTdtSettings -> Bool
== :: DvbTdtSettings -> DvbTdtSettings -> Bool
$c== :: DvbTdtSettings -> DvbTdtSettings -> Bool
Prelude.Eq, ReadPrec [DvbTdtSettings]
ReadPrec DvbTdtSettings
Int -> ReadS DvbTdtSettings
ReadS [DvbTdtSettings]
(Int -> ReadS DvbTdtSettings)
-> ReadS [DvbTdtSettings]
-> ReadPrec DvbTdtSettings
-> ReadPrec [DvbTdtSettings]
-> Read DvbTdtSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DvbTdtSettings]
$creadListPrec :: ReadPrec [DvbTdtSettings]
readPrec :: ReadPrec DvbTdtSettings
$creadPrec :: ReadPrec DvbTdtSettings
readList :: ReadS [DvbTdtSettings]
$creadList :: ReadS [DvbTdtSettings]
readsPrec :: Int -> ReadS DvbTdtSettings
$creadsPrec :: Int -> ReadS DvbTdtSettings
Prelude.Read, Int -> DvbTdtSettings -> ShowS
[DvbTdtSettings] -> ShowS
DvbTdtSettings -> String
(Int -> DvbTdtSettings -> ShowS)
-> (DvbTdtSettings -> String)
-> ([DvbTdtSettings] -> ShowS)
-> Show DvbTdtSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DvbTdtSettings] -> ShowS
$cshowList :: [DvbTdtSettings] -> ShowS
show :: DvbTdtSettings -> String
$cshow :: DvbTdtSettings -> String
showsPrec :: Int -> DvbTdtSettings -> ShowS
$cshowsPrec :: Int -> DvbTdtSettings -> ShowS
Prelude.Show, (forall x. DvbTdtSettings -> Rep DvbTdtSettings x)
-> (forall x. Rep DvbTdtSettings x -> DvbTdtSettings)
-> Generic DvbTdtSettings
forall x. Rep DvbTdtSettings x -> DvbTdtSettings
forall x. DvbTdtSettings -> Rep DvbTdtSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DvbTdtSettings x -> DvbTdtSettings
$cfrom :: forall x. DvbTdtSettings -> Rep DvbTdtSettings x
Prelude.Generic)

-- |
-- Create a value of 'DvbTdtSettings' 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:
--
-- 'tdtInterval', 'dvbTdtSettings_tdtInterval' - The number of milliseconds between instances of this table in the output
-- transport stream.
newDvbTdtSettings ::
  DvbTdtSettings
newDvbTdtSettings :: DvbTdtSettings
newDvbTdtSettings =
  DvbTdtSettings' :: Maybe Natural -> DvbTdtSettings
DvbTdtSettings' {$sel:tdtInterval:DvbTdtSettings' :: Maybe Natural
tdtInterval = Maybe Natural
forall a. Maybe a
Prelude.Nothing}

-- | The number of milliseconds between instances of this table in the output
-- transport stream.
dvbTdtSettings_tdtInterval :: Lens.Lens' DvbTdtSettings (Prelude.Maybe Prelude.Natural)
dvbTdtSettings_tdtInterval :: (Maybe Natural -> f (Maybe Natural))
-> DvbTdtSettings -> f DvbTdtSettings
dvbTdtSettings_tdtInterval = (DvbTdtSettings -> Maybe Natural)
-> (DvbTdtSettings -> Maybe Natural -> DvbTdtSettings)
-> Lens
     DvbTdtSettings DvbTdtSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbTdtSettings' {Maybe Natural
tdtInterval :: Maybe Natural
$sel:tdtInterval:DvbTdtSettings' :: DvbTdtSettings -> Maybe Natural
tdtInterval} -> Maybe Natural
tdtInterval) (\s :: DvbTdtSettings
s@DvbTdtSettings' {} Maybe Natural
a -> DvbTdtSettings
s {$sel:tdtInterval:DvbTdtSettings' :: Maybe Natural
tdtInterval = Maybe Natural
a} :: DvbTdtSettings)

instance Core.FromJSON DvbTdtSettings where
  parseJSON :: Value -> Parser DvbTdtSettings
parseJSON =
    String
-> (Object -> Parser DvbTdtSettings)
-> Value
-> Parser DvbTdtSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DvbTdtSettings"
      ( \Object
x ->
          Maybe Natural -> DvbTdtSettings
DvbTdtSettings'
            (Maybe Natural -> DvbTdtSettings)
-> Parser (Maybe Natural) -> Parser DvbTdtSettings
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
"tdtInterval")
      )

instance Prelude.Hashable DvbTdtSettings

instance Prelude.NFData DvbTdtSettings

instance Core.ToJSON DvbTdtSettings where
  toJSON :: DvbTdtSettings -> Value
toJSON DvbTdtSettings' {Maybe Natural
tdtInterval :: Maybe Natural
$sel:tdtInterval:DvbTdtSettings' :: DvbTdtSettings -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"tdtInterval" 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
tdtInterval]
      )