{-# 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.MigrationHubOrchestrator.Types.WorkflowStepOutput
-- 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.MigrationHubOrchestrator.Types.WorkflowStepOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubOrchestrator.Types.DataType
import Amazonka.MigrationHubOrchestrator.Types.WorkflowStepOutputUnion
import qualified Amazonka.Prelude as Prelude

-- | The output of a step.
--
-- /See:/ 'newWorkflowStepOutput' smart constructor.
data WorkflowStepOutput = WorkflowStepOutput'
  { -- | The data type of the output.
    WorkflowStepOutput -> Maybe DataType
dataType :: Prelude.Maybe DataType,
    -- | The name of the step.
    WorkflowStepOutput -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Determine if an output is required from a step.
    WorkflowStepOutput -> Maybe Bool
required :: Prelude.Maybe Prelude.Bool,
    -- | The value of the output.
    WorkflowStepOutput -> Maybe WorkflowStepOutputUnion
value :: Prelude.Maybe WorkflowStepOutputUnion
  }
  deriving (WorkflowStepOutput -> WorkflowStepOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowStepOutput -> WorkflowStepOutput -> Bool
$c/= :: WorkflowStepOutput -> WorkflowStepOutput -> Bool
== :: WorkflowStepOutput -> WorkflowStepOutput -> Bool
$c== :: WorkflowStepOutput -> WorkflowStepOutput -> Bool
Prelude.Eq, ReadPrec [WorkflowStepOutput]
ReadPrec WorkflowStepOutput
Int -> ReadS WorkflowStepOutput
ReadS [WorkflowStepOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowStepOutput]
$creadListPrec :: ReadPrec [WorkflowStepOutput]
readPrec :: ReadPrec WorkflowStepOutput
$creadPrec :: ReadPrec WorkflowStepOutput
readList :: ReadS [WorkflowStepOutput]
$creadList :: ReadS [WorkflowStepOutput]
readsPrec :: Int -> ReadS WorkflowStepOutput
$creadsPrec :: Int -> ReadS WorkflowStepOutput
Prelude.Read, Int -> WorkflowStepOutput -> ShowS
[WorkflowStepOutput] -> ShowS
WorkflowStepOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowStepOutput] -> ShowS
$cshowList :: [WorkflowStepOutput] -> ShowS
show :: WorkflowStepOutput -> String
$cshow :: WorkflowStepOutput -> String
showsPrec :: Int -> WorkflowStepOutput -> ShowS
$cshowsPrec :: Int -> WorkflowStepOutput -> ShowS
Prelude.Show, forall x. Rep WorkflowStepOutput x -> WorkflowStepOutput
forall x. WorkflowStepOutput -> Rep WorkflowStepOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowStepOutput x -> WorkflowStepOutput
$cfrom :: forall x. WorkflowStepOutput -> Rep WorkflowStepOutput x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowStepOutput' 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:
--
-- 'dataType', 'workflowStepOutput_dataType' - The data type of the output.
--
-- 'name', 'workflowStepOutput_name' - The name of the step.
--
-- 'required', 'workflowStepOutput_required' - Determine if an output is required from a step.
--
-- 'value', 'workflowStepOutput_value' - The value of the output.
newWorkflowStepOutput ::
  WorkflowStepOutput
newWorkflowStepOutput :: WorkflowStepOutput
newWorkflowStepOutput =
  WorkflowStepOutput'
    { $sel:dataType:WorkflowStepOutput' :: Maybe DataType
dataType = forall a. Maybe a
Prelude.Nothing,
      $sel:name:WorkflowStepOutput' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:required:WorkflowStepOutput' :: Maybe Bool
required = forall a. Maybe a
Prelude.Nothing,
      $sel:value:WorkflowStepOutput' :: Maybe WorkflowStepOutputUnion
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The data type of the output.
workflowStepOutput_dataType :: Lens.Lens' WorkflowStepOutput (Prelude.Maybe DataType)
workflowStepOutput_dataType :: Lens' WorkflowStepOutput (Maybe DataType)
workflowStepOutput_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutput' {Maybe DataType
dataType :: Maybe DataType
$sel:dataType:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe DataType
dataType} -> Maybe DataType
dataType) (\s :: WorkflowStepOutput
s@WorkflowStepOutput' {} Maybe DataType
a -> WorkflowStepOutput
s {$sel:dataType:WorkflowStepOutput' :: Maybe DataType
dataType = Maybe DataType
a} :: WorkflowStepOutput)

-- | The name of the step.
workflowStepOutput_name :: Lens.Lens' WorkflowStepOutput (Prelude.Maybe Prelude.Text)
workflowStepOutput_name :: Lens' WorkflowStepOutput (Maybe Text)
workflowStepOutput_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutput' {Maybe Text
name :: Maybe Text
$sel:name:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Text
name} -> Maybe Text
name) (\s :: WorkflowStepOutput
s@WorkflowStepOutput' {} Maybe Text
a -> WorkflowStepOutput
s {$sel:name:WorkflowStepOutput' :: Maybe Text
name = Maybe Text
a} :: WorkflowStepOutput)

-- | Determine if an output is required from a step.
workflowStepOutput_required :: Lens.Lens' WorkflowStepOutput (Prelude.Maybe Prelude.Bool)
workflowStepOutput_required :: Lens' WorkflowStepOutput (Maybe Bool)
workflowStepOutput_required = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutput' {Maybe Bool
required :: Maybe Bool
$sel:required:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Bool
required} -> Maybe Bool
required) (\s :: WorkflowStepOutput
s@WorkflowStepOutput' {} Maybe Bool
a -> WorkflowStepOutput
s {$sel:required:WorkflowStepOutput' :: Maybe Bool
required = Maybe Bool
a} :: WorkflowStepOutput)

-- | The value of the output.
workflowStepOutput_value :: Lens.Lens' WorkflowStepOutput (Prelude.Maybe WorkflowStepOutputUnion)
workflowStepOutput_value :: Lens' WorkflowStepOutput (Maybe WorkflowStepOutputUnion)
workflowStepOutput_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutput' {Maybe WorkflowStepOutputUnion
value :: Maybe WorkflowStepOutputUnion
$sel:value:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe WorkflowStepOutputUnion
value} -> Maybe WorkflowStepOutputUnion
value) (\s :: WorkflowStepOutput
s@WorkflowStepOutput' {} Maybe WorkflowStepOutputUnion
a -> WorkflowStepOutput
s {$sel:value:WorkflowStepOutput' :: Maybe WorkflowStepOutputUnion
value = Maybe WorkflowStepOutputUnion
a} :: WorkflowStepOutput)

instance Data.FromJSON WorkflowStepOutput where
  parseJSON :: Value -> Parser WorkflowStepOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowStepOutput"
      ( \Object
x ->
          Maybe DataType
-> Maybe Text
-> Maybe Bool
-> Maybe WorkflowStepOutputUnion
-> WorkflowStepOutput
WorkflowStepOutput'
            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
"dataType")
            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
"name")
            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
"required")
            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
"value")
      )

instance Prelude.Hashable WorkflowStepOutput where
  hashWithSalt :: Int -> WorkflowStepOutput -> Int
hashWithSalt Int
_salt WorkflowStepOutput' {Maybe Bool
Maybe Text
Maybe DataType
Maybe WorkflowStepOutputUnion
value :: Maybe WorkflowStepOutputUnion
required :: Maybe Bool
name :: Maybe Text
dataType :: Maybe DataType
$sel:value:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe WorkflowStepOutputUnion
$sel:required:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Bool
$sel:name:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Text
$sel:dataType:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe DataType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataType
dataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
required
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WorkflowStepOutputUnion
value

instance Prelude.NFData WorkflowStepOutput where
  rnf :: WorkflowStepOutput -> ()
rnf WorkflowStepOutput' {Maybe Bool
Maybe Text
Maybe DataType
Maybe WorkflowStepOutputUnion
value :: Maybe WorkflowStepOutputUnion
required :: Maybe Bool
name :: Maybe Text
dataType :: Maybe DataType
$sel:value:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe WorkflowStepOutputUnion
$sel:required:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Bool
$sel:name:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Text
$sel:dataType:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe DataType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DataType
dataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
required
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe WorkflowStepOutputUnion
value

instance Data.ToJSON WorkflowStepOutput where
  toJSON :: WorkflowStepOutput -> Value
toJSON WorkflowStepOutput' {Maybe Bool
Maybe Text
Maybe DataType
Maybe WorkflowStepOutputUnion
value :: Maybe WorkflowStepOutputUnion
required :: Maybe Bool
name :: Maybe Text
dataType :: Maybe DataType
$sel:value:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe WorkflowStepOutputUnion
$sel:required:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Bool
$sel:name:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe Text
$sel:dataType:WorkflowStepOutput' :: WorkflowStepOutput -> Maybe DataType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"dataType" 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 DataType
dataType,
            (Key
"name" 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 Text
name,
            (Key
"required" 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 Bool
required,
            (Key
"value" 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 WorkflowStepOutputUnion
value
          ]
      )