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

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

-- | Settings to specify if an action follows another.
--
-- /See:/ 'newFollowModeScheduleActionStartSettings' smart constructor.
data FollowModeScheduleActionStartSettings = FollowModeScheduleActionStartSettings'
  { -- | The action name of another action that this one refers to.
    FollowModeScheduleActionStartSettings -> Text
referenceActionName :: Prelude.Text,
    -- | Identifies whether this action starts relative to the start or relative
    -- to the end of the reference action.
    FollowModeScheduleActionStartSettings -> FollowPoint
followPoint :: FollowPoint
  }
  deriving (FollowModeScheduleActionStartSettings
-> FollowModeScheduleActionStartSettings -> Bool
(FollowModeScheduleActionStartSettings
 -> FollowModeScheduleActionStartSettings -> Bool)
-> (FollowModeScheduleActionStartSettings
    -> FollowModeScheduleActionStartSettings -> Bool)
-> Eq FollowModeScheduleActionStartSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FollowModeScheduleActionStartSettings
-> FollowModeScheduleActionStartSettings -> Bool
$c/= :: FollowModeScheduleActionStartSettings
-> FollowModeScheduleActionStartSettings -> Bool
== :: FollowModeScheduleActionStartSettings
-> FollowModeScheduleActionStartSettings -> Bool
$c== :: FollowModeScheduleActionStartSettings
-> FollowModeScheduleActionStartSettings -> Bool
Prelude.Eq, ReadPrec [FollowModeScheduleActionStartSettings]
ReadPrec FollowModeScheduleActionStartSettings
Int -> ReadS FollowModeScheduleActionStartSettings
ReadS [FollowModeScheduleActionStartSettings]
(Int -> ReadS FollowModeScheduleActionStartSettings)
-> ReadS [FollowModeScheduleActionStartSettings]
-> ReadPrec FollowModeScheduleActionStartSettings
-> ReadPrec [FollowModeScheduleActionStartSettings]
-> Read FollowModeScheduleActionStartSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FollowModeScheduleActionStartSettings]
$creadListPrec :: ReadPrec [FollowModeScheduleActionStartSettings]
readPrec :: ReadPrec FollowModeScheduleActionStartSettings
$creadPrec :: ReadPrec FollowModeScheduleActionStartSettings
readList :: ReadS [FollowModeScheduleActionStartSettings]
$creadList :: ReadS [FollowModeScheduleActionStartSettings]
readsPrec :: Int -> ReadS FollowModeScheduleActionStartSettings
$creadsPrec :: Int -> ReadS FollowModeScheduleActionStartSettings
Prelude.Read, Int -> FollowModeScheduleActionStartSettings -> ShowS
[FollowModeScheduleActionStartSettings] -> ShowS
FollowModeScheduleActionStartSettings -> String
(Int -> FollowModeScheduleActionStartSettings -> ShowS)
-> (FollowModeScheduleActionStartSettings -> String)
-> ([FollowModeScheduleActionStartSettings] -> ShowS)
-> Show FollowModeScheduleActionStartSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FollowModeScheduleActionStartSettings] -> ShowS
$cshowList :: [FollowModeScheduleActionStartSettings] -> ShowS
show :: FollowModeScheduleActionStartSettings -> String
$cshow :: FollowModeScheduleActionStartSettings -> String
showsPrec :: Int -> FollowModeScheduleActionStartSettings -> ShowS
$cshowsPrec :: Int -> FollowModeScheduleActionStartSettings -> ShowS
Prelude.Show, (forall x.
 FollowModeScheduleActionStartSettings
 -> Rep FollowModeScheduleActionStartSettings x)
-> (forall x.
    Rep FollowModeScheduleActionStartSettings x
    -> FollowModeScheduleActionStartSettings)
-> Generic FollowModeScheduleActionStartSettings
forall x.
Rep FollowModeScheduleActionStartSettings x
-> FollowModeScheduleActionStartSettings
forall x.
FollowModeScheduleActionStartSettings
-> Rep FollowModeScheduleActionStartSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FollowModeScheduleActionStartSettings x
-> FollowModeScheduleActionStartSettings
$cfrom :: forall x.
FollowModeScheduleActionStartSettings
-> Rep FollowModeScheduleActionStartSettings x
Prelude.Generic)

-- |
-- Create a value of 'FollowModeScheduleActionStartSettings' 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:
--
-- 'referenceActionName', 'followModeScheduleActionStartSettings_referenceActionName' - The action name of another action that this one refers to.
--
-- 'followPoint', 'followModeScheduleActionStartSettings_followPoint' - Identifies whether this action starts relative to the start or relative
-- to the end of the reference action.
newFollowModeScheduleActionStartSettings ::
  -- | 'referenceActionName'
  Prelude.Text ->
  -- | 'followPoint'
  FollowPoint ->
  FollowModeScheduleActionStartSettings
newFollowModeScheduleActionStartSettings :: Text -> FollowPoint -> FollowModeScheduleActionStartSettings
newFollowModeScheduleActionStartSettings
  Text
pReferenceActionName_
  FollowPoint
pFollowPoint_ =
    FollowModeScheduleActionStartSettings' :: Text -> FollowPoint -> FollowModeScheduleActionStartSettings
FollowModeScheduleActionStartSettings'
      { $sel:referenceActionName:FollowModeScheduleActionStartSettings' :: Text
referenceActionName =
          Text
pReferenceActionName_,
        $sel:followPoint:FollowModeScheduleActionStartSettings' :: FollowPoint
followPoint = FollowPoint
pFollowPoint_
      }

-- | The action name of another action that this one refers to.
followModeScheduleActionStartSettings_referenceActionName :: Lens.Lens' FollowModeScheduleActionStartSettings Prelude.Text
followModeScheduleActionStartSettings_referenceActionName :: (Text -> f Text)
-> FollowModeScheduleActionStartSettings
-> f FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings_referenceActionName = (FollowModeScheduleActionStartSettings -> Text)
-> (FollowModeScheduleActionStartSettings
    -> Text -> FollowModeScheduleActionStartSettings)
-> Lens
     FollowModeScheduleActionStartSettings
     FollowModeScheduleActionStartSettings
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FollowModeScheduleActionStartSettings' {Text
referenceActionName :: Text
$sel:referenceActionName:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> Text
referenceActionName} -> Text
referenceActionName) (\s :: FollowModeScheduleActionStartSettings
s@FollowModeScheduleActionStartSettings' {} Text
a -> FollowModeScheduleActionStartSettings
s {$sel:referenceActionName:FollowModeScheduleActionStartSettings' :: Text
referenceActionName = Text
a} :: FollowModeScheduleActionStartSettings)

-- | Identifies whether this action starts relative to the start or relative
-- to the end of the reference action.
followModeScheduleActionStartSettings_followPoint :: Lens.Lens' FollowModeScheduleActionStartSettings FollowPoint
followModeScheduleActionStartSettings_followPoint :: (FollowPoint -> f FollowPoint)
-> FollowModeScheduleActionStartSettings
-> f FollowModeScheduleActionStartSettings
followModeScheduleActionStartSettings_followPoint = (FollowModeScheduleActionStartSettings -> FollowPoint)
-> (FollowModeScheduleActionStartSettings
    -> FollowPoint -> FollowModeScheduleActionStartSettings)
-> Lens
     FollowModeScheduleActionStartSettings
     FollowModeScheduleActionStartSettings
     FollowPoint
     FollowPoint
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FollowModeScheduleActionStartSettings' {FollowPoint
followPoint :: FollowPoint
$sel:followPoint:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> FollowPoint
followPoint} -> FollowPoint
followPoint) (\s :: FollowModeScheduleActionStartSettings
s@FollowModeScheduleActionStartSettings' {} FollowPoint
a -> FollowModeScheduleActionStartSettings
s {$sel:followPoint:FollowModeScheduleActionStartSettings' :: FollowPoint
followPoint = FollowPoint
a} :: FollowModeScheduleActionStartSettings)

instance
  Core.FromJSON
    FollowModeScheduleActionStartSettings
  where
  parseJSON :: Value -> Parser FollowModeScheduleActionStartSettings
parseJSON =
    String
-> (Object -> Parser FollowModeScheduleActionStartSettings)
-> Value
-> Parser FollowModeScheduleActionStartSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FollowModeScheduleActionStartSettings"
      ( \Object
x ->
          Text -> FollowPoint -> FollowModeScheduleActionStartSettings
FollowModeScheduleActionStartSettings'
            (Text -> FollowPoint -> FollowModeScheduleActionStartSettings)
-> Parser Text
-> Parser (FollowPoint -> FollowModeScheduleActionStartSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"referenceActionName")
            Parser (FollowPoint -> FollowModeScheduleActionStartSettings)
-> Parser FollowPoint
-> Parser FollowModeScheduleActionStartSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FollowPoint
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"followPoint")
      )

instance
  Prelude.Hashable
    FollowModeScheduleActionStartSettings

instance
  Prelude.NFData
    FollowModeScheduleActionStartSettings

instance
  Core.ToJSON
    FollowModeScheduleActionStartSettings
  where
  toJSON :: FollowModeScheduleActionStartSettings -> Value
toJSON FollowModeScheduleActionStartSettings' {Text
FollowPoint
followPoint :: FollowPoint
referenceActionName :: Text
$sel:followPoint:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> FollowPoint
$sel:referenceActionName:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> Text
..} =
    [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
"referenceActionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
referenceActionName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"followPoint" Text -> FollowPoint -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FollowPoint
followPoint)
          ]
      )