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

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

-- | Use automated encoding to have MediaConvert choose your encoding
-- settings for you, based on characteristics of your input video.
--
-- /See:/ 'newAutomatedEncodingSettings' smart constructor.
data AutomatedEncodingSettings = AutomatedEncodingSettings'
  { -- | 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.
    AutomatedEncodingSettings -> Maybe AutomatedAbrSettings
abrSettings :: Prelude.Maybe AutomatedAbrSettings
  }
  deriving (AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool
(AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool)
-> (AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool)
-> Eq AutomatedEncodingSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool
$c/= :: AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool
== :: AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool
$c== :: AutomatedEncodingSettings -> AutomatedEncodingSettings -> Bool
Prelude.Eq, ReadPrec [AutomatedEncodingSettings]
ReadPrec AutomatedEncodingSettings
Int -> ReadS AutomatedEncodingSettings
ReadS [AutomatedEncodingSettings]
(Int -> ReadS AutomatedEncodingSettings)
-> ReadS [AutomatedEncodingSettings]
-> ReadPrec AutomatedEncodingSettings
-> ReadPrec [AutomatedEncodingSettings]
-> Read AutomatedEncodingSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutomatedEncodingSettings]
$creadListPrec :: ReadPrec [AutomatedEncodingSettings]
readPrec :: ReadPrec AutomatedEncodingSettings
$creadPrec :: ReadPrec AutomatedEncodingSettings
readList :: ReadS [AutomatedEncodingSettings]
$creadList :: ReadS [AutomatedEncodingSettings]
readsPrec :: Int -> ReadS AutomatedEncodingSettings
$creadsPrec :: Int -> ReadS AutomatedEncodingSettings
Prelude.Read, Int -> AutomatedEncodingSettings -> ShowS
[AutomatedEncodingSettings] -> ShowS
AutomatedEncodingSettings -> String
(Int -> AutomatedEncodingSettings -> ShowS)
-> (AutomatedEncodingSettings -> String)
-> ([AutomatedEncodingSettings] -> ShowS)
-> Show AutomatedEncodingSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutomatedEncodingSettings] -> ShowS
$cshowList :: [AutomatedEncodingSettings] -> ShowS
show :: AutomatedEncodingSettings -> String
$cshow :: AutomatedEncodingSettings -> String
showsPrec :: Int -> AutomatedEncodingSettings -> ShowS
$cshowsPrec :: Int -> AutomatedEncodingSettings -> ShowS
Prelude.Show, (forall x.
 AutomatedEncodingSettings -> Rep AutomatedEncodingSettings x)
-> (forall x.
    Rep AutomatedEncodingSettings x -> AutomatedEncodingSettings)
-> Generic AutomatedEncodingSettings
forall x.
Rep AutomatedEncodingSettings x -> AutomatedEncodingSettings
forall x.
AutomatedEncodingSettings -> Rep AutomatedEncodingSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutomatedEncodingSettings x -> AutomatedEncodingSettings
$cfrom :: forall x.
AutomatedEncodingSettings -> Rep AutomatedEncodingSettings x
Prelude.Generic)

-- |
-- Create a value of 'AutomatedEncodingSettings' 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:
--
-- 'abrSettings', 'automatedEncodingSettings_abrSettings' - 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.
newAutomatedEncodingSettings ::
  AutomatedEncodingSettings
newAutomatedEncodingSettings :: AutomatedEncodingSettings
newAutomatedEncodingSettings =
  AutomatedEncodingSettings' :: Maybe AutomatedAbrSettings -> AutomatedEncodingSettings
AutomatedEncodingSettings'
    { $sel:abrSettings:AutomatedEncodingSettings' :: Maybe AutomatedAbrSettings
abrSettings =
        Maybe AutomatedAbrSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | 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.
automatedEncodingSettings_abrSettings :: Lens.Lens' AutomatedEncodingSettings (Prelude.Maybe AutomatedAbrSettings)
automatedEncodingSettings_abrSettings :: (Maybe AutomatedAbrSettings -> f (Maybe AutomatedAbrSettings))
-> AutomatedEncodingSettings -> f AutomatedEncodingSettings
automatedEncodingSettings_abrSettings = (AutomatedEncodingSettings -> Maybe AutomatedAbrSettings)
-> (AutomatedEncodingSettings
    -> Maybe AutomatedAbrSettings -> AutomatedEncodingSettings)
-> Lens
     AutomatedEncodingSettings
     AutomatedEncodingSettings
     (Maybe AutomatedAbrSettings)
     (Maybe AutomatedAbrSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomatedEncodingSettings' {Maybe AutomatedAbrSettings
abrSettings :: Maybe AutomatedAbrSettings
$sel:abrSettings:AutomatedEncodingSettings' :: AutomatedEncodingSettings -> Maybe AutomatedAbrSettings
abrSettings} -> Maybe AutomatedAbrSettings
abrSettings) (\s :: AutomatedEncodingSettings
s@AutomatedEncodingSettings' {} Maybe AutomatedAbrSettings
a -> AutomatedEncodingSettings
s {$sel:abrSettings:AutomatedEncodingSettings' :: Maybe AutomatedAbrSettings
abrSettings = Maybe AutomatedAbrSettings
a} :: AutomatedEncodingSettings)

instance Core.FromJSON AutomatedEncodingSettings where
  parseJSON :: Value -> Parser AutomatedEncodingSettings
parseJSON =
    String
-> (Object -> Parser AutomatedEncodingSettings)
-> Value
-> Parser AutomatedEncodingSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutomatedEncodingSettings"
      ( \Object
x ->
          Maybe AutomatedAbrSettings -> AutomatedEncodingSettings
AutomatedEncodingSettings'
            (Maybe AutomatedAbrSettings -> AutomatedEncodingSettings)
-> Parser (Maybe AutomatedAbrSettings)
-> Parser AutomatedEncodingSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AutomatedAbrSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"abrSettings")
      )

instance Prelude.Hashable AutomatedEncodingSettings

instance Prelude.NFData AutomatedEncodingSettings

instance Core.ToJSON AutomatedEncodingSettings where
  toJSON :: AutomatedEncodingSettings -> Value
toJSON AutomatedEncodingSettings' {Maybe AutomatedAbrSettings
abrSettings :: Maybe AutomatedAbrSettings
$sel:abrSettings:AutomatedEncodingSettings' :: AutomatedEncodingSettings -> Maybe AutomatedAbrSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"abrSettings" Text -> AutomatedAbrSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AutomatedAbrSettings -> Pair)
-> Maybe AutomatedAbrSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutomatedAbrSettings
abrSettings]
      )