{-# 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.Pipes.Types.PipeTargetStateMachineParameters
-- 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.Pipes.Types.PipeTargetStateMachineParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pipes.Types.PipeTargetInvocationType
import qualified Amazonka.Prelude as Prelude

-- | The parameters for using a Step Functions state machine as a target.
--
-- /See:/ 'newPipeTargetStateMachineParameters' smart constructor.
data PipeTargetStateMachineParameters = PipeTargetStateMachineParameters'
  { -- | Specify whether to wait for the state machine to finish or not.
    PipeTargetStateMachineParameters -> Maybe PipeTargetInvocationType
invocationType :: Prelude.Maybe PipeTargetInvocationType
  }
  deriving (PipeTargetStateMachineParameters
-> PipeTargetStateMachineParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipeTargetStateMachineParameters
-> PipeTargetStateMachineParameters -> Bool
$c/= :: PipeTargetStateMachineParameters
-> PipeTargetStateMachineParameters -> Bool
== :: PipeTargetStateMachineParameters
-> PipeTargetStateMachineParameters -> Bool
$c== :: PipeTargetStateMachineParameters
-> PipeTargetStateMachineParameters -> Bool
Prelude.Eq, ReadPrec [PipeTargetStateMachineParameters]
ReadPrec PipeTargetStateMachineParameters
Int -> ReadS PipeTargetStateMachineParameters
ReadS [PipeTargetStateMachineParameters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipeTargetStateMachineParameters]
$creadListPrec :: ReadPrec [PipeTargetStateMachineParameters]
readPrec :: ReadPrec PipeTargetStateMachineParameters
$creadPrec :: ReadPrec PipeTargetStateMachineParameters
readList :: ReadS [PipeTargetStateMachineParameters]
$creadList :: ReadS [PipeTargetStateMachineParameters]
readsPrec :: Int -> ReadS PipeTargetStateMachineParameters
$creadsPrec :: Int -> ReadS PipeTargetStateMachineParameters
Prelude.Read, Int -> PipeTargetStateMachineParameters -> ShowS
[PipeTargetStateMachineParameters] -> ShowS
PipeTargetStateMachineParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipeTargetStateMachineParameters] -> ShowS
$cshowList :: [PipeTargetStateMachineParameters] -> ShowS
show :: PipeTargetStateMachineParameters -> String
$cshow :: PipeTargetStateMachineParameters -> String
showsPrec :: Int -> PipeTargetStateMachineParameters -> ShowS
$cshowsPrec :: Int -> PipeTargetStateMachineParameters -> ShowS
Prelude.Show, forall x.
Rep PipeTargetStateMachineParameters x
-> PipeTargetStateMachineParameters
forall x.
PipeTargetStateMachineParameters
-> Rep PipeTargetStateMachineParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PipeTargetStateMachineParameters x
-> PipeTargetStateMachineParameters
$cfrom :: forall x.
PipeTargetStateMachineParameters
-> Rep PipeTargetStateMachineParameters x
Prelude.Generic)

-- |
-- Create a value of 'PipeTargetStateMachineParameters' 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:
--
-- 'invocationType', 'pipeTargetStateMachineParameters_invocationType' - Specify whether to wait for the state machine to finish or not.
newPipeTargetStateMachineParameters ::
  PipeTargetStateMachineParameters
newPipeTargetStateMachineParameters :: PipeTargetStateMachineParameters
newPipeTargetStateMachineParameters =
  PipeTargetStateMachineParameters'
    { $sel:invocationType:PipeTargetStateMachineParameters' :: Maybe PipeTargetInvocationType
invocationType =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Specify whether to wait for the state machine to finish or not.
pipeTargetStateMachineParameters_invocationType :: Lens.Lens' PipeTargetStateMachineParameters (Prelude.Maybe PipeTargetInvocationType)
pipeTargetStateMachineParameters_invocationType :: Lens'
  PipeTargetStateMachineParameters (Maybe PipeTargetInvocationType)
pipeTargetStateMachineParameters_invocationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipeTargetStateMachineParameters' {Maybe PipeTargetInvocationType
invocationType :: Maybe PipeTargetInvocationType
$sel:invocationType:PipeTargetStateMachineParameters' :: PipeTargetStateMachineParameters -> Maybe PipeTargetInvocationType
invocationType} -> Maybe PipeTargetInvocationType
invocationType) (\s :: PipeTargetStateMachineParameters
s@PipeTargetStateMachineParameters' {} Maybe PipeTargetInvocationType
a -> PipeTargetStateMachineParameters
s {$sel:invocationType:PipeTargetStateMachineParameters' :: Maybe PipeTargetInvocationType
invocationType = Maybe PipeTargetInvocationType
a} :: PipeTargetStateMachineParameters)

instance
  Data.FromJSON
    PipeTargetStateMachineParameters
  where
  parseJSON :: Value -> Parser PipeTargetStateMachineParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PipeTargetStateMachineParameters"
      ( \Object
x ->
          Maybe PipeTargetInvocationType -> PipeTargetStateMachineParameters
PipeTargetStateMachineParameters'
            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
"InvocationType")
      )

instance
  Prelude.Hashable
    PipeTargetStateMachineParameters
  where
  hashWithSalt :: Int -> PipeTargetStateMachineParameters -> Int
hashWithSalt
    Int
_salt
    PipeTargetStateMachineParameters' {Maybe PipeTargetInvocationType
invocationType :: Maybe PipeTargetInvocationType
$sel:invocationType:PipeTargetStateMachineParameters' :: PipeTargetStateMachineParameters -> Maybe PipeTargetInvocationType
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PipeTargetInvocationType
invocationType

instance
  Prelude.NFData
    PipeTargetStateMachineParameters
  where
  rnf :: PipeTargetStateMachineParameters -> ()
rnf PipeTargetStateMachineParameters' {Maybe PipeTargetInvocationType
invocationType :: Maybe PipeTargetInvocationType
$sel:invocationType:PipeTargetStateMachineParameters' :: PipeTargetStateMachineParameters -> Maybe PipeTargetInvocationType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PipeTargetInvocationType
invocationType

instance Data.ToJSON PipeTargetStateMachineParameters where
  toJSON :: PipeTargetStateMachineParameters -> Value
toJSON PipeTargetStateMachineParameters' {Maybe PipeTargetInvocationType
invocationType :: Maybe PipeTargetInvocationType
$sel:invocationType:PipeTargetStateMachineParameters' :: PipeTargetStateMachineParameters -> Maybe PipeTargetInvocationType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"InvocationType" 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 PipeTargetInvocationType
invocationType
          ]
      )