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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.OutputSdt
import qualified Amazonka.Prelude as Prelude

-- | Use these settings to insert a DVB Service Description Table (SDT) 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:/ 'newDvbSdtSettings' smart constructor.
data DvbSdtSettings = DvbSdtSettings'
  { -- | The number of milliseconds between instances of this table in the output
    -- transport stream.
    DvbSdtSettings -> Maybe Natural
sdtInterval :: Prelude.Maybe Prelude.Natural,
    -- | The service provider name placed in the service_descriptor in the
    -- Service Description Table. Maximum length is 256 characters.
    DvbSdtSettings -> Maybe Text
serviceProviderName :: Prelude.Maybe Prelude.Text,
    -- | Selects method of inserting SDT information into output stream. \"Follow
    -- input SDT\" copies SDT information from input stream to output stream.
    -- \"Follow input SDT if present\" copies SDT information from input stream
    -- to output stream if SDT information is present in the input, otherwise
    -- it will fall back on the user-defined values. Enter \"SDT Manually\"
    -- means user will enter the SDT information. \"No SDT\" means output
    -- stream will not contain SDT information.
    DvbSdtSettings -> Maybe OutputSdt
outputSdt :: Prelude.Maybe OutputSdt,
    -- | The service name placed in the service_descriptor in the Service
    -- Description Table. Maximum length is 256 characters.
    DvbSdtSettings -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text
  }
  deriving (DvbSdtSettings -> DvbSdtSettings -> Bool
(DvbSdtSettings -> DvbSdtSettings -> Bool)
-> (DvbSdtSettings -> DvbSdtSettings -> Bool) -> Eq DvbSdtSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DvbSdtSettings -> DvbSdtSettings -> Bool
$c/= :: DvbSdtSettings -> DvbSdtSettings -> Bool
== :: DvbSdtSettings -> DvbSdtSettings -> Bool
$c== :: DvbSdtSettings -> DvbSdtSettings -> Bool
Prelude.Eq, ReadPrec [DvbSdtSettings]
ReadPrec DvbSdtSettings
Int -> ReadS DvbSdtSettings
ReadS [DvbSdtSettings]
(Int -> ReadS DvbSdtSettings)
-> ReadS [DvbSdtSettings]
-> ReadPrec DvbSdtSettings
-> ReadPrec [DvbSdtSettings]
-> Read DvbSdtSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DvbSdtSettings]
$creadListPrec :: ReadPrec [DvbSdtSettings]
readPrec :: ReadPrec DvbSdtSettings
$creadPrec :: ReadPrec DvbSdtSettings
readList :: ReadS [DvbSdtSettings]
$creadList :: ReadS [DvbSdtSettings]
readsPrec :: Int -> ReadS DvbSdtSettings
$creadsPrec :: Int -> ReadS DvbSdtSettings
Prelude.Read, Int -> DvbSdtSettings -> ShowS
[DvbSdtSettings] -> ShowS
DvbSdtSettings -> String
(Int -> DvbSdtSettings -> ShowS)
-> (DvbSdtSettings -> String)
-> ([DvbSdtSettings] -> ShowS)
-> Show DvbSdtSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DvbSdtSettings] -> ShowS
$cshowList :: [DvbSdtSettings] -> ShowS
show :: DvbSdtSettings -> String
$cshow :: DvbSdtSettings -> String
showsPrec :: Int -> DvbSdtSettings -> ShowS
$cshowsPrec :: Int -> DvbSdtSettings -> ShowS
Prelude.Show, (forall x. DvbSdtSettings -> Rep DvbSdtSettings x)
-> (forall x. Rep DvbSdtSettings x -> DvbSdtSettings)
-> Generic DvbSdtSettings
forall x. Rep DvbSdtSettings x -> DvbSdtSettings
forall x. DvbSdtSettings -> Rep DvbSdtSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DvbSdtSettings x -> DvbSdtSettings
$cfrom :: forall x. DvbSdtSettings -> Rep DvbSdtSettings x
Prelude.Generic)

-- |
-- Create a value of 'DvbSdtSettings' 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:
--
-- 'sdtInterval', 'dvbSdtSettings_sdtInterval' - The number of milliseconds between instances of this table in the output
-- transport stream.
--
-- 'serviceProviderName', 'dvbSdtSettings_serviceProviderName' - The service provider name placed in the service_descriptor in the
-- Service Description Table. Maximum length is 256 characters.
--
-- 'outputSdt', 'dvbSdtSettings_outputSdt' - Selects method of inserting SDT information into output stream. \"Follow
-- input SDT\" copies SDT information from input stream to output stream.
-- \"Follow input SDT if present\" copies SDT information from input stream
-- to output stream if SDT information is present in the input, otherwise
-- it will fall back on the user-defined values. Enter \"SDT Manually\"
-- means user will enter the SDT information. \"No SDT\" means output
-- stream will not contain SDT information.
--
-- 'serviceName', 'dvbSdtSettings_serviceName' - The service name placed in the service_descriptor in the Service
-- Description Table. Maximum length is 256 characters.
newDvbSdtSettings ::
  DvbSdtSettings
newDvbSdtSettings :: DvbSdtSettings
newDvbSdtSettings =
  DvbSdtSettings' :: Maybe Natural
-> Maybe Text -> Maybe OutputSdt -> Maybe Text -> DvbSdtSettings
DvbSdtSettings'
    { $sel:sdtInterval:DvbSdtSettings' :: Maybe Natural
sdtInterval = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceProviderName:DvbSdtSettings' :: Maybe Text
serviceProviderName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputSdt:DvbSdtSettings' :: Maybe OutputSdt
outputSdt = Maybe OutputSdt
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:DvbSdtSettings' :: Maybe Text
serviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The service provider name placed in the service_descriptor in the
-- Service Description Table. Maximum length is 256 characters.
dvbSdtSettings_serviceProviderName :: Lens.Lens' DvbSdtSettings (Prelude.Maybe Prelude.Text)
dvbSdtSettings_serviceProviderName :: (Maybe Text -> f (Maybe Text))
-> DvbSdtSettings -> f DvbSdtSettings
dvbSdtSettings_serviceProviderName = (DvbSdtSettings -> Maybe Text)
-> (DvbSdtSettings -> Maybe Text -> DvbSdtSettings)
-> Lens DvbSdtSettings DvbSdtSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbSdtSettings' {Maybe Text
serviceProviderName :: Maybe Text
$sel:serviceProviderName:DvbSdtSettings' :: DvbSdtSettings -> Maybe Text
serviceProviderName} -> Maybe Text
serviceProviderName) (\s :: DvbSdtSettings
s@DvbSdtSettings' {} Maybe Text
a -> DvbSdtSettings
s {$sel:serviceProviderName:DvbSdtSettings' :: Maybe Text
serviceProviderName = Maybe Text
a} :: DvbSdtSettings)

-- | Selects method of inserting SDT information into output stream. \"Follow
-- input SDT\" copies SDT information from input stream to output stream.
-- \"Follow input SDT if present\" copies SDT information from input stream
-- to output stream if SDT information is present in the input, otherwise
-- it will fall back on the user-defined values. Enter \"SDT Manually\"
-- means user will enter the SDT information. \"No SDT\" means output
-- stream will not contain SDT information.
dvbSdtSettings_outputSdt :: Lens.Lens' DvbSdtSettings (Prelude.Maybe OutputSdt)
dvbSdtSettings_outputSdt :: (Maybe OutputSdt -> f (Maybe OutputSdt))
-> DvbSdtSettings -> f DvbSdtSettings
dvbSdtSettings_outputSdt = (DvbSdtSettings -> Maybe OutputSdt)
-> (DvbSdtSettings -> Maybe OutputSdt -> DvbSdtSettings)
-> Lens
     DvbSdtSettings DvbSdtSettings (Maybe OutputSdt) (Maybe OutputSdt)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbSdtSettings' {Maybe OutputSdt
outputSdt :: Maybe OutputSdt
$sel:outputSdt:DvbSdtSettings' :: DvbSdtSettings -> Maybe OutputSdt
outputSdt} -> Maybe OutputSdt
outputSdt) (\s :: DvbSdtSettings
s@DvbSdtSettings' {} Maybe OutputSdt
a -> DvbSdtSettings
s {$sel:outputSdt:DvbSdtSettings' :: Maybe OutputSdt
outputSdt = Maybe OutputSdt
a} :: DvbSdtSettings)

-- | The service name placed in the service_descriptor in the Service
-- Description Table. Maximum length is 256 characters.
dvbSdtSettings_serviceName :: Lens.Lens' DvbSdtSettings (Prelude.Maybe Prelude.Text)
dvbSdtSettings_serviceName :: (Maybe Text -> f (Maybe Text))
-> DvbSdtSettings -> f DvbSdtSettings
dvbSdtSettings_serviceName = (DvbSdtSettings -> Maybe Text)
-> (DvbSdtSettings -> Maybe Text -> DvbSdtSettings)
-> Lens DvbSdtSettings DvbSdtSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbSdtSettings' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:DvbSdtSettings' :: DvbSdtSettings -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: DvbSdtSettings
s@DvbSdtSettings' {} Maybe Text
a -> DvbSdtSettings
s {$sel:serviceName:DvbSdtSettings' :: Maybe Text
serviceName = Maybe Text
a} :: DvbSdtSettings)

instance Core.FromJSON DvbSdtSettings where
  parseJSON :: Value -> Parser DvbSdtSettings
parseJSON =
    String
-> (Object -> Parser DvbSdtSettings)
-> Value
-> Parser DvbSdtSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DvbSdtSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Text -> Maybe OutputSdt -> Maybe Text -> DvbSdtSettings
DvbSdtSettings'
            (Maybe Natural
 -> Maybe Text -> Maybe OutputSdt -> Maybe Text -> DvbSdtSettings)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text -> Maybe OutputSdt -> Maybe Text -> DvbSdtSettings)
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
"sdtInterval")
            Parser
  (Maybe Text -> Maybe OutputSdt -> Maybe Text -> DvbSdtSettings)
-> Parser (Maybe Text)
-> Parser (Maybe OutputSdt -> Maybe Text -> DvbSdtSettings)
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
"serviceProviderName")
            Parser (Maybe OutputSdt -> Maybe Text -> DvbSdtSettings)
-> Parser (Maybe OutputSdt)
-> Parser (Maybe Text -> DvbSdtSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OutputSdt)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputSdt")
            Parser (Maybe Text -> DvbSdtSettings)
-> Parser (Maybe Text) -> Parser DvbSdtSettings
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
"serviceName")
      )

instance Prelude.Hashable DvbSdtSettings

instance Prelude.NFData DvbSdtSettings

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