{-# 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.DvbNitSettings
-- 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.DvbNitSettings 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 Network Information Table (NIT) 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:/ 'newDvbNitSettings' smart constructor.
data DvbNitSettings = DvbNitSettings'
  { -- | The numeric value placed in the Network Information Table (NIT).
    DvbNitSettings -> Maybe Natural
networkId :: Prelude.Maybe Prelude.Natural,
    -- | The network name text placed in the network_name_descriptor inside the
    -- Network Information Table. Maximum length is 256 characters.
    DvbNitSettings -> Maybe Text
networkName :: Prelude.Maybe Prelude.Text,
    -- | The number of milliseconds between instances of this table in the output
    -- transport stream.
    DvbNitSettings -> Maybe Natural
nitInterval :: Prelude.Maybe Prelude.Natural
  }
  deriving (DvbNitSettings -> DvbNitSettings -> Bool
(DvbNitSettings -> DvbNitSettings -> Bool)
-> (DvbNitSettings -> DvbNitSettings -> Bool) -> Eq DvbNitSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DvbNitSettings -> DvbNitSettings -> Bool
$c/= :: DvbNitSettings -> DvbNitSettings -> Bool
== :: DvbNitSettings -> DvbNitSettings -> Bool
$c== :: DvbNitSettings -> DvbNitSettings -> Bool
Prelude.Eq, ReadPrec [DvbNitSettings]
ReadPrec DvbNitSettings
Int -> ReadS DvbNitSettings
ReadS [DvbNitSettings]
(Int -> ReadS DvbNitSettings)
-> ReadS [DvbNitSettings]
-> ReadPrec DvbNitSettings
-> ReadPrec [DvbNitSettings]
-> Read DvbNitSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DvbNitSettings]
$creadListPrec :: ReadPrec [DvbNitSettings]
readPrec :: ReadPrec DvbNitSettings
$creadPrec :: ReadPrec DvbNitSettings
readList :: ReadS [DvbNitSettings]
$creadList :: ReadS [DvbNitSettings]
readsPrec :: Int -> ReadS DvbNitSettings
$creadsPrec :: Int -> ReadS DvbNitSettings
Prelude.Read, Int -> DvbNitSettings -> ShowS
[DvbNitSettings] -> ShowS
DvbNitSettings -> String
(Int -> DvbNitSettings -> ShowS)
-> (DvbNitSettings -> String)
-> ([DvbNitSettings] -> ShowS)
-> Show DvbNitSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DvbNitSettings] -> ShowS
$cshowList :: [DvbNitSettings] -> ShowS
show :: DvbNitSettings -> String
$cshow :: DvbNitSettings -> String
showsPrec :: Int -> DvbNitSettings -> ShowS
$cshowsPrec :: Int -> DvbNitSettings -> ShowS
Prelude.Show, (forall x. DvbNitSettings -> Rep DvbNitSettings x)
-> (forall x. Rep DvbNitSettings x -> DvbNitSettings)
-> Generic DvbNitSettings
forall x. Rep DvbNitSettings x -> DvbNitSettings
forall x. DvbNitSettings -> Rep DvbNitSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DvbNitSettings x -> DvbNitSettings
$cfrom :: forall x. DvbNitSettings -> Rep DvbNitSettings x
Prelude.Generic)

-- |
-- Create a value of 'DvbNitSettings' 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:
--
-- 'networkId', 'dvbNitSettings_networkId' - The numeric value placed in the Network Information Table (NIT).
--
-- 'networkName', 'dvbNitSettings_networkName' - The network name text placed in the network_name_descriptor inside the
-- Network Information Table. Maximum length is 256 characters.
--
-- 'nitInterval', 'dvbNitSettings_nitInterval' - The number of milliseconds between instances of this table in the output
-- transport stream.
newDvbNitSettings ::
  DvbNitSettings
newDvbNitSettings :: DvbNitSettings
newDvbNitSettings =
  DvbNitSettings' :: Maybe Natural -> Maybe Text -> Maybe Natural -> DvbNitSettings
DvbNitSettings'
    { $sel:networkId:DvbNitSettings' :: Maybe Natural
networkId = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:networkName:DvbNitSettings' :: Maybe Text
networkName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nitInterval:DvbNitSettings' :: Maybe Natural
nitInterval = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The numeric value placed in the Network Information Table (NIT).
dvbNitSettings_networkId :: Lens.Lens' DvbNitSettings (Prelude.Maybe Prelude.Natural)
dvbNitSettings_networkId :: (Maybe Natural -> f (Maybe Natural))
-> DvbNitSettings -> f DvbNitSettings
dvbNitSettings_networkId = (DvbNitSettings -> Maybe Natural)
-> (DvbNitSettings -> Maybe Natural -> DvbNitSettings)
-> Lens
     DvbNitSettings DvbNitSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbNitSettings' {Maybe Natural
networkId :: Maybe Natural
$sel:networkId:DvbNitSettings' :: DvbNitSettings -> Maybe Natural
networkId} -> Maybe Natural
networkId) (\s :: DvbNitSettings
s@DvbNitSettings' {} Maybe Natural
a -> DvbNitSettings
s {$sel:networkId:DvbNitSettings' :: Maybe Natural
networkId = Maybe Natural
a} :: DvbNitSettings)

-- | The network name text placed in the network_name_descriptor inside the
-- Network Information Table. Maximum length is 256 characters.
dvbNitSettings_networkName :: Lens.Lens' DvbNitSettings (Prelude.Maybe Prelude.Text)
dvbNitSettings_networkName :: (Maybe Text -> f (Maybe Text))
-> DvbNitSettings -> f DvbNitSettings
dvbNitSettings_networkName = (DvbNitSettings -> Maybe Text)
-> (DvbNitSettings -> Maybe Text -> DvbNitSettings)
-> Lens DvbNitSettings DvbNitSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbNitSettings' {Maybe Text
networkName :: Maybe Text
$sel:networkName:DvbNitSettings' :: DvbNitSettings -> Maybe Text
networkName} -> Maybe Text
networkName) (\s :: DvbNitSettings
s@DvbNitSettings' {} Maybe Text
a -> DvbNitSettings
s {$sel:networkName:DvbNitSettings' :: Maybe Text
networkName = Maybe Text
a} :: DvbNitSettings)

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

instance Core.FromJSON DvbNitSettings where
  parseJSON :: Value -> Parser DvbNitSettings
parseJSON =
    String
-> (Object -> Parser DvbNitSettings)
-> Value
-> Parser DvbNitSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DvbNitSettings"
      ( \Object
x ->
          Maybe Natural -> Maybe Text -> Maybe Natural -> DvbNitSettings
DvbNitSettings'
            (Maybe Natural -> Maybe Text -> Maybe Natural -> DvbNitSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> Maybe Natural -> DvbNitSettings)
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
"networkId")
            Parser (Maybe Text -> Maybe Natural -> DvbNitSettings)
-> Parser (Maybe Text) -> Parser (Maybe Natural -> DvbNitSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"networkName")
            Parser (Maybe Natural -> DvbNitSettings)
-> Parser (Maybe Natural) -> Parser DvbNitSettings
forall (f :: * -> *) a b. Applicative f => 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
"nitInterval")
      )

instance Prelude.Hashable DvbNitSettings

instance Prelude.NFData DvbNitSettings

instance Core.ToJSON DvbNitSettings where
  toJSON :: DvbNitSettings -> Value
toJSON DvbNitSettings' {Maybe Natural
Maybe Text
nitInterval :: Maybe Natural
networkName :: Maybe Text
networkId :: Maybe Natural
$sel:nitInterval:DvbNitSettings' :: DvbNitSettings -> Maybe Natural
$sel:networkName:DvbNitSettings' :: DvbNitSettings -> Maybe Text
$sel:networkId:DvbNitSettings' :: DvbNitSettings -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"networkId" 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
networkId,
            (Text
"networkName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
networkName,
            (Text
"nitInterval" 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
nitInterval
          ]
      )