{-# 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-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.PresetSettings 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.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'
  { -- | (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],
    -- | 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],
    -- | Container specific settings.
    PresetSettings -> Maybe ContainerSettings
containerSettings :: Prelude.Maybe ContainerSettings,
    -- | 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
  }
  deriving (PresetSettings -> PresetSettings -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- 'containerSettings', 'presetSettings_containerSettings' - Container specific settings.
--
-- '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.
newPresetSettings ::
  PresetSettings
newPresetSettings :: PresetSettings
newPresetSettings =
  PresetSettings'
    { $sel:audioDescriptions:PresetSettings' :: Maybe [AudioDescription]
audioDescriptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:captionDescriptions:PresetSettings' :: Maybe [CaptionDescriptionPreset]
captionDescriptions = forall a. Maybe a
Prelude.Nothing,
      $sel:containerSettings:PresetSettings' :: Maybe ContainerSettings
containerSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:videoDescription:PresetSettings' :: Maybe VideoDescription
videoDescription = forall a. Maybe a
Prelude.Nothing
    }

-- | (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 :: Lens' PresetSettings (Maybe [AudioDescription])
presetSettings_audioDescriptions = 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) 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

-- | 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 :: Lens' PresetSettings (Maybe [CaptionDescriptionPreset])
presetSettings_captionDescriptions = 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) 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

-- | Container specific settings.
presetSettings_containerSettings :: Lens.Lens' PresetSettings (Prelude.Maybe ContainerSettings)
presetSettings_containerSettings :: Lens' PresetSettings (Maybe ContainerSettings)
presetSettings_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)

-- | 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 :: Lens' PresetSettings (Maybe VideoDescription)
presetSettings_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)

instance Data.FromJSON PresetSettings where
  parseJSON :: Value -> Parser PresetSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PresetSettings"
      ( \Object
x ->
          Maybe [AudioDescription]
-> Maybe [CaptionDescriptionPreset]
-> Maybe ContainerSettings
-> Maybe VideoDescription
-> PresetSettings
PresetSettings'
            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
"audioDescriptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"captionDescriptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"containerSettings")
            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
"videoDescription")
      )

instance Prelude.Hashable PresetSettings where
  hashWithSalt :: Int -> PresetSettings -> Int
hashWithSalt Int
_salt PresetSettings' {Maybe [AudioDescription]
Maybe [CaptionDescriptionPreset]
Maybe ContainerSettings
Maybe VideoDescription
videoDescription :: Maybe VideoDescription
containerSettings :: Maybe ContainerSettings
captionDescriptions :: Maybe [CaptionDescriptionPreset]
audioDescriptions :: Maybe [AudioDescription]
$sel:videoDescription:PresetSettings' :: PresetSettings -> Maybe VideoDescription
$sel:containerSettings:PresetSettings' :: PresetSettings -> Maybe ContainerSettings
$sel:captionDescriptions:PresetSettings' :: PresetSettings -> Maybe [CaptionDescriptionPreset]
$sel:audioDescriptions:PresetSettings' :: PresetSettings -> Maybe [AudioDescription]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AudioDescription]
audioDescriptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CaptionDescriptionPreset]
captionDescriptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContainerSettings
containerSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VideoDescription
videoDescription

instance Prelude.NFData PresetSettings where
  rnf :: PresetSettings -> ()
rnf PresetSettings' {Maybe [AudioDescription]
Maybe [CaptionDescriptionPreset]
Maybe ContainerSettings
Maybe VideoDescription
videoDescription :: Maybe VideoDescription
containerSettings :: Maybe ContainerSettings
captionDescriptions :: Maybe [CaptionDescriptionPreset]
audioDescriptions :: Maybe [AudioDescription]
$sel:videoDescription:PresetSettings' :: PresetSettings -> Maybe VideoDescription
$sel:containerSettings:PresetSettings' :: PresetSettings -> Maybe ContainerSettings
$sel:captionDescriptions:PresetSettings' :: PresetSettings -> Maybe [CaptionDescriptionPreset]
$sel:audioDescriptions:PresetSettings' :: PresetSettings -> Maybe [AudioDescription]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AudioDescription]
audioDescriptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CaptionDescriptionPreset]
captionDescriptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerSettings
containerSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VideoDescription
videoDescription

instance Data.ToJSON PresetSettings where
  toJSON :: PresetSettings -> Value
toJSON PresetSettings' {Maybe [AudioDescription]
Maybe [CaptionDescriptionPreset]
Maybe ContainerSettings
Maybe VideoDescription
videoDescription :: Maybe VideoDescription
containerSettings :: Maybe ContainerSettings
captionDescriptions :: Maybe [CaptionDescriptionPreset]
audioDescriptions :: Maybe [AudioDescription]
$sel:videoDescription:PresetSettings' :: PresetSettings -> Maybe VideoDescription
$sel:containerSettings:PresetSettings' :: PresetSettings -> Maybe ContainerSettings
$sel:captionDescriptions:PresetSettings' :: PresetSettings -> Maybe [CaptionDescriptionPreset]
$sel:audioDescriptions:PresetSettings' :: PresetSettings -> Maybe [AudioDescription]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"audioDescriptions" 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 [AudioDescription]
audioDescriptions,
            (Key
"captionDescriptions" 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 [CaptionDescriptionPreset]
captionDescriptions,
            (Key
"containerSettings" 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 ContainerSettings
containerSettings,
            (Key
"videoDescription" 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 VideoDescription
videoDescription
          ]
      )