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

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

-- | Audio Track
--
-- /See:/ 'newAudioTrack' smart constructor.
data AudioTrack = AudioTrack'
  { -- | 1-based integer value that maps to a specific audio track
    AudioTrack -> Natural
track :: Prelude.Natural
  }
  deriving (AudioTrack -> AudioTrack -> Bool
(AudioTrack -> AudioTrack -> Bool)
-> (AudioTrack -> AudioTrack -> Bool) -> Eq AudioTrack
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioTrack -> AudioTrack -> Bool
$c/= :: AudioTrack -> AudioTrack -> Bool
== :: AudioTrack -> AudioTrack -> Bool
$c== :: AudioTrack -> AudioTrack -> Bool
Prelude.Eq, ReadPrec [AudioTrack]
ReadPrec AudioTrack
Int -> ReadS AudioTrack
ReadS [AudioTrack]
(Int -> ReadS AudioTrack)
-> ReadS [AudioTrack]
-> ReadPrec AudioTrack
-> ReadPrec [AudioTrack]
-> Read AudioTrack
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioTrack]
$creadListPrec :: ReadPrec [AudioTrack]
readPrec :: ReadPrec AudioTrack
$creadPrec :: ReadPrec AudioTrack
readList :: ReadS [AudioTrack]
$creadList :: ReadS [AudioTrack]
readsPrec :: Int -> ReadS AudioTrack
$creadsPrec :: Int -> ReadS AudioTrack
Prelude.Read, Int -> AudioTrack -> ShowS
[AudioTrack] -> ShowS
AudioTrack -> String
(Int -> AudioTrack -> ShowS)
-> (AudioTrack -> String)
-> ([AudioTrack] -> ShowS)
-> Show AudioTrack
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioTrack] -> ShowS
$cshowList :: [AudioTrack] -> ShowS
show :: AudioTrack -> String
$cshow :: AudioTrack -> String
showsPrec :: Int -> AudioTrack -> ShowS
$cshowsPrec :: Int -> AudioTrack -> ShowS
Prelude.Show, (forall x. AudioTrack -> Rep AudioTrack x)
-> (forall x. Rep AudioTrack x -> AudioTrack) -> Generic AudioTrack
forall x. Rep AudioTrack x -> AudioTrack
forall x. AudioTrack -> Rep AudioTrack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioTrack x -> AudioTrack
$cfrom :: forall x. AudioTrack -> Rep AudioTrack x
Prelude.Generic)

-- |
-- Create a value of 'AudioTrack' 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:
--
-- 'track', 'audioTrack_track' - 1-based integer value that maps to a specific audio track
newAudioTrack ::
  -- | 'track'
  Prelude.Natural ->
  AudioTrack
newAudioTrack :: Natural -> AudioTrack
newAudioTrack Natural
pTrack_ = AudioTrack' :: Natural -> AudioTrack
AudioTrack' {$sel:track:AudioTrack' :: Natural
track = Natural
pTrack_}

-- | 1-based integer value that maps to a specific audio track
audioTrack_track :: Lens.Lens' AudioTrack Prelude.Natural
audioTrack_track :: (Natural -> f Natural) -> AudioTrack -> f AudioTrack
audioTrack_track = (AudioTrack -> Natural)
-> (AudioTrack -> Natural -> AudioTrack)
-> Lens AudioTrack AudioTrack Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioTrack' {Natural
track :: Natural
$sel:track:AudioTrack' :: AudioTrack -> Natural
track} -> Natural
track) (\s :: AudioTrack
s@AudioTrack' {} Natural
a -> AudioTrack
s {$sel:track:AudioTrack' :: Natural
track = Natural
a} :: AudioTrack)

instance Core.FromJSON AudioTrack where
  parseJSON :: Value -> Parser AudioTrack
parseJSON =
    String
-> (Object -> Parser AudioTrack) -> Value -> Parser AudioTrack
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AudioTrack"
      (\Object
x -> Natural -> AudioTrack
AudioTrack' (Natural -> AudioTrack) -> Parser Natural -> Parser AudioTrack
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"track"))

instance Prelude.Hashable AudioTrack

instance Prelude.NFData AudioTrack

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