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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.AccelerationMode
import qualified Amazonka.Prelude as Prelude

-- | Accelerated transcoding can significantly speed up jobs with long,
-- visually complex content.
--
-- /See:/ 'newAccelerationSettings' smart constructor.
data AccelerationSettings = AccelerationSettings'
  { -- | Specify the conditions when the service will run your job with
    -- accelerated transcoding.
    AccelerationSettings -> AccelerationMode
mode :: AccelerationMode
  }
  deriving (AccelerationSettings -> AccelerationSettings -> Bool
(AccelerationSettings -> AccelerationSettings -> Bool)
-> (AccelerationSettings -> AccelerationSettings -> Bool)
-> Eq AccelerationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccelerationSettings -> AccelerationSettings -> Bool
$c/= :: AccelerationSettings -> AccelerationSettings -> Bool
== :: AccelerationSettings -> AccelerationSettings -> Bool
$c== :: AccelerationSettings -> AccelerationSettings -> Bool
Prelude.Eq, ReadPrec [AccelerationSettings]
ReadPrec AccelerationSettings
Int -> ReadS AccelerationSettings
ReadS [AccelerationSettings]
(Int -> ReadS AccelerationSettings)
-> ReadS [AccelerationSettings]
-> ReadPrec AccelerationSettings
-> ReadPrec [AccelerationSettings]
-> Read AccelerationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccelerationSettings]
$creadListPrec :: ReadPrec [AccelerationSettings]
readPrec :: ReadPrec AccelerationSettings
$creadPrec :: ReadPrec AccelerationSettings
readList :: ReadS [AccelerationSettings]
$creadList :: ReadS [AccelerationSettings]
readsPrec :: Int -> ReadS AccelerationSettings
$creadsPrec :: Int -> ReadS AccelerationSettings
Prelude.Read, Int -> AccelerationSettings -> ShowS
[AccelerationSettings] -> ShowS
AccelerationSettings -> String
(Int -> AccelerationSettings -> ShowS)
-> (AccelerationSettings -> String)
-> ([AccelerationSettings] -> ShowS)
-> Show AccelerationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccelerationSettings] -> ShowS
$cshowList :: [AccelerationSettings] -> ShowS
show :: AccelerationSettings -> String
$cshow :: AccelerationSettings -> String
showsPrec :: Int -> AccelerationSettings -> ShowS
$cshowsPrec :: Int -> AccelerationSettings -> ShowS
Prelude.Show, (forall x. AccelerationSettings -> Rep AccelerationSettings x)
-> (forall x. Rep AccelerationSettings x -> AccelerationSettings)
-> Generic AccelerationSettings
forall x. Rep AccelerationSettings x -> AccelerationSettings
forall x. AccelerationSettings -> Rep AccelerationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccelerationSettings x -> AccelerationSettings
$cfrom :: forall x. AccelerationSettings -> Rep AccelerationSettings x
Prelude.Generic)

-- |
-- Create a value of 'AccelerationSettings' 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:
--
-- 'mode', 'accelerationSettings_mode' - Specify the conditions when the service will run your job with
-- accelerated transcoding.
newAccelerationSettings ::
  -- | 'mode'
  AccelerationMode ->
  AccelerationSettings
newAccelerationSettings :: AccelerationMode -> AccelerationSettings
newAccelerationSettings AccelerationMode
pMode_ =
  AccelerationSettings' :: AccelerationMode -> AccelerationSettings
AccelerationSettings' {$sel:mode:AccelerationSettings' :: AccelerationMode
mode = AccelerationMode
pMode_}

-- | Specify the conditions when the service will run your job with
-- accelerated transcoding.
accelerationSettings_mode :: Lens.Lens' AccelerationSettings AccelerationMode
accelerationSettings_mode :: (AccelerationMode -> f AccelerationMode)
-> AccelerationSettings -> f AccelerationSettings
accelerationSettings_mode = (AccelerationSettings -> AccelerationMode)
-> (AccelerationSettings
    -> AccelerationMode -> AccelerationSettings)
-> Lens
     AccelerationSettings
     AccelerationSettings
     AccelerationMode
     AccelerationMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccelerationSettings' {AccelerationMode
mode :: AccelerationMode
$sel:mode:AccelerationSettings' :: AccelerationSettings -> AccelerationMode
mode} -> AccelerationMode
mode) (\s :: AccelerationSettings
s@AccelerationSettings' {} AccelerationMode
a -> AccelerationSettings
s {$sel:mode:AccelerationSettings' :: AccelerationMode
mode = AccelerationMode
a} :: AccelerationSettings)

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

instance Prelude.Hashable AccelerationSettings

instance Prelude.NFData AccelerationSettings

instance Core.ToJSON AccelerationSettings where
  toJSON :: AccelerationSettings -> Value
toJSON AccelerationSettings' {AccelerationMode
mode :: AccelerationMode
$sel:mode:AccelerationSettings' :: AccelerationSettings -> AccelerationMode
..} =
    [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
"mode" Text -> AccelerationMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AccelerationMode
mode)]
      )