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

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

-- | Specific settings for this type of output.
--
-- /See:/ 'newOutputSettings' smart constructor.
data OutputSettings = OutputSettings'
  { -- | Settings for HLS output groups
    OutputSettings -> Maybe HlsSettings
hlsSettings :: Prelude.Maybe HlsSettings
  }
  deriving (OutputSettings -> OutputSettings -> Bool
(OutputSettings -> OutputSettings -> Bool)
-> (OutputSettings -> OutputSettings -> Bool) -> Eq OutputSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputSettings -> OutputSettings -> Bool
$c/= :: OutputSettings -> OutputSettings -> Bool
== :: OutputSettings -> OutputSettings -> Bool
$c== :: OutputSettings -> OutputSettings -> Bool
Prelude.Eq, ReadPrec [OutputSettings]
ReadPrec OutputSettings
Int -> ReadS OutputSettings
ReadS [OutputSettings]
(Int -> ReadS OutputSettings)
-> ReadS [OutputSettings]
-> ReadPrec OutputSettings
-> ReadPrec [OutputSettings]
-> Read OutputSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputSettings]
$creadListPrec :: ReadPrec [OutputSettings]
readPrec :: ReadPrec OutputSettings
$creadPrec :: ReadPrec OutputSettings
readList :: ReadS [OutputSettings]
$creadList :: ReadS [OutputSettings]
readsPrec :: Int -> ReadS OutputSettings
$creadsPrec :: Int -> ReadS OutputSettings
Prelude.Read, Int -> OutputSettings -> ShowS
[OutputSettings] -> ShowS
OutputSettings -> String
(Int -> OutputSettings -> ShowS)
-> (OutputSettings -> String)
-> ([OutputSettings] -> ShowS)
-> Show OutputSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputSettings] -> ShowS
$cshowList :: [OutputSettings] -> ShowS
show :: OutputSettings -> String
$cshow :: OutputSettings -> String
showsPrec :: Int -> OutputSettings -> ShowS
$cshowsPrec :: Int -> OutputSettings -> ShowS
Prelude.Show, (forall x. OutputSettings -> Rep OutputSettings x)
-> (forall x. Rep OutputSettings x -> OutputSettings)
-> Generic OutputSettings
forall x. Rep OutputSettings x -> OutputSettings
forall x. OutputSettings -> Rep OutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputSettings x -> OutputSettings
$cfrom :: forall x. OutputSettings -> Rep OutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'OutputSettings' 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:
--
-- 'hlsSettings', 'outputSettings_hlsSettings' - Settings for HLS output groups
newOutputSettings ::
  OutputSettings
newOutputSettings :: OutputSettings
newOutputSettings =
  OutputSettings' :: Maybe HlsSettings -> OutputSettings
OutputSettings' {$sel:hlsSettings:OutputSettings' :: Maybe HlsSettings
hlsSettings = Maybe HlsSettings
forall a. Maybe a
Prelude.Nothing}

-- | Settings for HLS output groups
outputSettings_hlsSettings :: Lens.Lens' OutputSettings (Prelude.Maybe HlsSettings)
outputSettings_hlsSettings :: (Maybe HlsSettings -> f (Maybe HlsSettings))
-> OutputSettings -> f OutputSettings
outputSettings_hlsSettings = (OutputSettings -> Maybe HlsSettings)
-> (OutputSettings -> Maybe HlsSettings -> OutputSettings)
-> Lens
     OutputSettings
     OutputSettings
     (Maybe HlsSettings)
     (Maybe HlsSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputSettings' {Maybe HlsSettings
hlsSettings :: Maybe HlsSettings
$sel:hlsSettings:OutputSettings' :: OutputSettings -> Maybe HlsSettings
hlsSettings} -> Maybe HlsSettings
hlsSettings) (\s :: OutputSettings
s@OutputSettings' {} Maybe HlsSettings
a -> OutputSettings
s {$sel:hlsSettings:OutputSettings' :: Maybe HlsSettings
hlsSettings = Maybe HlsSettings
a} :: OutputSettings)

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

instance Prelude.Hashable OutputSettings

instance Prelude.NFData OutputSettings

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