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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(AiffSettings -> AiffSettings -> Bool)
-> (AiffSettings -> AiffSettings -> Bool) -> Eq AiffSettings
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]
(Int -> ReadS AiffSettings)
-> ReadS [AiffSettings]
-> ReadPrec AiffSettings
-> ReadPrec [AiffSettings]
-> Read 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
(Int -> AiffSettings -> ShowS)
-> (AiffSettings -> String)
-> ([AiffSettings] -> ShowS)
-> Show AiffSettings
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. AiffSettings -> Rep AiffSettings x)
-> (forall x. Rep AiffSettings x -> AiffSettings)
-> Generic AiffSettings
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' :: Maybe Natural -> Maybe Natural -> Maybe Natural -> AiffSettings
AiffSettings'
    { $sel:bitDepth:AiffSettings' :: Maybe Natural
bitDepth = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:channels:AiffSettings' :: Maybe Natural
channels = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sampleRate:AiffSettings' :: Maybe Natural
sampleRate = Maybe Natural
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 :: (Maybe Natural -> f (Maybe Natural))
-> AiffSettings -> f AiffSettings
aiffSettings_bitDepth = (AiffSettings -> Maybe Natural)
-> (AiffSettings -> Maybe Natural -> AiffSettings)
-> Lens AiffSettings AiffSettings (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural))
-> AiffSettings -> f AiffSettings
aiffSettings_channels = (AiffSettings -> Maybe Natural)
-> (AiffSettings -> Maybe Natural -> AiffSettings)
-> Lens AiffSettings AiffSettings (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural))
-> AiffSettings -> f AiffSettings
aiffSettings_sampleRate = (AiffSettings -> Maybe Natural)
-> (AiffSettings -> Maybe Natural -> AiffSettings)
-> Lens AiffSettings AiffSettings (Maybe Natural) (Maybe Natural)
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 Core.FromJSON AiffSettings where
  parseJSON :: Value -> Parser AiffSettings
parseJSON =
    String
-> (Object -> Parser AiffSettings) -> Value -> Parser AiffSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AiffSettings"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> Maybe Natural -> AiffSettings
AiffSettings'
            (Maybe Natural -> Maybe Natural -> Maybe Natural -> AiffSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> AiffSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bitDepth")
            Parser (Maybe Natural -> Maybe Natural -> AiffSettings)
-> Parser (Maybe Natural) -> Parser (Maybe Natural -> AiffSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"channels")
            Parser (Maybe Natural -> AiffSettings)
-> Parser (Maybe Natural) -> Parser AiffSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sampleRate")
      )

instance Prelude.Hashable AiffSettings

instance Prelude.NFData AiffSettings

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"bitDepth" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
bitDepth,
            (Text
"channels" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
channels,
            (Text
"sampleRate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
sampleRate
          ]
      )