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

-- | Option for specifying the start time for an action.
scheduleActionStartSettings_fixedModeScheduleActionStartSettings :: Lens.Lens' ScheduleActionStartSettings (Prelude.Maybe FixedModeScheduleActionStartSettings)
scheduleActionStartSettings_fixedModeScheduleActionStartSettings :: Lens'
  ScheduleActionStartSettings
  (Maybe FixedModeScheduleActionStartSettings)
scheduleActionStartSettings_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)

-- | Option for specifying an action as relative to another action.
scheduleActionStartSettings_followModeScheduleActionStartSettings :: Lens.Lens' ScheduleActionStartSettings (Prelude.Maybe FollowModeScheduleActionStartSettings)
scheduleActionStartSettings_followModeScheduleActionStartSettings :: Lens'
  ScheduleActionStartSettings
  (Maybe FollowModeScheduleActionStartSettings)
scheduleActionStartSettings_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 an action that should be applied immediately.
scheduleActionStartSettings_immediateModeScheduleActionStartSettings :: Lens.Lens' ScheduleActionStartSettings (Prelude.Maybe ImmediateModeScheduleActionStartSettings)
scheduleActionStartSettings_immediateModeScheduleActionStartSettings :: Lens'
  ScheduleActionStartSettings
  (Maybe ImmediateModeScheduleActionStartSettings)
scheduleActionStartSettings_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)

instance Data.FromJSON ScheduleActionStartSettings where
  parseJSON :: Value -> Parser ScheduleActionStartSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScheduleActionStartSettings"
      ( \Object
x ->
          Maybe FixedModeScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
-> ScheduleActionStartSettings
ScheduleActionStartSettings'
            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
"fixedModeScheduleActionStartSettings")
            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
"followModeScheduleActionStartSettings")
            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
"immediateModeScheduleActionStartSettings"
                        )
      )

instance Prelude.Hashable ScheduleActionStartSettings where
  hashWithSalt :: Int -> ScheduleActionStartSettings -> Int
hashWithSalt Int
_salt ScheduleActionStartSettings' {Maybe FixedModeScheduleActionStartSettings
Maybe FollowModeScheduleActionStartSettings
Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings :: Maybe ImmediateModeScheduleActionStartSettings
followModeScheduleActionStartSettings :: Maybe FollowModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings :: Maybe FixedModeScheduleActionStartSettings
$sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
$sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
$sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings

instance Prelude.NFData ScheduleActionStartSettings where
  rnf :: ScheduleActionStartSettings -> ()
rnf ScheduleActionStartSettings' {Maybe FixedModeScheduleActionStartSettings
Maybe FollowModeScheduleActionStartSettings
Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings :: Maybe ImmediateModeScheduleActionStartSettings
followModeScheduleActionStartSettings :: Maybe FollowModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings :: Maybe FixedModeScheduleActionStartSettings
$sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
$sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
$sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings

instance Data.ToJSON ScheduleActionStartSettings where
  toJSON :: ScheduleActionStartSettings -> Value
toJSON ScheduleActionStartSettings' {Maybe FixedModeScheduleActionStartSettings
Maybe FollowModeScheduleActionStartSettings
Maybe ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings :: Maybe ImmediateModeScheduleActionStartSettings
followModeScheduleActionStartSettings :: Maybe FollowModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings :: Maybe FixedModeScheduleActionStartSettings
$sel:immediateModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe ImmediateModeScheduleActionStartSettings
$sel:followModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FollowModeScheduleActionStartSettings
$sel:fixedModeScheduleActionStartSettings:ScheduleActionStartSettings' :: ScheduleActionStartSettings
-> Maybe FixedModeScheduleActionStartSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"fixedModeScheduleActionStartSettings" 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 FixedModeScheduleActionStartSettings
fixedModeScheduleActionStartSettings,
            (Key
"followModeScheduleActionStartSettings" 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 FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings,
            (Key
"immediateModeScheduleActionStartSettings" 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 ImmediateModeScheduleActionStartSettings
immediateModeScheduleActionStartSettings
          ]
      )