{-# 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-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.OutputGroup 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.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'
  { -- | 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,
    -- | 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,
    -- | 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]
  }
  deriving (OutputGroup -> OutputGroup -> Bool
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]
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
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. 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:
--
-- 'automatedEncodingSettings', 'outputGroup_automatedEncodingSettings' - Use automated encoding to have MediaConvert choose your encoding
-- settings for you, based on characteristics of your input video.
--
-- '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
--
-- 'outputGroupSettings', 'outputGroup_outputGroupSettings' - Output Group settings, including type
--
-- 'outputs', 'outputGroup_outputs' - This object holds groups of encoding settings, one group of settings per
-- output.
newOutputGroup ::
  OutputGroup
newOutputGroup :: OutputGroup
newOutputGroup =
  OutputGroup'
    { $sel:automatedEncodingSettings:OutputGroup' :: Maybe AutomatedEncodingSettings
automatedEncodingSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customName:OutputGroup' :: Maybe Text
customName = forall a. Maybe a
Prelude.Nothing,
      $sel:name:OutputGroup' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:outputGroupSettings:OutputGroup' :: Maybe OutputGroupSettings
outputGroupSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:outputs:OutputGroup' :: Maybe [Output]
outputs = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' OutputGroup (Maybe AutomatedEncodingSettings)
outputGroup_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)

-- | 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 :: Lens' OutputGroup (Maybe Text)
outputGroup_customName = 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 :: Lens' OutputGroup (Maybe Text)
outputGroup_name = 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)

-- | Output Group settings, including type
outputGroup_outputGroupSettings :: Lens.Lens' OutputGroup (Prelude.Maybe OutputGroupSettings)
outputGroup_outputGroupSettings :: Lens' OutputGroup (Maybe OutputGroupSettings)
outputGroup_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 :: Lens' OutputGroup (Maybe [Output])
outputGroup_outputs = 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) 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

instance Data.FromJSON OutputGroup where
  parseJSON :: Value -> Parser OutputGroup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputGroup"
      ( \Object
x ->
          Maybe AutomatedEncodingSettings
-> Maybe Text
-> Maybe Text
-> Maybe OutputGroupSettings
-> Maybe [Output]
-> OutputGroup
OutputGroup'
            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
"automatedEncodingSettings")
            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
"customName")
            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
"name")
            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
"outputGroupSettings")
            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
"outputs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable OutputGroup where
  hashWithSalt :: Int -> OutputGroup -> Int
hashWithSalt Int
_salt OutputGroup' {Maybe [Output]
Maybe Text
Maybe AutomatedEncodingSettings
Maybe OutputGroupSettings
outputs :: Maybe [Output]
outputGroupSettings :: Maybe OutputGroupSettings
name :: Maybe Text
customName :: Maybe Text
automatedEncodingSettings :: Maybe AutomatedEncodingSettings
$sel:outputs:OutputGroup' :: OutputGroup -> Maybe [Output]
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> Maybe OutputGroupSettings
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
$sel:customName:OutputGroup' :: OutputGroup -> Maybe Text
$sel:automatedEncodingSettings:OutputGroup' :: OutputGroup -> Maybe AutomatedEncodingSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutomatedEncodingSettings
automatedEncodingSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutputGroupSettings
outputGroupSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Output]
outputs

instance Prelude.NFData OutputGroup where
  rnf :: OutputGroup -> ()
rnf OutputGroup' {Maybe [Output]
Maybe Text
Maybe AutomatedEncodingSettings
Maybe OutputGroupSettings
outputs :: Maybe [Output]
outputGroupSettings :: Maybe OutputGroupSettings
name :: Maybe Text
customName :: Maybe Text
automatedEncodingSettings :: Maybe AutomatedEncodingSettings
$sel:outputs:OutputGroup' :: OutputGroup -> Maybe [Output]
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> Maybe OutputGroupSettings
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
$sel:customName:OutputGroup' :: OutputGroup -> Maybe Text
$sel:automatedEncodingSettings:OutputGroup' :: OutputGroup -> Maybe AutomatedEncodingSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AutomatedEncodingSettings
automatedEncodingSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OutputGroupSettings
outputGroupSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Output]
outputs

instance Data.ToJSON OutputGroup where
  toJSON :: OutputGroup -> Value
toJSON OutputGroup' {Maybe [Output]
Maybe Text
Maybe AutomatedEncodingSettings
Maybe OutputGroupSettings
outputs :: Maybe [Output]
outputGroupSettings :: Maybe OutputGroupSettings
name :: Maybe Text
customName :: Maybe Text
automatedEncodingSettings :: Maybe AutomatedEncodingSettings
$sel:outputs:OutputGroup' :: OutputGroup -> Maybe [Output]
$sel:outputGroupSettings:OutputGroup' :: OutputGroup -> Maybe OutputGroupSettings
$sel:name:OutputGroup' :: OutputGroup -> Maybe Text
$sel:customName:OutputGroup' :: OutputGroup -> Maybe Text
$sel:automatedEncodingSettings:OutputGroup' :: OutputGroup -> Maybe AutomatedEncodingSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"automatedEncodingSettings" 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 AutomatedEncodingSettings
automatedEncodingSettings,
            (Key
"customName" 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 Text
customName,
            (Key
"name" 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 Text
name,
            (Key
"outputGroupSettings" 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 OutputGroupSettings
outputGroupSettings,
            (Key
"outputs" 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 [Output]
outputs
          ]
      )