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

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

-- | Settings for the action to set pause state of a channel.
--
-- /See:/ 'newPauseStateScheduleActionSettings' smart constructor.
data PauseStateScheduleActionSettings = PauseStateScheduleActionSettings'
  { PauseStateScheduleActionSettings
-> Maybe [PipelinePauseStateSettings]
pipelines :: Prelude.Maybe [PipelinePauseStateSettings]
  }
  deriving (PauseStateScheduleActionSettings
-> PauseStateScheduleActionSettings -> Bool
(PauseStateScheduleActionSettings
 -> PauseStateScheduleActionSettings -> Bool)
-> (PauseStateScheduleActionSettings
    -> PauseStateScheduleActionSettings -> Bool)
-> Eq PauseStateScheduleActionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PauseStateScheduleActionSettings
-> PauseStateScheduleActionSettings -> Bool
$c/= :: PauseStateScheduleActionSettings
-> PauseStateScheduleActionSettings -> Bool
== :: PauseStateScheduleActionSettings
-> PauseStateScheduleActionSettings -> Bool
$c== :: PauseStateScheduleActionSettings
-> PauseStateScheduleActionSettings -> Bool
Prelude.Eq, ReadPrec [PauseStateScheduleActionSettings]
ReadPrec PauseStateScheduleActionSettings
Int -> ReadS PauseStateScheduleActionSettings
ReadS [PauseStateScheduleActionSettings]
(Int -> ReadS PauseStateScheduleActionSettings)
-> ReadS [PauseStateScheduleActionSettings]
-> ReadPrec PauseStateScheduleActionSettings
-> ReadPrec [PauseStateScheduleActionSettings]
-> Read PauseStateScheduleActionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PauseStateScheduleActionSettings]
$creadListPrec :: ReadPrec [PauseStateScheduleActionSettings]
readPrec :: ReadPrec PauseStateScheduleActionSettings
$creadPrec :: ReadPrec PauseStateScheduleActionSettings
readList :: ReadS [PauseStateScheduleActionSettings]
$creadList :: ReadS [PauseStateScheduleActionSettings]
readsPrec :: Int -> ReadS PauseStateScheduleActionSettings
$creadsPrec :: Int -> ReadS PauseStateScheduleActionSettings
Prelude.Read, Int -> PauseStateScheduleActionSettings -> ShowS
[PauseStateScheduleActionSettings] -> ShowS
PauseStateScheduleActionSettings -> String
(Int -> PauseStateScheduleActionSettings -> ShowS)
-> (PauseStateScheduleActionSettings -> String)
-> ([PauseStateScheduleActionSettings] -> ShowS)
-> Show PauseStateScheduleActionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PauseStateScheduleActionSettings] -> ShowS
$cshowList :: [PauseStateScheduleActionSettings] -> ShowS
show :: PauseStateScheduleActionSettings -> String
$cshow :: PauseStateScheduleActionSettings -> String
showsPrec :: Int -> PauseStateScheduleActionSettings -> ShowS
$cshowsPrec :: Int -> PauseStateScheduleActionSettings -> ShowS
Prelude.Show, (forall x.
 PauseStateScheduleActionSettings
 -> Rep PauseStateScheduleActionSettings x)
-> (forall x.
    Rep PauseStateScheduleActionSettings x
    -> PauseStateScheduleActionSettings)
-> Generic PauseStateScheduleActionSettings
forall x.
Rep PauseStateScheduleActionSettings x
-> PauseStateScheduleActionSettings
forall x.
PauseStateScheduleActionSettings
-> Rep PauseStateScheduleActionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PauseStateScheduleActionSettings x
-> PauseStateScheduleActionSettings
$cfrom :: forall x.
PauseStateScheduleActionSettings
-> Rep PauseStateScheduleActionSettings x
Prelude.Generic)

-- |
-- Create a value of 'PauseStateScheduleActionSettings' 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:
--
-- 'pipelines', 'pauseStateScheduleActionSettings_pipelines' - Undocumented member.
newPauseStateScheduleActionSettings ::
  PauseStateScheduleActionSettings
newPauseStateScheduleActionSettings :: PauseStateScheduleActionSettings
newPauseStateScheduleActionSettings =
  PauseStateScheduleActionSettings' :: Maybe [PipelinePauseStateSettings]
-> PauseStateScheduleActionSettings
PauseStateScheduleActionSettings'
    { $sel:pipelines:PauseStateScheduleActionSettings' :: Maybe [PipelinePauseStateSettings]
pipelines =
        Maybe [PipelinePauseStateSettings]
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
pauseStateScheduleActionSettings_pipelines :: Lens.Lens' PauseStateScheduleActionSettings (Prelude.Maybe [PipelinePauseStateSettings])
pauseStateScheduleActionSettings_pipelines :: (Maybe [PipelinePauseStateSettings]
 -> f (Maybe [PipelinePauseStateSettings]))
-> PauseStateScheduleActionSettings
-> f PauseStateScheduleActionSettings
pauseStateScheduleActionSettings_pipelines = (PauseStateScheduleActionSettings
 -> Maybe [PipelinePauseStateSettings])
-> (PauseStateScheduleActionSettings
    -> Maybe [PipelinePauseStateSettings]
    -> PauseStateScheduleActionSettings)
-> Lens
     PauseStateScheduleActionSettings
     PauseStateScheduleActionSettings
     (Maybe [PipelinePauseStateSettings])
     (Maybe [PipelinePauseStateSettings])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PauseStateScheduleActionSettings' {Maybe [PipelinePauseStateSettings]
pipelines :: Maybe [PipelinePauseStateSettings]
$sel:pipelines:PauseStateScheduleActionSettings' :: PauseStateScheduleActionSettings
-> Maybe [PipelinePauseStateSettings]
pipelines} -> Maybe [PipelinePauseStateSettings]
pipelines) (\s :: PauseStateScheduleActionSettings
s@PauseStateScheduleActionSettings' {} Maybe [PipelinePauseStateSettings]
a -> PauseStateScheduleActionSettings
s {$sel:pipelines:PauseStateScheduleActionSettings' :: Maybe [PipelinePauseStateSettings]
pipelines = Maybe [PipelinePauseStateSettings]
a} :: PauseStateScheduleActionSettings) ((Maybe [PipelinePauseStateSettings]
  -> f (Maybe [PipelinePauseStateSettings]))
 -> PauseStateScheduleActionSettings
 -> f PauseStateScheduleActionSettings)
-> ((Maybe [PipelinePauseStateSettings]
     -> f (Maybe [PipelinePauseStateSettings]))
    -> Maybe [PipelinePauseStateSettings]
    -> f (Maybe [PipelinePauseStateSettings]))
-> (Maybe [PipelinePauseStateSettings]
    -> f (Maybe [PipelinePauseStateSettings]))
-> PauseStateScheduleActionSettings
-> f PauseStateScheduleActionSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PipelinePauseStateSettings]
  [PipelinePauseStateSettings]
  [PipelinePauseStateSettings]
  [PipelinePauseStateSettings]
-> Iso
     (Maybe [PipelinePauseStateSettings])
     (Maybe [PipelinePauseStateSettings])
     (Maybe [PipelinePauseStateSettings])
     (Maybe [PipelinePauseStateSettings])
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
  [PipelinePauseStateSettings]
  [PipelinePauseStateSettings]
  [PipelinePauseStateSettings]
  [PipelinePauseStateSettings]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    PauseStateScheduleActionSettings
  where
  parseJSON :: Value -> Parser PauseStateScheduleActionSettings
parseJSON =
    String
-> (Object -> Parser PauseStateScheduleActionSettings)
-> Value
-> Parser PauseStateScheduleActionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PauseStateScheduleActionSettings"
      ( \Object
x ->
          Maybe [PipelinePauseStateSettings]
-> PauseStateScheduleActionSettings
PauseStateScheduleActionSettings'
            (Maybe [PipelinePauseStateSettings]
 -> PauseStateScheduleActionSettings)
-> Parser (Maybe [PipelinePauseStateSettings])
-> Parser PauseStateScheduleActionSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [PipelinePauseStateSettings]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pipelines" Parser (Maybe (Maybe [PipelinePauseStateSettings]))
-> Maybe [PipelinePauseStateSettings]
-> Parser (Maybe [PipelinePauseStateSettings])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PipelinePauseStateSettings]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    PauseStateScheduleActionSettings

instance
  Prelude.NFData
    PauseStateScheduleActionSettings

instance Core.ToJSON PauseStateScheduleActionSettings where
  toJSON :: PauseStateScheduleActionSettings -> Value
toJSON PauseStateScheduleActionSettings' {Maybe [PipelinePauseStateSettings]
pipelines :: Maybe [PipelinePauseStateSettings]
$sel:pipelines:PauseStateScheduleActionSettings' :: PauseStateScheduleActionSettings
-> Maybe [PipelinePauseStateSettings]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"pipelines" Text -> [PipelinePauseStateSettings] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PipelinePauseStateSettings] -> Pair)
-> Maybe [PipelinePauseStateSettings] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PipelinePauseStateSettings]
pipelines]
      )