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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.AutomatedEncodingSettings
import Amazonka.MediaConvert.Types.Output
import Amazonka.MediaConvert.Types.OutputGroupSettings
import qualified Amazonka.Prelude as Prelude

-- | Group of outputs
--
-- /See:/ 'newOutputGroup' smart constructor.
data OutputGroup = OutputGroup'
  { -- | Output Group settings, including type
    OutputGroup -> Maybe OutputGroupSettings
outputGroupSettings :: Prelude.Maybe OutputGroupSettings,
    -- | This object holds groups of encoding settings, one group of settings per
    -- output.
    OutputGroup -> Maybe [Output]
outputs :: Prelude.Maybe [Output],
    -- | Use Custom Group Name (CustomName) to specify a name for the output
    -- group. This value is displayed on the console and can make your job
    -- settings JSON more human-readable. It does not affect your outputs. Use
    -- up to twelve characters that are either letters, numbers, spaces, or
    -- underscores.
    OutputGroup -> Maybe Text
customName :: Prelude.Maybe Prelude.Text,
    -- | Name of the output group
    OutputGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Use automated encoding to have MediaConvert choose your encoding
    -- settings for you, based on characteristics of your input video.
    OutputGroup -> Maybe AutomatedEncodingSettings
automatedEncodingSettings :: Prelude.Maybe AutomatedEncodingSettings
  }
  deriving (OutputGroup -> OutputGroup -> Bool
(OutputGroup -> OutputGroup -> Bool)
-> (OutputGroup -> OutputGroup -> Bool) -> Eq OutputGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputGroup -> OutputGroup -> Bool
$c/= :: OutputGroup -> OutputGroup -> Bool
== :: OutputGroup -> OutputGroup -> Bool
$c== :: OutputGroup -> OutputGroup -> Bool
Prelude.Eq, ReadPrec [OutputGroup]
ReadPrec OutputGroup
Int -> ReadS OutputGroup
ReadS [OutputGroup]
(Int -> ReadS OutputGroup)
-> ReadS [OutputGroup]
-> ReadPrec OutputGroup
-> ReadPrec [OutputGroup]
-> Read OutputGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputGroup]
$creadListPrec :: ReadPrec [OutputGroup]
readPrec :: ReadPrec OutputGroup
$creadPrec :: ReadPrec OutputGroup
readList :: ReadS [OutputGroup]
$creadList :: ReadS [OutputGroup]
readsPrec :: Int -> ReadS OutputGroup
$creadsPrec :: Int -> ReadS OutputGroup
Prelude.Read, Int -> OutputGroup -> ShowS
[OutputGroup] -> ShowS
OutputGroup -> String
(Int -> OutputGroup -> ShowS)
-> (OutputGroup -> String)
-> ([OutputGroup] -> ShowS)
-> Show OutputGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputGroup] -> ShowS
$cshowList :: [OutputGroup] -> ShowS
show :: OutputGroup -> String
$cshow :: OutputGroup -> String
showsPrec :: Int -> OutputGroup -> ShowS
$cshowsPrec :: Int -> OutputGroup -> ShowS
Prelude.Show, (forall x. OutputGroup -> Rep OutputGroup x)
-> (forall x. Rep OutputGroup x -> OutputGroup)
-> Generic OutputGroup
forall x. Rep OutputGroup x -> OutputGroup
forall x. OutputGroup -> Rep OutputGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputGroup x -> OutputGroup
$cfrom :: forall x. OutputGroup -> Rep OutputGroup x
Prelude.Generic)

-- |
-- Create a value of 'OutputGroup' 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:
--
-- 'outputGroupSettings', 'outputGroup_outputGroupSettings' - Output Group settings, including type
--
-- 'outputs', 'outputGroup_outputs' - This object holds groups of encoding settings, one group of settings per
-- output.
--
-- 'customName', 'outputGroup_customName' - Use Custom Group Name (CustomName) to specify a name for the output
-- group. This value is displayed on the console and can make your job
-- settings JSON more human-readable. It does not affect your outputs. Use
-- up to twelve characters that are either letters, numbers, spaces, or
-- underscores.
--
-- 'name', 'outputGroup_name' - Name of the output group
--
-- 'automatedEncodingSettings', 'outputGroup_automatedEncodingSettings' - Use automated encoding to have MediaConvert choose your encoding
-- settings for you, based on characteristics of your input video.
newOutputGroup ::
  OutputGroup
newOutputGroup :: OutputGroup
newOutputGroup =
  OutputGroup' :: Maybe OutputGroupSettings
-> Maybe [Output]
-> Maybe Text
-> Maybe Text
-> Maybe AutomatedEncodingSettings
-> OutputGroup
OutputGroup'
    { $sel:outputGroupSettings:OutputGroup' :: Maybe OutputGroupSettings
outputGroupSettings = Maybe OutputGroupSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:outputs:OutputGroup' :: Maybe [Output]
outputs = Maybe [Output]
forall a. Maybe a
Prelude.Nothing,
      $sel:customName:OutputGroup' :: Maybe Text
customName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:OutputGroup' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:automatedEncodingSettings:OutputGroup' :: Maybe AutomatedEncodingSettings
automatedEncodingSettings = Maybe AutomatedEncodingSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Output Group settings, including type
outputGroup_outputGroupSettings :: Lens.Lens' OutputGroup (Prelude.Maybe OutputGroupSettings)
outputGroup_outputGroupSettings :: (Maybe OutputGroupSettings -> f (Maybe OutputGroupSettings))
-> OutputGroup -> f OutputGroup
outputGroup_outputGroupSettings = (OutputGroup -> Maybe OutputGroupSettings)
-> (OutputGroup -> Maybe OutputGroupSettings -> OutputGroup)
-> Lens
     OutputGroup
     OutputGroup
     (Maybe OutputGroupSettings)
     (Maybe OutputGroupSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {Maybe OutputGroupSettings
outputGroupSettings :: Maybe OutputGroupSettings
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> Maybe OutputGroupSettings
outputGroupSettings} -> Maybe OutputGroupSettings
outputGroupSettings) (\s :: OutputGroup
s@OutputGroup' {} Maybe OutputGroupSettings
a -> OutputGroup
s {$sel:outputGroupSettings:OutputGroup' :: Maybe OutputGroupSettings
outputGroupSettings = Maybe OutputGroupSettings
a} :: OutputGroup)

-- | This object holds groups of encoding settings, one group of settings per
-- output.
outputGroup_outputs :: Lens.Lens' OutputGroup (Prelude.Maybe [Output])
outputGroup_outputs :: (Maybe [Output] -> f (Maybe [Output]))
-> OutputGroup -> f OutputGroup
outputGroup_outputs = (OutputGroup -> Maybe [Output])
-> (OutputGroup -> Maybe [Output] -> OutputGroup)
-> Lens OutputGroup OutputGroup (Maybe [Output]) (Maybe [Output])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {Maybe [Output]
outputs :: Maybe [Output]
$sel:outputs:OutputGroup' :: OutputGroup -> Maybe [Output]
outputs} -> Maybe [Output]
outputs) (\s :: OutputGroup
s@OutputGroup' {} Maybe [Output]
a -> OutputGroup
s {$sel:outputs:OutputGroup' :: Maybe [Output]
outputs = Maybe [Output]
a} :: OutputGroup) ((Maybe [Output] -> f (Maybe [Output]))
 -> OutputGroup -> f OutputGroup)
-> ((Maybe [Output] -> f (Maybe [Output]))
    -> Maybe [Output] -> f (Maybe [Output]))
-> (Maybe [Output] -> f (Maybe [Output]))
-> OutputGroup
-> f OutputGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Output] [Output] [Output] [Output]
-> Iso
     (Maybe [Output]) (Maybe [Output]) (Maybe [Output]) (Maybe [Output])
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 [Output] [Output] [Output] [Output]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Use Custom Group Name (CustomName) to specify a name for the output
-- group. This value is displayed on the console and can make your job
-- settings JSON more human-readable. It does not affect your outputs. Use
-- up to twelve characters that are either letters, numbers, spaces, or
-- underscores.
outputGroup_customName :: Lens.Lens' OutputGroup (Prelude.Maybe Prelude.Text)
outputGroup_customName :: (Maybe Text -> f (Maybe Text)) -> OutputGroup -> f OutputGroup
outputGroup_customName = (OutputGroup -> Maybe Text)
-> (OutputGroup -> Maybe Text -> OutputGroup)
-> Lens OutputGroup OutputGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {Maybe Text
customName :: Maybe Text
$sel:customName:OutputGroup' :: OutputGroup -> Maybe Text
customName} -> Maybe Text
customName) (\s :: OutputGroup
s@OutputGroup' {} Maybe Text
a -> OutputGroup
s {$sel:customName:OutputGroup' :: Maybe Text
customName = Maybe Text
a} :: OutputGroup)

-- | Name of the output group
outputGroup_name :: Lens.Lens' OutputGroup (Prelude.Maybe Prelude.Text)
outputGroup_name :: (Maybe Text -> f (Maybe Text)) -> OutputGroup -> f OutputGroup
outputGroup_name = (OutputGroup -> Maybe Text)
-> (OutputGroup -> Maybe Text -> OutputGroup)
-> Lens OutputGroup OutputGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {Maybe Text
name :: Maybe Text
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
name} -> Maybe Text
name) (\s :: OutputGroup
s@OutputGroup' {} Maybe Text
a -> OutputGroup
s {$sel:name:OutputGroup' :: Maybe Text
name = Maybe Text
a} :: OutputGroup)

-- | Use automated encoding to have MediaConvert choose your encoding
-- settings for you, based on characteristics of your input video.
outputGroup_automatedEncodingSettings :: Lens.Lens' OutputGroup (Prelude.Maybe AutomatedEncodingSettings)
outputGroup_automatedEncodingSettings :: (Maybe AutomatedEncodingSettings
 -> f (Maybe AutomatedEncodingSettings))
-> OutputGroup -> f OutputGroup
outputGroup_automatedEncodingSettings = (OutputGroup -> Maybe AutomatedEncodingSettings)
-> (OutputGroup -> Maybe AutomatedEncodingSettings -> OutputGroup)
-> Lens
     OutputGroup
     OutputGroup
     (Maybe AutomatedEncodingSettings)
     (Maybe AutomatedEncodingSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputGroup' {Maybe AutomatedEncodingSettings
automatedEncodingSettings :: Maybe AutomatedEncodingSettings
$sel:automatedEncodingSettings:OutputGroup' :: OutputGroup -> Maybe AutomatedEncodingSettings
automatedEncodingSettings} -> Maybe AutomatedEncodingSettings
automatedEncodingSettings) (\s :: OutputGroup
s@OutputGroup' {} Maybe AutomatedEncodingSettings
a -> OutputGroup
s {$sel:automatedEncodingSettings:OutputGroup' :: Maybe AutomatedEncodingSettings
automatedEncodingSettings = Maybe AutomatedEncodingSettings
a} :: OutputGroup)

instance Core.FromJSON OutputGroup where
  parseJSON :: Value -> Parser OutputGroup
parseJSON =
    String
-> (Object -> Parser OutputGroup) -> Value -> Parser OutputGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputGroup"
      ( \Object
x ->
          Maybe OutputGroupSettings
-> Maybe [Output]
-> Maybe Text
-> Maybe Text
-> Maybe AutomatedEncodingSettings
-> OutputGroup
OutputGroup'
            (Maybe OutputGroupSettings
 -> Maybe [Output]
 -> Maybe Text
 -> Maybe Text
 -> Maybe AutomatedEncodingSettings
 -> OutputGroup)
-> Parser (Maybe OutputGroupSettings)
-> Parser
     (Maybe [Output]
      -> Maybe Text
      -> Maybe Text
      -> Maybe AutomatedEncodingSettings
      -> OutputGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OutputGroupSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputGroupSettings")
            Parser
  (Maybe [Output]
   -> Maybe Text
   -> Maybe Text
   -> Maybe AutomatedEncodingSettings
   -> OutputGroup)
-> Parser (Maybe [Output])
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe AutomatedEncodingSettings -> OutputGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Output]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputs" Parser (Maybe (Maybe [Output]))
-> Maybe [Output] -> Parser (Maybe [Output])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Output]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe AutomatedEncodingSettings -> OutputGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe AutomatedEncodingSettings -> OutputGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"customName")
            Parser
  (Maybe Text -> Maybe AutomatedEncodingSettings -> OutputGroup)
-> Parser (Maybe Text)
-> Parser (Maybe AutomatedEncodingSettings -> OutputGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe AutomatedEncodingSettings -> OutputGroup)
-> Parser (Maybe AutomatedEncodingSettings) -> Parser OutputGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AutomatedEncodingSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"automatedEncodingSettings")
      )

instance Prelude.Hashable OutputGroup

instance Prelude.NFData OutputGroup

instance Core.ToJSON OutputGroup where
  toJSON :: OutputGroup -> Value
toJSON OutputGroup' {Maybe [Output]
Maybe Text
Maybe AutomatedEncodingSettings
Maybe OutputGroupSettings
automatedEncodingSettings :: Maybe AutomatedEncodingSettings
name :: Maybe Text
customName :: Maybe Text
outputs :: Maybe [Output]
outputGroupSettings :: Maybe OutputGroupSettings
$sel:automatedEncodingSettings:OutputGroup' :: OutputGroup -> Maybe AutomatedEncodingSettings
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
$sel:customName:OutputGroup' :: OutputGroup -> Maybe Text
$sel:outputs:OutputGroup' :: OutputGroup -> Maybe [Output]
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> Maybe OutputGroupSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"outputGroupSettings" Text -> OutputGroupSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OutputGroupSettings -> Pair)
-> Maybe OutputGroupSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputGroupSettings
outputGroupSettings,
            (Text
"outputs" Text -> [Output] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Output] -> Pair) -> Maybe [Output] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Output]
outputs,
            (Text
"customName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
customName,
            (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"automatedEncodingSettings" Text -> AutomatedEncodingSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AutomatedEncodingSettings -> Pair)
-> Maybe AutomatedEncodingSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutomatedEncodingSettings
automatedEncodingSettings
          ]
      )