{-# 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-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.AudioTrack 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 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
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]
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
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. 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' {$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 :: Lens' AudioTrack Natural
audioTrack_track = 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 Data.FromJSON AudioTrack where
  parseJSON :: Value -> Parser AudioTrack
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioTrack"
      (\Object
x -> Natural -> AudioTrack
AudioTrack' 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
"track"))

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

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

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