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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.FixedModeScheduleActionStartSettings
import Amazonka.MediaLive.Types.FollowModeScheduleActionStartSettings
import Amazonka.MediaLive.Types.ImmediateModeScheduleActionStartSettings
import qualified Amazonka.Prelude as Prelude

-- | Settings to specify when an action should occur. Only one of the options
-- must be selected.
--
-- /See:/ 'newScheduleActionStartSettings' smart constructor.
data ScheduleActionStartSettings = ScheduleActionStartSettings'
  { -- | Option for specifying an action that should be applied immediately.
    ScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings :: Prelude.Maybe ImmediateModeScheduleActionStartSettings,
    -- | Option for specifying an action as relative to another action.
    ScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings :: Prelude.Maybe FollowModeScheduleActionStartSettings,
    -- | Option for specifying the start time for an action.
    ScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings :: Prelude.Maybe FixedModeScheduleActionStartSettings
  }
  deriving (ScheduleActionStartSettings -> ScheduleActionStartSettings -> Bool
(ScheduleActionStartSettings
 -> ScheduleActionStartSettings -> Bool)
-> (ScheduleActionStartSettings
    -> ScheduleActionStartSettings -> Bool)
-> Eq ScheduleActionStartSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleActionStartSettings -> ScheduleActionStartSettings -> Bool
$c/= :: ScheduleActionStartSettings -> ScheduleActionStartSettings -> Bool
== :: ScheduleActionStartSettings -> ScheduleActionStartSettings -> Bool
$c== :: ScheduleActionStartSettings -> ScheduleActionStartSettings -> Bool
Prelude.Eq, ReadPrec [ScheduleActionStartSettings]
ReadPrec ScheduleActionStartSettings
Int -> ReadS ScheduleActionStartSettings
ReadS [ScheduleActionStartSettings]
(Int -> ReadS ScheduleActionStartSettings)
-> ReadS [ScheduleActionStartSettings]
-> ReadPrec ScheduleActionStartSettings
-> ReadPrec [ScheduleActionStartSettings]
-> Read ScheduleActionStartSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleActionStartSettings]
$creadListPrec :: ReadPrec [ScheduleActionStartSettings]
readPrec :: ReadPrec ScheduleActionStartSettings
$creadPrec :: ReadPrec ScheduleActionStartSettings
readList :: ReadS [ScheduleActionStartSettings]
$creadList :: ReadS [ScheduleActionStartSettings]
readsPrec :: Int -> ReadS ScheduleActionStartSettings
$creadsPrec :: Int -> ReadS ScheduleActionStartSettings
Prelude.Read, Int -> ScheduleActionStartSettings -> ShowS
[ScheduleActionStartSettings] -> ShowS
ScheduleActionStartSettings -> String
(Int -> ScheduleActionStartSettings -> ShowS)
-> (ScheduleActionStartSettings -> String)
-> ([ScheduleActionStartSettings] -> ShowS)
-> Show ScheduleActionStartSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleActionStartSettings] -> ShowS
$cshowList :: [ScheduleActionStartSettings] -> ShowS
show :: ScheduleActionStartSettings -> String
$cshow :: ScheduleActionStartSettings -> String
showsPrec :: Int -> ScheduleActionStartSettings -> ShowS
$cshowsPrec :: Int -> ScheduleActionStartSettings -> ShowS
Prelude.Show, (forall x.
 ScheduleActionStartSettings -> Rep ScheduleActionStartSettings x)
-> (forall x.
    Rep ScheduleActionStartSettings x -> ScheduleActionStartSettings)
-> Generic ScheduleActionStartSettings
forall x.
Rep ScheduleActionStartSettings x -> ScheduleActionStartSettings
forall x.
ScheduleActionStartSettings -> Rep ScheduleActionStartSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduleActionStartSettings x -> ScheduleActionStartSettings
$cfrom :: forall x.
ScheduleActionStartSettings -> Rep ScheduleActionStartSettings x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleActionStartSettings' 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:
--
-- 'immediateModeScheduleActionStartSettings', 'scheduleActionStartSettings_immediateModeScheduleActionStartSettings' - Option for specifying an action that should be applied immediately.
--
-- 'followModeScheduleActionStartSettings', 'scheduleActionStartSettings_followModeScheduleActionStartSettings' - Option for specifying an action as relative to another action.
--
-- 'fixedModeScheduleActionStartSettings', 'scheduleActionStartSettings_fixedModeScheduleActionStartSettings' - Option for specifying the start time for an action.
newScheduleActionStartSettings ::
  ScheduleActionStartSettings
newScheduleActionStartSettings :: ScheduleActionStartSettings
newScheduleActionStartSettings =
  ScheduleActionStartSettings' :: Maybe ImmediateModeScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
-> ScheduleActionStartSettings
ScheduleActionStartSettings'
    { $sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings =
        Maybe ImmediateModeScheduleActionStartSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings =
        Maybe FollowModeScheduleActionStartSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings =
        Maybe FixedModeScheduleActionStartSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Option for specifying an action that should be applied immediately.
scheduleActionStartSettings_immediateModeScheduleActionStartSettings :: Lens.Lens' ScheduleActionStartSettings (Prelude.Maybe ImmediateModeScheduleActionStartSettings)
scheduleActionStartSettings_immediateModeScheduleActionStartSettings :: (Maybe ImmediateModeScheduleActionStartSettings
 -> f (Maybe ImmediateModeScheduleActionStartSettings))
-> ScheduleActionStartSettings -> f ScheduleActionStartSettings
scheduleActionStartSettings_immediateModeScheduleActionStartSettings = (ScheduleActionStartSettings
 -> Maybe ImmediateModeScheduleActionStartSettings)
-> (ScheduleActionStartSettings
    -> Maybe ImmediateModeScheduleActionStartSettings
    -> ScheduleActionStartSettings)
-> Lens
     ScheduleActionStartSettings
     ScheduleActionStartSettings
     (Maybe ImmediateModeScheduleActionStartSettings)
     (Maybe ImmediateModeScheduleActionStartSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleActionStartSettings' {Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings :: Maybe ImmediateModeScheduleActionStartSettings
$sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings} -> Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings) (\s :: ScheduleActionStartSettings
s@ScheduleActionStartSettings' {} Maybe ImmediateModeScheduleActionStartSettings
a -> ScheduleActionStartSettings
s {$sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings = Maybe ImmediateModeScheduleActionStartSettings
a} :: ScheduleActionStartSettings)

-- | Option for specifying an action as relative to another action.
scheduleActionStartSettings_followModeScheduleActionStartSettings :: Lens.Lens' ScheduleActionStartSettings (Prelude.Maybe FollowModeScheduleActionStartSettings)
scheduleActionStartSettings_followModeScheduleActionStartSettings :: (Maybe FollowModeScheduleActionStartSettings
 -> f (Maybe FollowModeScheduleActionStartSettings))
-> ScheduleActionStartSettings -> f ScheduleActionStartSettings
scheduleActionStartSettings_followModeScheduleActionStartSettings = (ScheduleActionStartSettings
 -> Maybe FollowModeScheduleActionStartSettings)
-> (ScheduleActionStartSettings
    -> Maybe FollowModeScheduleActionStartSettings
    -> ScheduleActionStartSettings)
-> Lens
     ScheduleActionStartSettings
     ScheduleActionStartSettings
     (Maybe FollowModeScheduleActionStartSettings)
     (Maybe FollowModeScheduleActionStartSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleActionStartSettings' {Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings :: Maybe FollowModeScheduleActionStartSettings
$sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings} -> Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings) (\s :: ScheduleActionStartSettings
s@ScheduleActionStartSettings' {} Maybe FollowModeScheduleActionStartSettings
a -> ScheduleActionStartSettings
s {$sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings = Maybe FollowModeScheduleActionStartSettings
a} :: ScheduleActionStartSettings)

-- | Option for specifying the start time for an action.
scheduleActionStartSettings_fixedModeScheduleActionStartSettings :: Lens.Lens' ScheduleActionStartSettings (Prelude.Maybe FixedModeScheduleActionStartSettings)
scheduleActionStartSettings_fixedModeScheduleActionStartSettings :: (Maybe FixedModeScheduleActionStartSettings
 -> f (Maybe FixedModeScheduleActionStartSettings))
-> ScheduleActionStartSettings -> f ScheduleActionStartSettings
scheduleActionStartSettings_fixedModeScheduleActionStartSettings = (ScheduleActionStartSettings
 -> Maybe FixedModeScheduleActionStartSettings)
-> (ScheduleActionStartSettings
    -> Maybe FixedModeScheduleActionStartSettings
    -> ScheduleActionStartSettings)
-> Lens
     ScheduleActionStartSettings
     ScheduleActionStartSettings
     (Maybe FixedModeScheduleActionStartSettings)
     (Maybe FixedModeScheduleActionStartSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleActionStartSettings' {Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings :: Maybe FixedModeScheduleActionStartSettings
$sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings} -> Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings) (\s :: ScheduleActionStartSettings
s@ScheduleActionStartSettings' {} Maybe FixedModeScheduleActionStartSettings
a -> ScheduleActionStartSettings
s {$sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings = Maybe FixedModeScheduleActionStartSettings
a} :: ScheduleActionStartSettings)

instance Core.FromJSON ScheduleActionStartSettings where
  parseJSON :: Value -> Parser ScheduleActionStartSettings
parseJSON =
    String
-> (Object -> Parser ScheduleActionStartSettings)
-> Value
-> Parser ScheduleActionStartSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ScheduleActionStartSettings"
      ( \Object
x ->
          Maybe ImmediateModeScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
-> ScheduleActionStartSettings
ScheduleActionStartSettings'
            (Maybe ImmediateModeScheduleActionStartSettings
 -> Maybe FollowModeScheduleActionStartSettings
 -> Maybe FixedModeScheduleActionStartSettings
 -> ScheduleActionStartSettings)
-> Parser (Maybe ImmediateModeScheduleActionStartSettings)
-> Parser
     (Maybe FollowModeScheduleActionStartSettings
      -> Maybe FixedModeScheduleActionStartSettings
      -> ScheduleActionStartSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            Object
-> Text -> Parser (Maybe ImmediateModeScheduleActionStartSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"immediateModeScheduleActionStartSettings"
                        )
            Parser
  (Maybe FollowModeScheduleActionStartSettings
   -> Maybe FixedModeScheduleActionStartSettings
   -> ScheduleActionStartSettings)
-> Parser (Maybe FollowModeScheduleActionStartSettings)
-> Parser
     (Maybe FixedModeScheduleActionStartSettings
      -> ScheduleActionStartSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe FollowModeScheduleActionStartSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"followModeScheduleActionStartSettings")
            Parser
  (Maybe FixedModeScheduleActionStartSettings
   -> ScheduleActionStartSettings)
-> Parser (Maybe FixedModeScheduleActionStartSettings)
-> Parser ScheduleActionStartSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe FixedModeScheduleActionStartSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fixedModeScheduleActionStartSettings")
      )

instance Prelude.Hashable ScheduleActionStartSettings

instance Prelude.NFData ScheduleActionStartSettings

instance Core.ToJSON ScheduleActionStartSettings where
  toJSON :: ScheduleActionStartSettings -> Value
toJSON ScheduleActionStartSettings' {Maybe FixedModeScheduleActionStartSettings
Maybe FollowModeScheduleActionStartSettings
Maybe ImmediateModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings :: Maybe FixedModeScheduleActionStartSettings
followModeScheduleActionStartSettings :: Maybe FollowModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings :: Maybe ImmediateModeScheduleActionStartSettings
$sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
$sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
$sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"immediateModeScheduleActionStartSettings" Text -> ImmediateModeScheduleActionStartSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ImmediateModeScheduleActionStartSettings -> Pair)
-> Maybe ImmediateModeScheduleActionStartSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings,
            (Text
"followModeScheduleActionStartSettings" Text -> FollowModeScheduleActionStartSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FollowModeScheduleActionStartSettings -> Pair)
-> Maybe FollowModeScheduleActionStartSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings,
            (Text
"fixedModeScheduleActionStartSettings" Text -> FixedModeScheduleActionStartSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FixedModeScheduleActionStartSettings -> Pair)
-> Maybe FixedModeScheduleActionStartSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings
          ]
      )