{-# 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-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.FollowModeScheduleActionStartSettings 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.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
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]
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
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.
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'
      { $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 :: Lens' FollowModeScheduleActionStartSettings Text
followModeScheduleActionStartSettings_referenceActionName = 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 :: Lens' FollowModeScheduleActionStartSettings FollowPoint
followModeScheduleActionStartSettings_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
  Data.FromJSON
    FollowModeScheduleActionStartSettings
  where
  parseJSON :: Value -> Parser FollowModeScheduleActionStartSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FollowModeScheduleActionStartSettings"
      ( \Object
x ->
          Text -> FollowPoint -> FollowModeScheduleActionStartSettings
FollowModeScheduleActionStartSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"referenceActionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"followPoint")
      )

instance
  Prelude.Hashable
    FollowModeScheduleActionStartSettings
  where
  hashWithSalt :: Int -> FollowModeScheduleActionStartSettings -> Int
hashWithSalt
    Int
_salt
    FollowModeScheduleActionStartSettings' {Text
FollowPoint
followPoint :: FollowPoint
referenceActionName :: Text
$sel:followPoint:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> FollowPoint
$sel:referenceActionName:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
referenceActionName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FollowPoint
followPoint

instance
  Prelude.NFData
    FollowModeScheduleActionStartSettings
  where
  rnf :: FollowModeScheduleActionStartSettings -> ()
rnf FollowModeScheduleActionStartSettings' {Text
FollowPoint
followPoint :: FollowPoint
referenceActionName :: Text
$sel:followPoint:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> FollowPoint
$sel:referenceActionName:FollowModeScheduleActionStartSettings' :: FollowModeScheduleActionStartSettings -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
referenceActionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FollowPoint
followPoint

instance
  Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"referenceActionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
referenceActionName),
            forall a. a -> Maybe a
Prelude.Just (Key
"followPoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FollowPoint
followPoint)
          ]
      )