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

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

-- | Use automated ABR to have MediaConvert set up the renditions in your ABR
-- package for you automatically, based on characteristics of your input
-- video. This feature optimizes video quality while minimizing the overall
-- size of your ABR package.
--
-- /See:/ 'newAutomatedAbrSettings' smart constructor.
data AutomatedAbrSettings = AutomatedAbrSettings'
  { -- | Optional. The maximum number of renditions that MediaConvert will create
    -- in your automated ABR stack. The number of renditions is determined
    -- automatically, based on analysis of each job, but will never exceed this
    -- limit. When you set this to Auto in the console, which is equivalent to
    -- excluding it from your JSON job specification, MediaConvert defaults to
    -- a limit of 15.
    AutomatedAbrSettings -> Maybe Natural
maxRenditions :: Prelude.Maybe Prelude.Natural,
    -- | Optional. The maximum target bit rate used in your automated ABR stack.
    -- Use this value to set an upper limit on the bandwidth consumed by the
    -- highest-quality rendition. This is the rendition that is delivered to
    -- viewers with the fastest internet connections. If you don\'t specify a
    -- value, MediaConvert uses 8,000,000 (8 mb\/s) by default.
    AutomatedAbrSettings -> Maybe Natural
maxAbrBitrate :: Prelude.Maybe Prelude.Natural,
    -- | Optional. The minimum target bitrate used in your automated ABR stack.
    -- Use this value to set a lower limit on the bitrate of video delivered to
    -- viewers with slow internet connections. If you don\'t specify a value,
    -- MediaConvert uses 600,000 (600 kb\/s) by default.
    AutomatedAbrSettings -> Maybe Natural
minAbrBitrate :: Prelude.Maybe Prelude.Natural
  }
  deriving (AutomatedAbrSettings -> AutomatedAbrSettings -> Bool
(AutomatedAbrSettings -> AutomatedAbrSettings -> Bool)
-> (AutomatedAbrSettings -> AutomatedAbrSettings -> Bool)
-> Eq AutomatedAbrSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutomatedAbrSettings -> AutomatedAbrSettings -> Bool
$c/= :: AutomatedAbrSettings -> AutomatedAbrSettings -> Bool
== :: AutomatedAbrSettings -> AutomatedAbrSettings -> Bool
$c== :: AutomatedAbrSettings -> AutomatedAbrSettings -> Bool
Prelude.Eq, ReadPrec [AutomatedAbrSettings]
ReadPrec AutomatedAbrSettings
Int -> ReadS AutomatedAbrSettings
ReadS [AutomatedAbrSettings]
(Int -> ReadS AutomatedAbrSettings)
-> ReadS [AutomatedAbrSettings]
-> ReadPrec AutomatedAbrSettings
-> ReadPrec [AutomatedAbrSettings]
-> Read AutomatedAbrSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutomatedAbrSettings]
$creadListPrec :: ReadPrec [AutomatedAbrSettings]
readPrec :: ReadPrec AutomatedAbrSettings
$creadPrec :: ReadPrec AutomatedAbrSettings
readList :: ReadS [AutomatedAbrSettings]
$creadList :: ReadS [AutomatedAbrSettings]
readsPrec :: Int -> ReadS AutomatedAbrSettings
$creadsPrec :: Int -> ReadS AutomatedAbrSettings
Prelude.Read, Int -> AutomatedAbrSettings -> ShowS
[AutomatedAbrSettings] -> ShowS
AutomatedAbrSettings -> String
(Int -> AutomatedAbrSettings -> ShowS)
-> (AutomatedAbrSettings -> String)
-> ([AutomatedAbrSettings] -> ShowS)
-> Show AutomatedAbrSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutomatedAbrSettings] -> ShowS
$cshowList :: [AutomatedAbrSettings] -> ShowS
show :: AutomatedAbrSettings -> String
$cshow :: AutomatedAbrSettings -> String
showsPrec :: Int -> AutomatedAbrSettings -> ShowS
$cshowsPrec :: Int -> AutomatedAbrSettings -> ShowS
Prelude.Show, (forall x. AutomatedAbrSettings -> Rep AutomatedAbrSettings x)
-> (forall x. Rep AutomatedAbrSettings x -> AutomatedAbrSettings)
-> Generic AutomatedAbrSettings
forall x. Rep AutomatedAbrSettings x -> AutomatedAbrSettings
forall x. AutomatedAbrSettings -> Rep AutomatedAbrSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutomatedAbrSettings x -> AutomatedAbrSettings
$cfrom :: forall x. AutomatedAbrSettings -> Rep AutomatedAbrSettings x
Prelude.Generic)

-- |
-- Create a value of 'AutomatedAbrSettings' 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:
--
-- 'maxRenditions', 'automatedAbrSettings_maxRenditions' - Optional. The maximum number of renditions that MediaConvert will create
-- in your automated ABR stack. The number of renditions is determined
-- automatically, based on analysis of each job, but will never exceed this
-- limit. When you set this to Auto in the console, which is equivalent to
-- excluding it from your JSON job specification, MediaConvert defaults to
-- a limit of 15.
--
-- 'maxAbrBitrate', 'automatedAbrSettings_maxAbrBitrate' - Optional. The maximum target bit rate used in your automated ABR stack.
-- Use this value to set an upper limit on the bandwidth consumed by the
-- highest-quality rendition. This is the rendition that is delivered to
-- viewers with the fastest internet connections. If you don\'t specify a
-- value, MediaConvert uses 8,000,000 (8 mb\/s) by default.
--
-- 'minAbrBitrate', 'automatedAbrSettings_minAbrBitrate' - Optional. The minimum target bitrate used in your automated ABR stack.
-- Use this value to set a lower limit on the bitrate of video delivered to
-- viewers with slow internet connections. If you don\'t specify a value,
-- MediaConvert uses 600,000 (600 kb\/s) by default.
newAutomatedAbrSettings ::
  AutomatedAbrSettings
newAutomatedAbrSettings :: AutomatedAbrSettings
newAutomatedAbrSettings =
  AutomatedAbrSettings' :: Maybe Natural
-> Maybe Natural -> Maybe Natural -> AutomatedAbrSettings
AutomatedAbrSettings'
    { $sel:maxRenditions:AutomatedAbrSettings' :: Maybe Natural
maxRenditions =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maxAbrBitrate:AutomatedAbrSettings' :: Maybe Natural
maxAbrBitrate = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:minAbrBitrate:AutomatedAbrSettings' :: Maybe Natural
minAbrBitrate = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Optional. The maximum number of renditions that MediaConvert will create
-- in your automated ABR stack. The number of renditions is determined
-- automatically, based on analysis of each job, but will never exceed this
-- limit. When you set this to Auto in the console, which is equivalent to
-- excluding it from your JSON job specification, MediaConvert defaults to
-- a limit of 15.
automatedAbrSettings_maxRenditions :: Lens.Lens' AutomatedAbrSettings (Prelude.Maybe Prelude.Natural)
automatedAbrSettings_maxRenditions :: (Maybe Natural -> f (Maybe Natural))
-> AutomatedAbrSettings -> f AutomatedAbrSettings
automatedAbrSettings_maxRenditions = (AutomatedAbrSettings -> Maybe Natural)
-> (AutomatedAbrSettings -> Maybe Natural -> AutomatedAbrSettings)
-> Lens
     AutomatedAbrSettings
     AutomatedAbrSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomatedAbrSettings' {Maybe Natural
maxRenditions :: Maybe Natural
$sel:maxRenditions:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
maxRenditions} -> Maybe Natural
maxRenditions) (\s :: AutomatedAbrSettings
s@AutomatedAbrSettings' {} Maybe Natural
a -> AutomatedAbrSettings
s {$sel:maxRenditions:AutomatedAbrSettings' :: Maybe Natural
maxRenditions = Maybe Natural
a} :: AutomatedAbrSettings)

-- | Optional. The maximum target bit rate used in your automated ABR stack.
-- Use this value to set an upper limit on the bandwidth consumed by the
-- highest-quality rendition. This is the rendition that is delivered to
-- viewers with the fastest internet connections. If you don\'t specify a
-- value, MediaConvert uses 8,000,000 (8 mb\/s) by default.
automatedAbrSettings_maxAbrBitrate :: Lens.Lens' AutomatedAbrSettings (Prelude.Maybe Prelude.Natural)
automatedAbrSettings_maxAbrBitrate :: (Maybe Natural -> f (Maybe Natural))
-> AutomatedAbrSettings -> f AutomatedAbrSettings
automatedAbrSettings_maxAbrBitrate = (AutomatedAbrSettings -> Maybe Natural)
-> (AutomatedAbrSettings -> Maybe Natural -> AutomatedAbrSettings)
-> Lens
     AutomatedAbrSettings
     AutomatedAbrSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomatedAbrSettings' {Maybe Natural
maxAbrBitrate :: Maybe Natural
$sel:maxAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
maxAbrBitrate} -> Maybe Natural
maxAbrBitrate) (\s :: AutomatedAbrSettings
s@AutomatedAbrSettings' {} Maybe Natural
a -> AutomatedAbrSettings
s {$sel:maxAbrBitrate:AutomatedAbrSettings' :: Maybe Natural
maxAbrBitrate = Maybe Natural
a} :: AutomatedAbrSettings)

-- | Optional. The minimum target bitrate used in your automated ABR stack.
-- Use this value to set a lower limit on the bitrate of video delivered to
-- viewers with slow internet connections. If you don\'t specify a value,
-- MediaConvert uses 600,000 (600 kb\/s) by default.
automatedAbrSettings_minAbrBitrate :: Lens.Lens' AutomatedAbrSettings (Prelude.Maybe Prelude.Natural)
automatedAbrSettings_minAbrBitrate :: (Maybe Natural -> f (Maybe Natural))
-> AutomatedAbrSettings -> f AutomatedAbrSettings
automatedAbrSettings_minAbrBitrate = (AutomatedAbrSettings -> Maybe Natural)
-> (AutomatedAbrSettings -> Maybe Natural -> AutomatedAbrSettings)
-> Lens
     AutomatedAbrSettings
     AutomatedAbrSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomatedAbrSettings' {Maybe Natural
minAbrBitrate :: Maybe Natural
$sel:minAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
minAbrBitrate} -> Maybe Natural
minAbrBitrate) (\s :: AutomatedAbrSettings
s@AutomatedAbrSettings' {} Maybe Natural
a -> AutomatedAbrSettings
s {$sel:minAbrBitrate:AutomatedAbrSettings' :: Maybe Natural
minAbrBitrate = Maybe Natural
a} :: AutomatedAbrSettings)

instance Core.FromJSON AutomatedAbrSettings where
  parseJSON :: Value -> Parser AutomatedAbrSettings
parseJSON =
    String
-> (Object -> Parser AutomatedAbrSettings)
-> Value
-> Parser AutomatedAbrSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutomatedAbrSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Maybe Natural -> AutomatedAbrSettings
AutomatedAbrSettings'
            (Maybe Natural
 -> Maybe Natural -> Maybe Natural -> AutomatedAbrSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> AutomatedAbrSettings)
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
"maxRenditions")
            Parser (Maybe Natural -> Maybe Natural -> AutomatedAbrSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> AutomatedAbrSettings)
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
"maxAbrBitrate")
            Parser (Maybe Natural -> AutomatedAbrSettings)
-> Parser (Maybe Natural) -> Parser AutomatedAbrSettings
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
"minAbrBitrate")
      )

instance Prelude.Hashable AutomatedAbrSettings

instance Prelude.NFData AutomatedAbrSettings

instance Core.ToJSON AutomatedAbrSettings where
  toJSON :: AutomatedAbrSettings -> Value
toJSON AutomatedAbrSettings' {Maybe Natural
minAbrBitrate :: Maybe Natural
maxAbrBitrate :: Maybe Natural
maxRenditions :: Maybe Natural
$sel:minAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
$sel:maxAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
$sel:maxRenditions:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"maxRenditions" 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
maxRenditions,
            (Text
"maxAbrBitrate" 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
maxAbrBitrate,
            (Text
"minAbrBitrate" 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
minAbrBitrate
          ]
      )