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

-- | 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
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]
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
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. 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'
    { $sel:programId:VideoSelectorProgramId' :: Maybe Natural
programId =
        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 :: Lens' VideoSelectorProgramId (Maybe Natural)
videoSelectorProgramId_programId = 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 Data.FromJSON VideoSelectorProgramId where
  parseJSON :: Value -> Parser VideoSelectorProgramId
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VideoSelectorProgramId"
      ( \Object
x ->
          Maybe Natural -> VideoSelectorProgramId
VideoSelectorProgramId'
            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
"programId")
      )

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

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

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