{-# 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.MediaLive.Types.Output
-- 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.MediaLive.Types.Output where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.OutputSettings
import qualified Amazonka.Prelude as Prelude

-- | Output settings. There can be multiple outputs within a group.
--
-- /See:/ 'newOutput' smart constructor.
data Output = Output'
  { -- | The names of the AudioDescriptions used as audio sources for this
    -- output.
    Output -> Maybe [Text]
audioDescriptionNames :: Prelude.Maybe [Prelude.Text],
    -- | The names of the CaptionDescriptions used as caption sources for this
    -- output.
    Output -> Maybe [Text]
captionDescriptionNames :: Prelude.Maybe [Prelude.Text],
    -- | The name used to identify an output.
    Output -> Maybe Text
outputName :: Prelude.Maybe Prelude.Text,
    -- | The name of the VideoDescription used as the source for this output.
    Output -> Maybe Text
videoDescriptionName :: Prelude.Maybe Prelude.Text,
    -- | Output type-specific settings.
    Output -> OutputSettings
outputSettings :: OutputSettings
  }
  deriving (Output -> Output -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Output -> Output -> Bool
$c/= :: Output -> Output -> Bool
== :: Output -> Output -> Bool
$c== :: Output -> Output -> Bool
Prelude.Eq, ReadPrec [Output]
ReadPrec Output
Int -> ReadS Output
ReadS [Output]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Output]
$creadListPrec :: ReadPrec [Output]
readPrec :: ReadPrec Output
$creadPrec :: ReadPrec Output
readList :: ReadS [Output]
$creadList :: ReadS [Output]
readsPrec :: Int -> ReadS Output
$creadsPrec :: Int -> ReadS Output
Prelude.Read, Int -> Output -> ShowS
[Output] -> ShowS
Output -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Output] -> ShowS
$cshowList :: [Output] -> ShowS
show :: Output -> String
$cshow :: Output -> String
showsPrec :: Int -> Output -> ShowS
$cshowsPrec :: Int -> Output -> ShowS
Prelude.Show, forall x. Rep Output x -> Output
forall x. Output -> Rep Output x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Output x -> Output
$cfrom :: forall x. Output -> Rep Output x
Prelude.Generic)

-- |
-- Create a value of 'Output' 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:
--
-- 'audioDescriptionNames', 'output_audioDescriptionNames' - The names of the AudioDescriptions used as audio sources for this
-- output.
--
-- 'captionDescriptionNames', 'output_captionDescriptionNames' - The names of the CaptionDescriptions used as caption sources for this
-- output.
--
-- 'outputName', 'output_outputName' - The name used to identify an output.
--
-- 'videoDescriptionName', 'output_videoDescriptionName' - The name of the VideoDescription used as the source for this output.
--
-- 'outputSettings', 'output_outputSettings' - Output type-specific settings.
newOutput ::
  -- | 'outputSettings'
  OutputSettings ->
  Output
newOutput :: OutputSettings -> Output
newOutput OutputSettings
pOutputSettings_ =
  Output'
    { $sel:audioDescriptionNames:Output' :: Maybe [Text]
audioDescriptionNames = forall a. Maybe a
Prelude.Nothing,
      $sel:captionDescriptionNames:Output' :: Maybe [Text]
captionDescriptionNames = forall a. Maybe a
Prelude.Nothing,
      $sel:outputName:Output' :: Maybe Text
outputName = forall a. Maybe a
Prelude.Nothing,
      $sel:videoDescriptionName:Output' :: Maybe Text
videoDescriptionName = forall a. Maybe a
Prelude.Nothing,
      $sel:outputSettings:Output' :: OutputSettings
outputSettings = OutputSettings
pOutputSettings_
    }

-- | The names of the AudioDescriptions used as audio sources for this
-- output.
output_audioDescriptionNames :: Lens.Lens' Output (Prelude.Maybe [Prelude.Text])
output_audioDescriptionNames :: Lens' Output (Maybe [Text])
output_audioDescriptionNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe [Text]
audioDescriptionNames :: Maybe [Text]
$sel:audioDescriptionNames:Output' :: Output -> Maybe [Text]
audioDescriptionNames} -> Maybe [Text]
audioDescriptionNames) (\s :: Output
s@Output' {} Maybe [Text]
a -> Output
s {$sel:audioDescriptionNames:Output' :: Maybe [Text]
audioDescriptionNames = Maybe [Text]
a} :: Output) 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

-- | The names of the CaptionDescriptions used as caption sources for this
-- output.
output_captionDescriptionNames :: Lens.Lens' Output (Prelude.Maybe [Prelude.Text])
output_captionDescriptionNames :: Lens' Output (Maybe [Text])
output_captionDescriptionNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe [Text]
captionDescriptionNames :: Maybe [Text]
$sel:captionDescriptionNames:Output' :: Output -> Maybe [Text]
captionDescriptionNames} -> Maybe [Text]
captionDescriptionNames) (\s :: Output
s@Output' {} Maybe [Text]
a -> Output
s {$sel:captionDescriptionNames:Output' :: Maybe [Text]
captionDescriptionNames = Maybe [Text]
a} :: Output) 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

-- | The name used to identify an output.
output_outputName :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_outputName :: Lens' Output (Maybe Text)
output_outputName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Text
outputName :: Maybe Text
$sel:outputName:Output' :: Output -> Maybe Text
outputName} -> Maybe Text
outputName) (\s :: Output
s@Output' {} Maybe Text
a -> Output
s {$sel:outputName:Output' :: Maybe Text
outputName = Maybe Text
a} :: Output)

-- | The name of the VideoDescription used as the source for this output.
output_videoDescriptionName :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_videoDescriptionName :: Lens' Output (Maybe Text)
output_videoDescriptionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Text
videoDescriptionName :: Maybe Text
$sel:videoDescriptionName:Output' :: Output -> Maybe Text
videoDescriptionName} -> Maybe Text
videoDescriptionName) (\s :: Output
s@Output' {} Maybe Text
a -> Output
s {$sel:videoDescriptionName:Output' :: Maybe Text
videoDescriptionName = Maybe Text
a} :: Output)

-- | Output type-specific settings.
output_outputSettings :: Lens.Lens' Output OutputSettings
output_outputSettings :: Lens' Output OutputSettings
output_outputSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {OutputSettings
outputSettings :: OutputSettings
$sel:outputSettings:Output' :: Output -> OutputSettings
outputSettings} -> OutputSettings
outputSettings) (\s :: Output
s@Output' {} OutputSettings
a -> Output
s {$sel:outputSettings:Output' :: OutputSettings
outputSettings = OutputSettings
a} :: Output)

instance Data.FromJSON Output where
  parseJSON :: Value -> Parser Output
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Output"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> OutputSettings
-> Output
Output'
            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
"audioDescriptionNames"
                            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
"captionDescriptionNames"
                            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
"outputName")
            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
"videoDescriptionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"outputSettings")
      )

instance Prelude.Hashable Output where
  hashWithSalt :: Int -> Output -> Int
hashWithSalt Int
_salt Output' {Maybe [Text]
Maybe Text
OutputSettings
outputSettings :: OutputSettings
videoDescriptionName :: Maybe Text
outputName :: Maybe Text
captionDescriptionNames :: Maybe [Text]
audioDescriptionNames :: Maybe [Text]
$sel:outputSettings:Output' :: Output -> OutputSettings
$sel:videoDescriptionName:Output' :: Output -> Maybe Text
$sel:outputName:Output' :: Output -> Maybe Text
$sel:captionDescriptionNames:Output' :: Output -> Maybe [Text]
$sel:audioDescriptionNames:Output' :: Output -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
audioDescriptionNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
captionDescriptionNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outputName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
videoDescriptionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OutputSettings
outputSettings

instance Prelude.NFData Output where
  rnf :: Output -> ()
rnf Output' {Maybe [Text]
Maybe Text
OutputSettings
outputSettings :: OutputSettings
videoDescriptionName :: Maybe Text
outputName :: Maybe Text
captionDescriptionNames :: Maybe [Text]
audioDescriptionNames :: Maybe [Text]
$sel:outputSettings:Output' :: Output -> OutputSettings
$sel:videoDescriptionName:Output' :: Output -> Maybe Text
$sel:outputName:Output' :: Output -> Maybe Text
$sel:captionDescriptionNames:Output' :: Output -> Maybe [Text]
$sel:audioDescriptionNames:Output' :: Output -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
audioDescriptionNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
captionDescriptionNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
videoDescriptionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf OutputSettings
outputSettings

instance Data.ToJSON Output where
  toJSON :: Output -> Value
toJSON Output' {Maybe [Text]
Maybe Text
OutputSettings
outputSettings :: OutputSettings
videoDescriptionName :: Maybe Text
outputName :: Maybe Text
captionDescriptionNames :: Maybe [Text]
audioDescriptionNames :: Maybe [Text]
$sel:outputSettings:Output' :: Output -> OutputSettings
$sel:videoDescriptionName:Output' :: Output -> Maybe Text
$sel:outputName:Output' :: Output -> Maybe Text
$sel:captionDescriptionNames:Output' :: Output -> Maybe [Text]
$sel:audioDescriptionNames:Output' :: Output -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"audioDescriptionNames" 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]
audioDescriptionNames,
            (Key
"captionDescriptionNames" 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]
captionDescriptionNames,
            (Key
"outputName" 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
outputName,
            (Key
"videoDescriptionName" 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
videoDescriptionName,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"outputSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= OutputSettings
outputSettings)
          ]
      )