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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConvert.Types.AutomatedAbrRule
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 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 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 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,
    -- | Optional. Use Automated ABR rules to specify restrictions for the
    -- rendition sizes MediaConvert will create in your ABR stack. You can use
    -- these rules if your ABR workflow has specific rendition size
    -- requirements, but you still want MediaConvert to optimize for video
    -- quality and overall file size.
    AutomatedAbrSettings -> Maybe [AutomatedAbrRule]
rules :: Prelude.Maybe [AutomatedAbrRule]
  }
  deriving (AutomatedAbrSettings -> AutomatedAbrSettings -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- '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.
--
-- 'rules', 'automatedAbrSettings_rules' - Optional. Use Automated ABR rules to specify restrictions for the
-- rendition sizes MediaConvert will create in your ABR stack. You can use
-- these rules if your ABR workflow has specific rendition size
-- requirements, but you still want MediaConvert to optimize for video
-- quality and overall file size.
newAutomatedAbrSettings ::
  AutomatedAbrSettings
newAutomatedAbrSettings :: AutomatedAbrSettings
newAutomatedAbrSettings =
  AutomatedAbrSettings'
    { $sel:maxAbrBitrate:AutomatedAbrSettings' :: Maybe Natural
maxAbrBitrate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxRenditions:AutomatedAbrSettings' :: Maybe Natural
maxRenditions = forall a. Maybe a
Prelude.Nothing,
      $sel:minAbrBitrate:AutomatedAbrSettings' :: Maybe Natural
minAbrBitrate = forall a. Maybe a
Prelude.Nothing,
      $sel:rules:AutomatedAbrSettings' :: Maybe [AutomatedAbrRule]
rules = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' AutomatedAbrSettings (Maybe Natural)
automatedAbrSettings_maxAbrBitrate = 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 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 :: Lens' AutomatedAbrSettings (Maybe Natural)
automatedAbrSettings_maxRenditions = 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 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 :: Lens' AutomatedAbrSettings (Maybe Natural)
automatedAbrSettings_minAbrBitrate = 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)

-- | Optional. Use Automated ABR rules to specify restrictions for the
-- rendition sizes MediaConvert will create in your ABR stack. You can use
-- these rules if your ABR workflow has specific rendition size
-- requirements, but you still want MediaConvert to optimize for video
-- quality and overall file size.
automatedAbrSettings_rules :: Lens.Lens' AutomatedAbrSettings (Prelude.Maybe [AutomatedAbrRule])
automatedAbrSettings_rules :: Lens' AutomatedAbrSettings (Maybe [AutomatedAbrRule])
automatedAbrSettings_rules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomatedAbrSettings' {Maybe [AutomatedAbrRule]
rules :: Maybe [AutomatedAbrRule]
$sel:rules:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe [AutomatedAbrRule]
rules} -> Maybe [AutomatedAbrRule]
rules) (\s :: AutomatedAbrSettings
s@AutomatedAbrSettings' {} Maybe [AutomatedAbrRule]
a -> AutomatedAbrSettings
s {$sel:rules:AutomatedAbrSettings' :: Maybe [AutomatedAbrRule]
rules = Maybe [AutomatedAbrRule]
a} :: AutomatedAbrSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AutomatedAbrSettings where
  parseJSON :: Value -> Parser AutomatedAbrSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AutomatedAbrSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe [AutomatedAbrRule]
-> AutomatedAbrSettings
AutomatedAbrSettings'
            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
"maxAbrBitrate")
            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
"maxRenditions")
            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
"minAbrBitrate")
            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
"rules" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable AutomatedAbrSettings where
  hashWithSalt :: Int -> AutomatedAbrSettings -> Int
hashWithSalt Int
_salt AutomatedAbrSettings' {Maybe Natural
Maybe [AutomatedAbrRule]
rules :: Maybe [AutomatedAbrRule]
minAbrBitrate :: Maybe Natural
maxRenditions :: Maybe Natural
maxAbrBitrate :: Maybe Natural
$sel:rules:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe [AutomatedAbrRule]
$sel:minAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
$sel:maxRenditions:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
$sel:maxAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxAbrBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxRenditions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
minAbrBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AutomatedAbrRule]
rules

instance Prelude.NFData AutomatedAbrSettings where
  rnf :: AutomatedAbrSettings -> ()
rnf AutomatedAbrSettings' {Maybe Natural
Maybe [AutomatedAbrRule]
rules :: Maybe [AutomatedAbrRule]
minAbrBitrate :: Maybe Natural
maxRenditions :: Maybe Natural
maxAbrBitrate :: Maybe Natural
$sel:rules:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe [AutomatedAbrRule]
$sel:minAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
$sel:maxRenditions:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
$sel:maxAbrBitrate:AutomatedAbrSettings' :: AutomatedAbrSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxAbrBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxRenditions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
minAbrBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [AutomatedAbrRule]
rules

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