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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.OutputLocationRef
import qualified Amazonka.Prelude as Prelude

-- | Media Package Group Settings
--
-- /See:/ 'newMediaPackageGroupSettings' smart constructor.
data MediaPackageGroupSettings = MediaPackageGroupSettings'
  { -- | MediaPackage channel destination.
    MediaPackageGroupSettings -> OutputLocationRef
destination :: OutputLocationRef
  }
  deriving (MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool
(MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool)
-> (MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool)
-> Eq MediaPackageGroupSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool
$c/= :: MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool
== :: MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool
$c== :: MediaPackageGroupSettings -> MediaPackageGroupSettings -> Bool
Prelude.Eq, ReadPrec [MediaPackageGroupSettings]
ReadPrec MediaPackageGroupSettings
Int -> ReadS MediaPackageGroupSettings
ReadS [MediaPackageGroupSettings]
(Int -> ReadS MediaPackageGroupSettings)
-> ReadS [MediaPackageGroupSettings]
-> ReadPrec MediaPackageGroupSettings
-> ReadPrec [MediaPackageGroupSettings]
-> Read MediaPackageGroupSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MediaPackageGroupSettings]
$creadListPrec :: ReadPrec [MediaPackageGroupSettings]
readPrec :: ReadPrec MediaPackageGroupSettings
$creadPrec :: ReadPrec MediaPackageGroupSettings
readList :: ReadS [MediaPackageGroupSettings]
$creadList :: ReadS [MediaPackageGroupSettings]
readsPrec :: Int -> ReadS MediaPackageGroupSettings
$creadsPrec :: Int -> ReadS MediaPackageGroupSettings
Prelude.Read, Int -> MediaPackageGroupSettings -> ShowS
[MediaPackageGroupSettings] -> ShowS
MediaPackageGroupSettings -> String
(Int -> MediaPackageGroupSettings -> ShowS)
-> (MediaPackageGroupSettings -> String)
-> ([MediaPackageGroupSettings] -> ShowS)
-> Show MediaPackageGroupSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MediaPackageGroupSettings] -> ShowS
$cshowList :: [MediaPackageGroupSettings] -> ShowS
show :: MediaPackageGroupSettings -> String
$cshow :: MediaPackageGroupSettings -> String
showsPrec :: Int -> MediaPackageGroupSettings -> ShowS
$cshowsPrec :: Int -> MediaPackageGroupSettings -> ShowS
Prelude.Show, (forall x.
 MediaPackageGroupSettings -> Rep MediaPackageGroupSettings x)
-> (forall x.
    Rep MediaPackageGroupSettings x -> MediaPackageGroupSettings)
-> Generic MediaPackageGroupSettings
forall x.
Rep MediaPackageGroupSettings x -> MediaPackageGroupSettings
forall x.
MediaPackageGroupSettings -> Rep MediaPackageGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MediaPackageGroupSettings x -> MediaPackageGroupSettings
$cfrom :: forall x.
MediaPackageGroupSettings -> Rep MediaPackageGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'MediaPackageGroupSettings' 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:
--
-- 'destination', 'mediaPackageGroupSettings_destination' - MediaPackage channel destination.
newMediaPackageGroupSettings ::
  -- | 'destination'
  OutputLocationRef ->
  MediaPackageGroupSettings
newMediaPackageGroupSettings :: OutputLocationRef -> MediaPackageGroupSettings
newMediaPackageGroupSettings OutputLocationRef
pDestination_ =
  MediaPackageGroupSettings' :: OutputLocationRef -> MediaPackageGroupSettings
MediaPackageGroupSettings'
    { $sel:destination:MediaPackageGroupSettings' :: OutputLocationRef
destination =
        OutputLocationRef
pDestination_
    }

-- | MediaPackage channel destination.
mediaPackageGroupSettings_destination :: Lens.Lens' MediaPackageGroupSettings OutputLocationRef
mediaPackageGroupSettings_destination :: (OutputLocationRef -> f OutputLocationRef)
-> MediaPackageGroupSettings -> f MediaPackageGroupSettings
mediaPackageGroupSettings_destination = (MediaPackageGroupSettings -> OutputLocationRef)
-> (MediaPackageGroupSettings
    -> OutputLocationRef -> MediaPackageGroupSettings)
-> Lens
     MediaPackageGroupSettings
     MediaPackageGroupSettings
     OutputLocationRef
     OutputLocationRef
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaPackageGroupSettings' {OutputLocationRef
destination :: OutputLocationRef
$sel:destination:MediaPackageGroupSettings' :: MediaPackageGroupSettings -> OutputLocationRef
destination} -> OutputLocationRef
destination) (\s :: MediaPackageGroupSettings
s@MediaPackageGroupSettings' {} OutputLocationRef
a -> MediaPackageGroupSettings
s {$sel:destination:MediaPackageGroupSettings' :: OutputLocationRef
destination = OutputLocationRef
a} :: MediaPackageGroupSettings)

instance Core.FromJSON MediaPackageGroupSettings where
  parseJSON :: Value -> Parser MediaPackageGroupSettings
parseJSON =
    String
-> (Object -> Parser MediaPackageGroupSettings)
-> Value
-> Parser MediaPackageGroupSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MediaPackageGroupSettings"
      ( \Object
x ->
          OutputLocationRef -> MediaPackageGroupSettings
MediaPackageGroupSettings'
            (OutputLocationRef -> MediaPackageGroupSettings)
-> Parser OutputLocationRef -> Parser MediaPackageGroupSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser OutputLocationRef
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destination")
      )

instance Prelude.Hashable MediaPackageGroupSettings

instance Prelude.NFData MediaPackageGroupSettings

instance Core.ToJSON MediaPackageGroupSettings where
  toJSON :: MediaPackageGroupSettings -> Value
toJSON MediaPackageGroupSettings' {OutputLocationRef
destination :: OutputLocationRef
$sel:destination:MediaPackageGroupSettings' :: MediaPackageGroupSettings -> OutputLocationRef
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"destination" Text -> OutputLocationRef -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OutputLocationRef
destination)]
      )