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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.AudioDescription
import Amazonka.MediaConvert.Types.CaptionDescriptionPreset
import Amazonka.MediaConvert.Types.ContainerSettings
import Amazonka.MediaConvert.Types.VideoDescription
import qualified Amazonka.Prelude as Prelude

-- | Settings for preset
--
-- /See:/ 'newPresetSettings' smart constructor.
data PresetSettings = PresetSettings'
  { -- | This object holds groups of settings related to captions for one output.
    -- For each output that has captions, include one instance of
    -- CaptionDescriptions.
    PresetSettings -> Maybe [CaptionDescriptionPreset]
captionDescriptions :: Prelude.Maybe [CaptionDescriptionPreset],
    -- | VideoDescription contains a group of video encoding settings. The
    -- specific video settings depend on the video codec that you choose for
    -- the property codec. Include one instance of VideoDescription per output.
    PresetSettings -> Maybe VideoDescription
videoDescription :: Prelude.Maybe VideoDescription,
    -- | Container specific settings.
    PresetSettings -> Maybe ContainerSettings
containerSettings :: Prelude.Maybe ContainerSettings,
    -- | (AudioDescriptions) contains groups of audio encoding settings organized
    -- by audio codec. Include one instance of (AudioDescriptions) per output.
    -- (AudioDescriptions) can contain multiple groups of encoding settings.
    PresetSettings -> Maybe [AudioDescription]
audioDescriptions :: Prelude.Maybe [AudioDescription]
  }
  deriving (PresetSettings -> PresetSettings -> Bool
(PresetSettings -> PresetSettings -> Bool)
-> (PresetSettings -> PresetSettings -> Bool) -> Eq PresetSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PresetSettings -> PresetSettings -> Bool
$c/= :: PresetSettings -> PresetSettings -> Bool
== :: PresetSettings -> PresetSettings -> Bool
$c== :: PresetSettings -> PresetSettings -> Bool
Prelude.Eq, ReadPrec [PresetSettings]
ReadPrec PresetSettings
Int -> ReadS PresetSettings
ReadS [PresetSettings]
(Int -> ReadS PresetSettings)
-> ReadS [PresetSettings]
-> ReadPrec PresetSettings
-> ReadPrec [PresetSettings]
-> Read PresetSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PresetSettings]
$creadListPrec :: ReadPrec [PresetSettings]
readPrec :: ReadPrec PresetSettings
$creadPrec :: ReadPrec PresetSettings
readList :: ReadS [PresetSettings]
$creadList :: ReadS [PresetSettings]
readsPrec :: Int -> ReadS PresetSettings
$creadsPrec :: Int -> ReadS PresetSettings
Prelude.Read, Int -> PresetSettings -> ShowS
[PresetSettings] -> ShowS
PresetSettings -> String
(Int -> PresetSettings -> ShowS)
-> (PresetSettings -> String)
-> ([PresetSettings] -> ShowS)
-> Show PresetSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PresetSettings] -> ShowS
$cshowList :: [PresetSettings] -> ShowS
show :: PresetSettings -> String
$cshow :: PresetSettings -> String
showsPrec :: Int -> PresetSettings -> ShowS
$cshowsPrec :: Int -> PresetSettings -> ShowS
Prelude.Show, (forall x. PresetSettings -> Rep PresetSettings x)
-> (forall x. Rep PresetSettings x -> PresetSettings)
-> Generic PresetSettings
forall x. Rep PresetSettings x -> PresetSettings
forall x. PresetSettings -> Rep PresetSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PresetSettings x -> PresetSettings
$cfrom :: forall x. PresetSettings -> Rep PresetSettings x
Prelude.Generic)

-- |
-- Create a value of 'PresetSettings' 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:
--
-- 'captionDescriptions', 'presetSettings_captionDescriptions' - This object holds groups of settings related to captions for one output.
-- For each output that has captions, include one instance of
-- CaptionDescriptions.
--
-- 'videoDescription', 'presetSettings_videoDescription' - VideoDescription contains a group of video encoding settings. The
-- specific video settings depend on the video codec that you choose for
-- the property codec. Include one instance of VideoDescription per output.
--
-- 'containerSettings', 'presetSettings_containerSettings' - Container specific settings.
--
-- 'audioDescriptions', 'presetSettings_audioDescriptions' - (AudioDescriptions) contains groups of audio encoding settings organized
-- by audio codec. Include one instance of (AudioDescriptions) per output.
-- (AudioDescriptions) can contain multiple groups of encoding settings.
newPresetSettings ::
  PresetSettings
newPresetSettings :: PresetSettings
newPresetSettings =
  PresetSettings' :: Maybe [CaptionDescriptionPreset]
-> Maybe VideoDescription
-> Maybe ContainerSettings
-> Maybe [AudioDescription]
-> PresetSettings
PresetSettings'
    { $sel:captionDescriptions:PresetSettings' :: Maybe [CaptionDescriptionPreset]
captionDescriptions =
        Maybe [CaptionDescriptionPreset]
forall a. Maybe a
Prelude.Nothing,
      $sel:videoDescription:PresetSettings' :: Maybe VideoDescription
videoDescription = Maybe VideoDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:containerSettings:PresetSettings' :: Maybe ContainerSettings
containerSettings = Maybe ContainerSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:audioDescriptions:PresetSettings' :: Maybe [AudioDescription]
audioDescriptions = Maybe [AudioDescription]
forall a. Maybe a
Prelude.Nothing
    }

-- | This object holds groups of settings related to captions for one output.
-- For each output that has captions, include one instance of
-- CaptionDescriptions.
presetSettings_captionDescriptions :: Lens.Lens' PresetSettings (Prelude.Maybe [CaptionDescriptionPreset])
presetSettings_captionDescriptions :: (Maybe [CaptionDescriptionPreset]
 -> f (Maybe [CaptionDescriptionPreset]))
-> PresetSettings -> f PresetSettings
presetSettings_captionDescriptions = (PresetSettings -> Maybe [CaptionDescriptionPreset])
-> (PresetSettings
    -> Maybe [CaptionDescriptionPreset] -> PresetSettings)
-> Lens
     PresetSettings
     PresetSettings
     (Maybe [CaptionDescriptionPreset])
     (Maybe [CaptionDescriptionPreset])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PresetSettings' {Maybe [CaptionDescriptionPreset]
captionDescriptions :: Maybe [CaptionDescriptionPreset]
$sel:captionDescriptions:PresetSettings' :: PresetSettings -> Maybe [CaptionDescriptionPreset]
captionDescriptions} -> Maybe [CaptionDescriptionPreset]
captionDescriptions) (\s :: PresetSettings
s@PresetSettings' {} Maybe [CaptionDescriptionPreset]
a -> PresetSettings
s {$sel:captionDescriptions:PresetSettings' :: Maybe [CaptionDescriptionPreset]
captionDescriptions = Maybe [CaptionDescriptionPreset]
a} :: PresetSettings) ((Maybe [CaptionDescriptionPreset]
  -> f (Maybe [CaptionDescriptionPreset]))
 -> PresetSettings -> f PresetSettings)
-> ((Maybe [CaptionDescriptionPreset]
     -> f (Maybe [CaptionDescriptionPreset]))
    -> Maybe [CaptionDescriptionPreset]
    -> f (Maybe [CaptionDescriptionPreset]))
-> (Maybe [CaptionDescriptionPreset]
    -> f (Maybe [CaptionDescriptionPreset]))
-> PresetSettings
-> f PresetSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CaptionDescriptionPreset]
  [CaptionDescriptionPreset]
  [CaptionDescriptionPreset]
  [CaptionDescriptionPreset]
-> Iso
     (Maybe [CaptionDescriptionPreset])
     (Maybe [CaptionDescriptionPreset])
     (Maybe [CaptionDescriptionPreset])
     (Maybe [CaptionDescriptionPreset])
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 AnIso
  [CaptionDescriptionPreset]
  [CaptionDescriptionPreset]
  [CaptionDescriptionPreset]
  [CaptionDescriptionPreset]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | VideoDescription contains a group of video encoding settings. The
-- specific video settings depend on the video codec that you choose for
-- the property codec. Include one instance of VideoDescription per output.
presetSettings_videoDescription :: Lens.Lens' PresetSettings (Prelude.Maybe VideoDescription)
presetSettings_videoDescription :: (Maybe VideoDescription -> f (Maybe VideoDescription))
-> PresetSettings -> f PresetSettings
presetSettings_videoDescription = (PresetSettings -> Maybe VideoDescription)
-> (PresetSettings -> Maybe VideoDescription -> PresetSettings)
-> Lens
     PresetSettings
     PresetSettings
     (Maybe VideoDescription)
     (Maybe VideoDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PresetSettings' {Maybe VideoDescription
videoDescription :: Maybe VideoDescription
$sel:videoDescription:PresetSettings' :: PresetSettings -> Maybe VideoDescription
videoDescription} -> Maybe VideoDescription
videoDescription) (\s :: PresetSettings
s@PresetSettings' {} Maybe VideoDescription
a -> PresetSettings
s {$sel:videoDescription:PresetSettings' :: Maybe VideoDescription
videoDescription = Maybe VideoDescription
a} :: PresetSettings)

-- | Container specific settings.
presetSettings_containerSettings :: Lens.Lens' PresetSettings (Prelude.Maybe ContainerSettings)
presetSettings_containerSettings :: (Maybe ContainerSettings -> f (Maybe ContainerSettings))
-> PresetSettings -> f PresetSettings
presetSettings_containerSettings = (PresetSettings -> Maybe ContainerSettings)
-> (PresetSettings -> Maybe ContainerSettings -> PresetSettings)
-> Lens
     PresetSettings
     PresetSettings
     (Maybe ContainerSettings)
     (Maybe ContainerSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PresetSettings' {Maybe ContainerSettings
containerSettings :: Maybe ContainerSettings
$sel:containerSettings:PresetSettings' :: PresetSettings -> Maybe ContainerSettings
containerSettings} -> Maybe ContainerSettings
containerSettings) (\s :: PresetSettings
s@PresetSettings' {} Maybe ContainerSettings
a -> PresetSettings
s {$sel:containerSettings:PresetSettings' :: Maybe ContainerSettings
containerSettings = Maybe ContainerSettings
a} :: PresetSettings)

-- | (AudioDescriptions) contains groups of audio encoding settings organized
-- by audio codec. Include one instance of (AudioDescriptions) per output.
-- (AudioDescriptions) can contain multiple groups of encoding settings.
presetSettings_audioDescriptions :: Lens.Lens' PresetSettings (Prelude.Maybe [AudioDescription])
presetSettings_audioDescriptions :: (Maybe [AudioDescription] -> f (Maybe [AudioDescription]))
-> PresetSettings -> f PresetSettings
presetSettings_audioDescriptions = (PresetSettings -> Maybe [AudioDescription])
-> (PresetSettings -> Maybe [AudioDescription] -> PresetSettings)
-> Lens
     PresetSettings
     PresetSettings
     (Maybe [AudioDescription])
     (Maybe [AudioDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PresetSettings' {Maybe [AudioDescription]
audioDescriptions :: Maybe [AudioDescription]
$sel:audioDescriptions:PresetSettings' :: PresetSettings -> Maybe [AudioDescription]
audioDescriptions} -> Maybe [AudioDescription]
audioDescriptions) (\s :: PresetSettings
s@PresetSettings' {} Maybe [AudioDescription]
a -> PresetSettings
s {$sel:audioDescriptions:PresetSettings' :: Maybe [AudioDescription]
audioDescriptions = Maybe [AudioDescription]
a} :: PresetSettings) ((Maybe [AudioDescription] -> f (Maybe [AudioDescription]))
 -> PresetSettings -> f PresetSettings)
-> ((Maybe [AudioDescription] -> f (Maybe [AudioDescription]))
    -> Maybe [AudioDescription] -> f (Maybe [AudioDescription]))
-> (Maybe [AudioDescription] -> f (Maybe [AudioDescription]))
-> PresetSettings
-> f PresetSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AudioDescription]
  [AudioDescription]
  [AudioDescription]
  [AudioDescription]
-> Iso
     (Maybe [AudioDescription])
     (Maybe [AudioDescription])
     (Maybe [AudioDescription])
     (Maybe [AudioDescription])
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 AnIso
  [AudioDescription]
  [AudioDescription]
  [AudioDescription]
  [AudioDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PresetSettings where
  parseJSON :: Value -> Parser PresetSettings
parseJSON =
    String
-> (Object -> Parser PresetSettings)
-> Value
-> Parser PresetSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PresetSettings"
      ( \Object
x ->
          Maybe [CaptionDescriptionPreset]
-> Maybe VideoDescription
-> Maybe ContainerSettings
-> Maybe [AudioDescription]
-> PresetSettings
PresetSettings'
            (Maybe [CaptionDescriptionPreset]
 -> Maybe VideoDescription
 -> Maybe ContainerSettings
 -> Maybe [AudioDescription]
 -> PresetSettings)
-> Parser (Maybe [CaptionDescriptionPreset])
-> Parser
     (Maybe VideoDescription
      -> Maybe ContainerSettings
      -> Maybe [AudioDescription]
      -> PresetSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [CaptionDescriptionPreset]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"captionDescriptions"
                            Parser (Maybe (Maybe [CaptionDescriptionPreset]))
-> Maybe [CaptionDescriptionPreset]
-> Parser (Maybe [CaptionDescriptionPreset])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CaptionDescriptionPreset]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe VideoDescription
   -> Maybe ContainerSettings
   -> Maybe [AudioDescription]
   -> PresetSettings)
-> Parser (Maybe VideoDescription)
-> Parser
     (Maybe ContainerSettings
      -> Maybe [AudioDescription] -> PresetSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"videoDescription")
            Parser
  (Maybe ContainerSettings
   -> Maybe [AudioDescription] -> PresetSettings)
-> Parser (Maybe ContainerSettings)
-> Parser (Maybe [AudioDescription] -> PresetSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContainerSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerSettings")
            Parser (Maybe [AudioDescription] -> PresetSettings)
-> Parser (Maybe [AudioDescription]) -> Parser PresetSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AudioDescription]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audioDescriptions"
                            Parser (Maybe (Maybe [AudioDescription]))
-> Maybe [AudioDescription] -> Parser (Maybe [AudioDescription])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AudioDescription]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable PresetSettings

instance Prelude.NFData PresetSettings

instance Core.ToJSON PresetSettings where
  toJSON :: PresetSettings -> Value
toJSON PresetSettings' {Maybe [AudioDescription]
Maybe [CaptionDescriptionPreset]
Maybe ContainerSettings
Maybe VideoDescription
audioDescriptions :: Maybe [AudioDescription]
containerSettings :: Maybe ContainerSettings
videoDescription :: Maybe VideoDescription
captionDescriptions :: Maybe [CaptionDescriptionPreset]
$sel:audioDescriptions:PresetSettings' :: PresetSettings -> Maybe [AudioDescription]
$sel:containerSettings:PresetSettings' :: PresetSettings -> Maybe ContainerSettings
$sel:videoDescription:PresetSettings' :: PresetSettings -> Maybe VideoDescription
$sel:captionDescriptions:PresetSettings' :: PresetSettings -> Maybe [CaptionDescriptionPreset]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"captionDescriptions" Text -> [CaptionDescriptionPreset] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([CaptionDescriptionPreset] -> Pair)
-> Maybe [CaptionDescriptionPreset] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CaptionDescriptionPreset]
captionDescriptions,
            (Text
"videoDescription" Text -> VideoDescription -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VideoDescription -> Pair) -> Maybe VideoDescription -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoDescription
videoDescription,
            (Text
"containerSettings" Text -> ContainerSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ContainerSettings -> Pair)
-> Maybe ContainerSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerSettings
containerSettings,
            (Text
"audioDescriptions" Text -> [AudioDescription] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AudioDescription] -> Pair)
-> Maybe [AudioDescription] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AudioDescription]
audioDescriptions
          ]
      )