{-# 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.OutputDestination
-- 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.OutputDestination 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.MediaPackageOutputDestinationSettings
import Amazonka.MediaLive.Types.MultiplexProgramChannelDestinationSettings
import Amazonka.MediaLive.Types.OutputDestinationSettings
import qualified Amazonka.Prelude as Prelude

-- | Placeholder documentation for OutputDestination
--
-- /See:/ 'newOutputDestination' smart constructor.
data OutputDestination = OutputDestination'
  { -- | User-specified id. This is used in an output group or an output.
    OutputDestination -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Destination settings for a MediaPackage output; one destination for both
    -- encoders.
    OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings :: Prelude.Maybe [MediaPackageOutputDestinationSettings],
    -- | Destination settings for a Multiplex output; one destination for both
    -- encoders.
    OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings :: Prelude.Maybe MultiplexProgramChannelDestinationSettings,
    -- | Destination settings for a standard output; one destination for each
    -- redundant encoder.
    OutputDestination -> Maybe [OutputDestinationSettings]
settings :: Prelude.Maybe [OutputDestinationSettings]
  }
  deriving (OutputDestination -> OutputDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputDestination -> OutputDestination -> Bool
$c/= :: OutputDestination -> OutputDestination -> Bool
== :: OutputDestination -> OutputDestination -> Bool
$c== :: OutputDestination -> OutputDestination -> Bool
Prelude.Eq, ReadPrec [OutputDestination]
ReadPrec OutputDestination
Int -> ReadS OutputDestination
ReadS [OutputDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputDestination]
$creadListPrec :: ReadPrec [OutputDestination]
readPrec :: ReadPrec OutputDestination
$creadPrec :: ReadPrec OutputDestination
readList :: ReadS [OutputDestination]
$creadList :: ReadS [OutputDestination]
readsPrec :: Int -> ReadS OutputDestination
$creadsPrec :: Int -> ReadS OutputDestination
Prelude.Read, Int -> OutputDestination -> ShowS
[OutputDestination] -> ShowS
OutputDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputDestination] -> ShowS
$cshowList :: [OutputDestination] -> ShowS
show :: OutputDestination -> String
$cshow :: OutputDestination -> String
showsPrec :: Int -> OutputDestination -> ShowS
$cshowsPrec :: Int -> OutputDestination -> ShowS
Prelude.Show, forall x. Rep OutputDestination x -> OutputDestination
forall x. OutputDestination -> Rep OutputDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputDestination x -> OutputDestination
$cfrom :: forall x. OutputDestination -> Rep OutputDestination x
Prelude.Generic)

-- |
-- Create a value of 'OutputDestination' 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:
--
-- 'id', 'outputDestination_id' - User-specified id. This is used in an output group or an output.
--
-- 'mediaPackageSettings', 'outputDestination_mediaPackageSettings' - Destination settings for a MediaPackage output; one destination for both
-- encoders.
--
-- 'multiplexSettings', 'outputDestination_multiplexSettings' - Destination settings for a Multiplex output; one destination for both
-- encoders.
--
-- 'settings', 'outputDestination_settings' - Destination settings for a standard output; one destination for each
-- redundant encoder.
newOutputDestination ::
  OutputDestination
newOutputDestination :: OutputDestination
newOutputDestination =
  OutputDestination'
    { $sel:id:OutputDestination' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:mediaPackageSettings:OutputDestination' :: Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:multiplexSettings:OutputDestination' :: Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:settings:OutputDestination' :: Maybe [OutputDestinationSettings]
settings = forall a. Maybe a
Prelude.Nothing
    }

-- | User-specified id. This is used in an output group or an output.
outputDestination_id :: Lens.Lens' OutputDestination (Prelude.Maybe Prelude.Text)
outputDestination_id :: Lens' OutputDestination (Maybe Text)
outputDestination_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe Text
id :: Maybe Text
$sel:id:OutputDestination' :: OutputDestination -> Maybe Text
id} -> Maybe Text
id) (\s :: OutputDestination
s@OutputDestination' {} Maybe Text
a -> OutputDestination
s {$sel:id:OutputDestination' :: Maybe Text
id = Maybe Text
a} :: OutputDestination)

-- | Destination settings for a MediaPackage output; one destination for both
-- encoders.
outputDestination_mediaPackageSettings :: Lens.Lens' OutputDestination (Prelude.Maybe [MediaPackageOutputDestinationSettings])
outputDestination_mediaPackageSettings :: Lens'
  OutputDestination (Maybe [MediaPackageOutputDestinationSettings])
outputDestination_mediaPackageSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings :: Maybe [MediaPackageOutputDestinationSettings]
$sel:mediaPackageSettings:OutputDestination' :: OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings} -> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings) (\s :: OutputDestination
s@OutputDestination' {} Maybe [MediaPackageOutputDestinationSettings]
a -> OutputDestination
s {$sel:mediaPackageSettings:OutputDestination' :: Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings = Maybe [MediaPackageOutputDestinationSettings]
a} :: OutputDestination) 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

-- | Destination settings for a Multiplex output; one destination for both
-- encoders.
outputDestination_multiplexSettings :: Lens.Lens' OutputDestination (Prelude.Maybe MultiplexProgramChannelDestinationSettings)
outputDestination_multiplexSettings :: Lens'
  OutputDestination
  (Maybe MultiplexProgramChannelDestinationSettings)
outputDestination_multiplexSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings :: Maybe MultiplexProgramChannelDestinationSettings
$sel:multiplexSettings:OutputDestination' :: OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings} -> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings) (\s :: OutputDestination
s@OutputDestination' {} Maybe MultiplexProgramChannelDestinationSettings
a -> OutputDestination
s {$sel:multiplexSettings:OutputDestination' :: Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings = Maybe MultiplexProgramChannelDestinationSettings
a} :: OutputDestination)

-- | Destination settings for a standard output; one destination for each
-- redundant encoder.
outputDestination_settings :: Lens.Lens' OutputDestination (Prelude.Maybe [OutputDestinationSettings])
outputDestination_settings :: Lens' OutputDestination (Maybe [OutputDestinationSettings])
outputDestination_settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe [OutputDestinationSettings]
settings :: Maybe [OutputDestinationSettings]
$sel:settings:OutputDestination' :: OutputDestination -> Maybe [OutputDestinationSettings]
settings} -> Maybe [OutputDestinationSettings]
settings) (\s :: OutputDestination
s@OutputDestination' {} Maybe [OutputDestinationSettings]
a -> OutputDestination
s {$sel:settings:OutputDestination' :: Maybe [OutputDestinationSettings]
settings = Maybe [OutputDestinationSettings]
a} :: OutputDestination) 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 OutputDestination where
  parseJSON :: Value -> Parser OutputDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputDestination"
      ( \Object
x ->
          Maybe Text
-> Maybe [MediaPackageOutputDestinationSettings]
-> Maybe MultiplexProgramChannelDestinationSettings
-> Maybe [OutputDestinationSettings]
-> OutputDestination
OutputDestination'
            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
"id")
            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
"mediaPackageSettings"
                            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
"multiplexSettings")
            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
"settings" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable OutputDestination where
  hashWithSalt :: Int -> OutputDestination -> Int
hashWithSalt Int
_salt OutputDestination' {Maybe [MediaPackageOutputDestinationSettings]
Maybe [OutputDestinationSettings]
Maybe Text
Maybe MultiplexProgramChannelDestinationSettings
settings :: Maybe [OutputDestinationSettings]
multiplexSettings :: Maybe MultiplexProgramChannelDestinationSettings
mediaPackageSettings :: Maybe [MediaPackageOutputDestinationSettings]
id :: Maybe Text
$sel:settings:OutputDestination' :: OutputDestination -> Maybe [OutputDestinationSettings]
$sel:multiplexSettings:OutputDestination' :: OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
$sel:mediaPackageSettings:OutputDestination' :: OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
$sel:id:OutputDestination' :: OutputDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OutputDestinationSettings]
settings

instance Prelude.NFData OutputDestination where
  rnf :: OutputDestination -> ()
rnf OutputDestination' {Maybe [MediaPackageOutputDestinationSettings]
Maybe [OutputDestinationSettings]
Maybe Text
Maybe MultiplexProgramChannelDestinationSettings
settings :: Maybe [OutputDestinationSettings]
multiplexSettings :: Maybe MultiplexProgramChannelDestinationSettings
mediaPackageSettings :: Maybe [MediaPackageOutputDestinationSettings]
id :: Maybe Text
$sel:settings:OutputDestination' :: OutputDestination -> Maybe [OutputDestinationSettings]
$sel:multiplexSettings:OutputDestination' :: OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
$sel:mediaPackageSettings:OutputDestination' :: OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
$sel:id:OutputDestination' :: OutputDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OutputDestinationSettings]
settings

instance Data.ToJSON OutputDestination where
  toJSON :: OutputDestination -> Value
toJSON OutputDestination' {Maybe [MediaPackageOutputDestinationSettings]
Maybe [OutputDestinationSettings]
Maybe Text
Maybe MultiplexProgramChannelDestinationSettings
settings :: Maybe [OutputDestinationSettings]
multiplexSettings :: Maybe MultiplexProgramChannelDestinationSettings
mediaPackageSettings :: Maybe [MediaPackageOutputDestinationSettings]
id :: Maybe Text
$sel:settings:OutputDestination' :: OutputDestination -> Maybe [OutputDestinationSettings]
$sel:multiplexSettings:OutputDestination' :: OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
$sel:mediaPackageSettings:OutputDestination' :: OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
$sel:id:OutputDestination' :: OutputDestination -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"id" 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
id,
            (Key
"mediaPackageSettings" 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 [MediaPackageOutputDestinationSettings]
mediaPackageSettings,
            (Key
"multiplexSettings" 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 MultiplexProgramChannelDestinationSettings
multiplexSettings,
            (Key
"settings" 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 [OutputDestinationSettings]
settings
          ]
      )