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

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

-- | DVB Sub Source Settings
--
-- /See:/ 'newDvbSubSourceSettings' smart constructor.
data DvbSubSourceSettings = DvbSubSourceSettings'
  { -- | When using DVB-Sub with Burn-In or SMPTE-TT, use this PID for the source
    -- content. Unused for DVB-Sub passthrough. All DVB-Sub content is passed
    -- through, regardless of selectors.
    DvbSubSourceSettings -> Maybe Natural
pid :: Prelude.Maybe Prelude.Natural
  }
  deriving (DvbSubSourceSettings -> DvbSubSourceSettings -> Bool
(DvbSubSourceSettings -> DvbSubSourceSettings -> Bool)
-> (DvbSubSourceSettings -> DvbSubSourceSettings -> Bool)
-> Eq DvbSubSourceSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DvbSubSourceSettings -> DvbSubSourceSettings -> Bool
$c/= :: DvbSubSourceSettings -> DvbSubSourceSettings -> Bool
== :: DvbSubSourceSettings -> DvbSubSourceSettings -> Bool
$c== :: DvbSubSourceSettings -> DvbSubSourceSettings -> Bool
Prelude.Eq, ReadPrec [DvbSubSourceSettings]
ReadPrec DvbSubSourceSettings
Int -> ReadS DvbSubSourceSettings
ReadS [DvbSubSourceSettings]
(Int -> ReadS DvbSubSourceSettings)
-> ReadS [DvbSubSourceSettings]
-> ReadPrec DvbSubSourceSettings
-> ReadPrec [DvbSubSourceSettings]
-> Read DvbSubSourceSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DvbSubSourceSettings]
$creadListPrec :: ReadPrec [DvbSubSourceSettings]
readPrec :: ReadPrec DvbSubSourceSettings
$creadPrec :: ReadPrec DvbSubSourceSettings
readList :: ReadS [DvbSubSourceSettings]
$creadList :: ReadS [DvbSubSourceSettings]
readsPrec :: Int -> ReadS DvbSubSourceSettings
$creadsPrec :: Int -> ReadS DvbSubSourceSettings
Prelude.Read, Int -> DvbSubSourceSettings -> ShowS
[DvbSubSourceSettings] -> ShowS
DvbSubSourceSettings -> String
(Int -> DvbSubSourceSettings -> ShowS)
-> (DvbSubSourceSettings -> String)
-> ([DvbSubSourceSettings] -> ShowS)
-> Show DvbSubSourceSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DvbSubSourceSettings] -> ShowS
$cshowList :: [DvbSubSourceSettings] -> ShowS
show :: DvbSubSourceSettings -> String
$cshow :: DvbSubSourceSettings -> String
showsPrec :: Int -> DvbSubSourceSettings -> ShowS
$cshowsPrec :: Int -> DvbSubSourceSettings -> ShowS
Prelude.Show, (forall x. DvbSubSourceSettings -> Rep DvbSubSourceSettings x)
-> (forall x. Rep DvbSubSourceSettings x -> DvbSubSourceSettings)
-> Generic DvbSubSourceSettings
forall x. Rep DvbSubSourceSettings x -> DvbSubSourceSettings
forall x. DvbSubSourceSettings -> Rep DvbSubSourceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DvbSubSourceSettings x -> DvbSubSourceSettings
$cfrom :: forall x. DvbSubSourceSettings -> Rep DvbSubSourceSettings x
Prelude.Generic)

-- |
-- Create a value of 'DvbSubSourceSettings' 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:
--
-- 'pid', 'dvbSubSourceSettings_pid' - When using DVB-Sub with Burn-In or SMPTE-TT, use this PID for the source
-- content. Unused for DVB-Sub passthrough. All DVB-Sub content is passed
-- through, regardless of selectors.
newDvbSubSourceSettings ::
  DvbSubSourceSettings
newDvbSubSourceSettings :: DvbSubSourceSettings
newDvbSubSourceSettings =
  DvbSubSourceSettings' :: Maybe Natural -> DvbSubSourceSettings
DvbSubSourceSettings' {$sel:pid:DvbSubSourceSettings' :: Maybe Natural
pid = Maybe Natural
forall a. Maybe a
Prelude.Nothing}

-- | When using DVB-Sub with Burn-In or SMPTE-TT, use this PID for the source
-- content. Unused for DVB-Sub passthrough. All DVB-Sub content is passed
-- through, regardless of selectors.
dvbSubSourceSettings_pid :: Lens.Lens' DvbSubSourceSettings (Prelude.Maybe Prelude.Natural)
dvbSubSourceSettings_pid :: (Maybe Natural -> f (Maybe Natural))
-> DvbSubSourceSettings -> f DvbSubSourceSettings
dvbSubSourceSettings_pid = (DvbSubSourceSettings -> Maybe Natural)
-> (DvbSubSourceSettings -> Maybe Natural -> DvbSubSourceSettings)
-> Lens
     DvbSubSourceSettings
     DvbSubSourceSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DvbSubSourceSettings' {Maybe Natural
pid :: Maybe Natural
$sel:pid:DvbSubSourceSettings' :: DvbSubSourceSettings -> Maybe Natural
pid} -> Maybe Natural
pid) (\s :: DvbSubSourceSettings
s@DvbSubSourceSettings' {} Maybe Natural
a -> DvbSubSourceSettings
s {$sel:pid:DvbSubSourceSettings' :: Maybe Natural
pid = Maybe Natural
a} :: DvbSubSourceSettings)

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

instance Prelude.Hashable DvbSubSourceSettings

instance Prelude.NFData DvbSubSourceSettings

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