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

-- | DVB Time and Date Table (SDT)
--
-- /See:/ 'newDvbTdtSettings' smart constructor.
data DvbTdtSettings = DvbTdtSettings'
  { -- | The number of milliseconds between instances of this table in the output
    -- transport stream.
    DvbTdtSettings -> Maybe Natural
repInterval :: Prelude.Maybe Prelude.Natural
  }
  deriving (DvbTdtSettings -> DvbTdtSettings -> Bool
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]
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
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. 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:
--
-- 'repInterval', 'dvbTdtSettings_repInterval' - The number of milliseconds between instances of this table in the output
-- transport stream.
newDvbTdtSettings ::
  DvbTdtSettings
newDvbTdtSettings :: DvbTdtSettings
newDvbTdtSettings =
  DvbTdtSettings' {$sel:repInterval:DvbTdtSettings' :: Maybe Natural
repInterval = forall a. Maybe a
Prelude.Nothing}

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

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

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

instance Prelude.NFData DvbTdtSettings where
  rnf :: DvbTdtSettings -> ()
rnf DvbTdtSettings' {Maybe Natural
repInterval :: Maybe Natural
$sel:repInterval:DvbTdtSettings' :: DvbTdtSettings -> Maybe Natural
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
repInterval

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