{-# 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.MediaConvert.Types.AiffSettings
-- 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.MediaConvert.Types.AiffSettings 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

-- | Required when you set (Codec) under (AudioDescriptions)>(CodecSettings)
-- to the value AIFF.
--
-- /See:/ 'newAiffSettings' smart constructor.
data AiffSettings = AiffSettings'
  { -- | Specify Bit depth (BitDepth), in bits per sample, to choose the encoding
    -- quality for this audio track.
    AiffSettings -> Maybe Natural
bitDepth :: Prelude.Maybe Prelude.Natural,
    -- | Specify the number of channels in this output audio track. Valid values
    -- are 1 and even numbers up to 64. For example, 1, 2, 4, 6, and so on, up
    -- to 64.
    AiffSettings -> Maybe Natural
channels :: Prelude.Maybe Prelude.Natural,
    -- | Sample rate in hz.
    AiffSettings -> Maybe Natural
sampleRate :: Prelude.Maybe Prelude.Natural
  }
  deriving (AiffSettings -> AiffSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AiffSettings -> AiffSettings -> Bool
$c/= :: AiffSettings -> AiffSettings -> Bool
== :: AiffSettings -> AiffSettings -> Bool
$c== :: AiffSettings -> AiffSettings -> Bool
Prelude.Eq, ReadPrec [AiffSettings]
ReadPrec AiffSettings
Int -> ReadS AiffSettings
ReadS [AiffSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AiffSettings]
$creadListPrec :: ReadPrec [AiffSettings]
readPrec :: ReadPrec AiffSettings
$creadPrec :: ReadPrec AiffSettings
readList :: ReadS [AiffSettings]
$creadList :: ReadS [AiffSettings]
readsPrec :: Int -> ReadS AiffSettings
$creadsPrec :: Int -> ReadS AiffSettings
Prelude.Read, Int -> AiffSettings -> ShowS
[AiffSettings] -> ShowS
AiffSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AiffSettings] -> ShowS
$cshowList :: [AiffSettings] -> ShowS
show :: AiffSettings -> String
$cshow :: AiffSettings -> String
showsPrec :: Int -> AiffSettings -> ShowS
$cshowsPrec :: Int -> AiffSettings -> ShowS
Prelude.Show, forall x. Rep AiffSettings x -> AiffSettings
forall x. AiffSettings -> Rep AiffSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AiffSettings x -> AiffSettings
$cfrom :: forall x. AiffSettings -> Rep AiffSettings x
Prelude.Generic)

-- |
-- Create a value of 'AiffSettings' 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:
--
-- 'bitDepth', 'aiffSettings_bitDepth' - Specify Bit depth (BitDepth), in bits per sample, to choose the encoding
-- quality for this audio track.
--
-- 'channels', 'aiffSettings_channels' - Specify the number of channels in this output audio track. Valid values
-- are 1 and even numbers up to 64. For example, 1, 2, 4, 6, and so on, up
-- to 64.
--
-- 'sampleRate', 'aiffSettings_sampleRate' - Sample rate in hz.
newAiffSettings ::
  AiffSettings
newAiffSettings :: AiffSettings
newAiffSettings =
  AiffSettings'
    { $sel:bitDepth:AiffSettings' :: Maybe Natural
bitDepth = forall a. Maybe a
Prelude.Nothing,
      $sel:channels:AiffSettings' :: Maybe Natural
channels = forall a. Maybe a
Prelude.Nothing,
      $sel:sampleRate:AiffSettings' :: Maybe Natural
sampleRate = forall a. Maybe a
Prelude.Nothing
    }

-- | Specify Bit depth (BitDepth), in bits per sample, to choose the encoding
-- quality for this audio track.
aiffSettings_bitDepth :: Lens.Lens' AiffSettings (Prelude.Maybe Prelude.Natural)
aiffSettings_bitDepth :: Lens' AiffSettings (Maybe Natural)
aiffSettings_bitDepth = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AiffSettings' {Maybe Natural
bitDepth :: Maybe Natural
$sel:bitDepth:AiffSettings' :: AiffSettings -> Maybe Natural
bitDepth} -> Maybe Natural
bitDepth) (\s :: AiffSettings
s@AiffSettings' {} Maybe Natural
a -> AiffSettings
s {$sel:bitDepth:AiffSettings' :: Maybe Natural
bitDepth = Maybe Natural
a} :: AiffSettings)

-- | Specify the number of channels in this output audio track. Valid values
-- are 1 and even numbers up to 64. For example, 1, 2, 4, 6, and so on, up
-- to 64.
aiffSettings_channels :: Lens.Lens' AiffSettings (Prelude.Maybe Prelude.Natural)
aiffSettings_channels :: Lens' AiffSettings (Maybe Natural)
aiffSettings_channels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AiffSettings' {Maybe Natural
channels :: Maybe Natural
$sel:channels:AiffSettings' :: AiffSettings -> Maybe Natural
channels} -> Maybe Natural
channels) (\s :: AiffSettings
s@AiffSettings' {} Maybe Natural
a -> AiffSettings
s {$sel:channels:AiffSettings' :: Maybe Natural
channels = Maybe Natural
a} :: AiffSettings)

-- | Sample rate in hz.
aiffSettings_sampleRate :: Lens.Lens' AiffSettings (Prelude.Maybe Prelude.Natural)
aiffSettings_sampleRate :: Lens' AiffSettings (Maybe Natural)
aiffSettings_sampleRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AiffSettings' {Maybe Natural
sampleRate :: Maybe Natural
$sel:sampleRate:AiffSettings' :: AiffSettings -> Maybe Natural
sampleRate} -> Maybe Natural
sampleRate) (\s :: AiffSettings
s@AiffSettings' {} Maybe Natural
a -> AiffSettings
s {$sel:sampleRate:AiffSettings' :: Maybe Natural
sampleRate = Maybe Natural
a} :: AiffSettings)

instance Data.FromJSON AiffSettings where
  parseJSON :: Value -> Parser AiffSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AiffSettings"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> Maybe Natural -> AiffSettings
AiffSettings'
            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
"bitDepth")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"channels")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"sampleRate")
      )

instance Prelude.Hashable AiffSettings where
  hashWithSalt :: Int -> AiffSettings -> Int
hashWithSalt Int
_salt AiffSettings' {Maybe Natural
sampleRate :: Maybe Natural
channels :: Maybe Natural
bitDepth :: Maybe Natural
$sel:sampleRate:AiffSettings' :: AiffSettings -> Maybe Natural
$sel:channels:AiffSettings' :: AiffSettings -> Maybe Natural
$sel:bitDepth:AiffSettings' :: AiffSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
bitDepth
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
channels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
sampleRate

instance Prelude.NFData AiffSettings where
  rnf :: AiffSettings -> ()
rnf AiffSettings' {Maybe Natural
sampleRate :: Maybe Natural
channels :: Maybe Natural
bitDepth :: Maybe Natural
$sel:sampleRate:AiffSettings' :: AiffSettings -> Maybe Natural
$sel:channels:AiffSettings' :: AiffSettings -> Maybe Natural
$sel:bitDepth:AiffSettings' :: AiffSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
bitDepth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
channels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
sampleRate

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