{-# 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.VideoSelectorProgramId
-- 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.MediaLive.Types.VideoSelectorProgramId where

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

-- | Video Selector Program Id
--
-- /See:/ 'newVideoSelectorProgramId' smart constructor.
data VideoSelectorProgramId = VideoSelectorProgramId'
  { -- | Selects a specific program from within a multi-program transport stream.
    -- If the program doesn\'t exist, the first program within the transport
    -- stream will be selected by default.
    VideoSelectorProgramId -> Maybe Natural
programId :: Prelude.Maybe Prelude.Natural
  }
  deriving (VideoSelectorProgramId -> VideoSelectorProgramId -> Bool
(VideoSelectorProgramId -> VideoSelectorProgramId -> Bool)
-> (VideoSelectorProgramId -> VideoSelectorProgramId -> Bool)
-> Eq VideoSelectorProgramId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoSelectorProgramId -> VideoSelectorProgramId -> Bool
$c/= :: VideoSelectorProgramId -> VideoSelectorProgramId -> Bool
== :: VideoSelectorProgramId -> VideoSelectorProgramId -> Bool
$c== :: VideoSelectorProgramId -> VideoSelectorProgramId -> Bool
Prelude.Eq, ReadPrec [VideoSelectorProgramId]
ReadPrec VideoSelectorProgramId
Int -> ReadS VideoSelectorProgramId
ReadS [VideoSelectorProgramId]
(Int -> ReadS VideoSelectorProgramId)
-> ReadS [VideoSelectorProgramId]
-> ReadPrec VideoSelectorProgramId
-> ReadPrec [VideoSelectorProgramId]
-> Read VideoSelectorProgramId
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VideoSelectorProgramId]
$creadListPrec :: ReadPrec [VideoSelectorProgramId]
readPrec :: ReadPrec VideoSelectorProgramId
$creadPrec :: ReadPrec VideoSelectorProgramId
readList :: ReadS [VideoSelectorProgramId]
$creadList :: ReadS [VideoSelectorProgramId]
readsPrec :: Int -> ReadS VideoSelectorProgramId
$creadsPrec :: Int -> ReadS VideoSelectorProgramId
Prelude.Read, Int -> VideoSelectorProgramId -> ShowS
[VideoSelectorProgramId] -> ShowS
VideoSelectorProgramId -> String
(Int -> VideoSelectorProgramId -> ShowS)
-> (VideoSelectorProgramId -> String)
-> ([VideoSelectorProgramId] -> ShowS)
-> Show VideoSelectorProgramId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VideoSelectorProgramId] -> ShowS
$cshowList :: [VideoSelectorProgramId] -> ShowS
show :: VideoSelectorProgramId -> String
$cshow :: VideoSelectorProgramId -> String
showsPrec :: Int -> VideoSelectorProgramId -> ShowS
$cshowsPrec :: Int -> VideoSelectorProgramId -> ShowS
Prelude.Show, (forall x. VideoSelectorProgramId -> Rep VideoSelectorProgramId x)
-> (forall x.
    Rep VideoSelectorProgramId x -> VideoSelectorProgramId)
-> Generic VideoSelectorProgramId
forall x. Rep VideoSelectorProgramId x -> VideoSelectorProgramId
forall x. VideoSelectorProgramId -> Rep VideoSelectorProgramId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VideoSelectorProgramId x -> VideoSelectorProgramId
$cfrom :: forall x. VideoSelectorProgramId -> Rep VideoSelectorProgramId x
Prelude.Generic)

-- |
-- Create a value of 'VideoSelectorProgramId' 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:
--
-- 'programId', 'videoSelectorProgramId_programId' - Selects a specific program from within a multi-program transport stream.
-- If the program doesn\'t exist, the first program within the transport
-- stream will be selected by default.
newVideoSelectorProgramId ::
  VideoSelectorProgramId
newVideoSelectorProgramId :: VideoSelectorProgramId
newVideoSelectorProgramId =
  VideoSelectorProgramId' :: Maybe Natural -> VideoSelectorProgramId
VideoSelectorProgramId'
    { $sel:programId:VideoSelectorProgramId' :: Maybe Natural
programId =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Selects a specific program from within a multi-program transport stream.
-- If the program doesn\'t exist, the first program within the transport
-- stream will be selected by default.
videoSelectorProgramId_programId :: Lens.Lens' VideoSelectorProgramId (Prelude.Maybe Prelude.Natural)
videoSelectorProgramId_programId :: (Maybe Natural -> f (Maybe Natural))
-> VideoSelectorProgramId -> f VideoSelectorProgramId
videoSelectorProgramId_programId = (VideoSelectorProgramId -> Maybe Natural)
-> (VideoSelectorProgramId
    -> Maybe Natural -> VideoSelectorProgramId)
-> Lens
     VideoSelectorProgramId
     VideoSelectorProgramId
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelectorProgramId' {Maybe Natural
programId :: Maybe Natural
$sel:programId:VideoSelectorProgramId' :: VideoSelectorProgramId -> Maybe Natural
programId} -> Maybe Natural
programId) (\s :: VideoSelectorProgramId
s@VideoSelectorProgramId' {} Maybe Natural
a -> VideoSelectorProgramId
s {$sel:programId:VideoSelectorProgramId' :: Maybe Natural
programId = Maybe Natural
a} :: VideoSelectorProgramId)

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

instance Prelude.Hashable VideoSelectorProgramId

instance Prelude.NFData VideoSelectorProgramId

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