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

-- | Audio Pid Selection
--
-- /See:/ 'newAudioPidSelection' smart constructor.
data AudioPidSelection = AudioPidSelection'
  { -- | Selects a specific PID from within a source.
    AudioPidSelection -> Natural
pid :: Prelude.Natural
  }
  deriving (AudioPidSelection -> AudioPidSelection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioPidSelection -> AudioPidSelection -> Bool
$c/= :: AudioPidSelection -> AudioPidSelection -> Bool
== :: AudioPidSelection -> AudioPidSelection -> Bool
$c== :: AudioPidSelection -> AudioPidSelection -> Bool
Prelude.Eq, ReadPrec [AudioPidSelection]
ReadPrec AudioPidSelection
Int -> ReadS AudioPidSelection
ReadS [AudioPidSelection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioPidSelection]
$creadListPrec :: ReadPrec [AudioPidSelection]
readPrec :: ReadPrec AudioPidSelection
$creadPrec :: ReadPrec AudioPidSelection
readList :: ReadS [AudioPidSelection]
$creadList :: ReadS [AudioPidSelection]
readsPrec :: Int -> ReadS AudioPidSelection
$creadsPrec :: Int -> ReadS AudioPidSelection
Prelude.Read, Int -> AudioPidSelection -> ShowS
[AudioPidSelection] -> ShowS
AudioPidSelection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioPidSelection] -> ShowS
$cshowList :: [AudioPidSelection] -> ShowS
show :: AudioPidSelection -> String
$cshow :: AudioPidSelection -> String
showsPrec :: Int -> AudioPidSelection -> ShowS
$cshowsPrec :: Int -> AudioPidSelection -> ShowS
Prelude.Show, forall x. Rep AudioPidSelection x -> AudioPidSelection
forall x. AudioPidSelection -> Rep AudioPidSelection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioPidSelection x -> AudioPidSelection
$cfrom :: forall x. AudioPidSelection -> Rep AudioPidSelection x
Prelude.Generic)

-- |
-- Create a value of 'AudioPidSelection' 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', 'audioPidSelection_pid' - Selects a specific PID from within a source.
newAudioPidSelection ::
  -- | 'pid'
  Prelude.Natural ->
  AudioPidSelection
newAudioPidSelection :: Natural -> AudioPidSelection
newAudioPidSelection Natural
pPid_ =
  AudioPidSelection' {$sel:pid:AudioPidSelection' :: Natural
pid = Natural
pPid_}

-- | Selects a specific PID from within a source.
audioPidSelection_pid :: Lens.Lens' AudioPidSelection Prelude.Natural
audioPidSelection_pid :: Lens' AudioPidSelection Natural
audioPidSelection_pid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioPidSelection' {Natural
pid :: Natural
$sel:pid:AudioPidSelection' :: AudioPidSelection -> Natural
pid} -> Natural
pid) (\s :: AudioPidSelection
s@AudioPidSelection' {} Natural
a -> AudioPidSelection
s {$sel:pid:AudioPidSelection' :: Natural
pid = Natural
a} :: AudioPidSelection)

instance Data.FromJSON AudioPidSelection where
  parseJSON :: Value -> Parser AudioPidSelection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioPidSelection"
      ( \Object
x ->
          Natural -> AudioPidSelection
AudioPidSelection' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"pid")
      )

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

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

instance Data.ToJSON AudioPidSelection where
  toJSON :: AudioPidSelection -> Value
toJSON AudioPidSelection' {Natural
pid :: Natural
$sel:pid:AudioPidSelection' :: AudioPidSelection -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"pid" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
pid)]
      )