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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A structure to hold multiple values of an output.
--
-- /See:/ 'newWorkflowStepOutputUnion' smart constructor.
data WorkflowStepOutputUnion = WorkflowStepOutputUnion'
  { -- | The integer value.
    WorkflowStepOutputUnion -> Maybe Int
integerValue :: Prelude.Maybe Prelude.Int,
    -- | The list of string value.
    WorkflowStepOutputUnion -> Maybe [Text]
listOfStringValue :: Prelude.Maybe [Prelude.Text],
    -- | The string value.
    WorkflowStepOutputUnion -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text
  }
  deriving (WorkflowStepOutputUnion -> WorkflowStepOutputUnion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowStepOutputUnion -> WorkflowStepOutputUnion -> Bool
$c/= :: WorkflowStepOutputUnion -> WorkflowStepOutputUnion -> Bool
== :: WorkflowStepOutputUnion -> WorkflowStepOutputUnion -> Bool
$c== :: WorkflowStepOutputUnion -> WorkflowStepOutputUnion -> Bool
Prelude.Eq, ReadPrec [WorkflowStepOutputUnion]
ReadPrec WorkflowStepOutputUnion
Int -> ReadS WorkflowStepOutputUnion
ReadS [WorkflowStepOutputUnion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowStepOutputUnion]
$creadListPrec :: ReadPrec [WorkflowStepOutputUnion]
readPrec :: ReadPrec WorkflowStepOutputUnion
$creadPrec :: ReadPrec WorkflowStepOutputUnion
readList :: ReadS [WorkflowStepOutputUnion]
$creadList :: ReadS [WorkflowStepOutputUnion]
readsPrec :: Int -> ReadS WorkflowStepOutputUnion
$creadsPrec :: Int -> ReadS WorkflowStepOutputUnion
Prelude.Read, Int -> WorkflowStepOutputUnion -> ShowS
[WorkflowStepOutputUnion] -> ShowS
WorkflowStepOutputUnion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowStepOutputUnion] -> ShowS
$cshowList :: [WorkflowStepOutputUnion] -> ShowS
show :: WorkflowStepOutputUnion -> String
$cshow :: WorkflowStepOutputUnion -> String
showsPrec :: Int -> WorkflowStepOutputUnion -> ShowS
$cshowsPrec :: Int -> WorkflowStepOutputUnion -> ShowS
Prelude.Show, forall x. Rep WorkflowStepOutputUnion x -> WorkflowStepOutputUnion
forall x. WorkflowStepOutputUnion -> Rep WorkflowStepOutputUnion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowStepOutputUnion x -> WorkflowStepOutputUnion
$cfrom :: forall x. WorkflowStepOutputUnion -> Rep WorkflowStepOutputUnion x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowStepOutputUnion' 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:
--
-- 'integerValue', 'workflowStepOutputUnion_integerValue' - The integer value.
--
-- 'listOfStringValue', 'workflowStepOutputUnion_listOfStringValue' - The list of string value.
--
-- 'stringValue', 'workflowStepOutputUnion_stringValue' - The string value.
newWorkflowStepOutputUnion ::
  WorkflowStepOutputUnion
newWorkflowStepOutputUnion :: WorkflowStepOutputUnion
newWorkflowStepOutputUnion =
  WorkflowStepOutputUnion'
    { $sel:integerValue:WorkflowStepOutputUnion' :: Maybe Int
integerValue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:listOfStringValue:WorkflowStepOutputUnion' :: Maybe [Text]
listOfStringValue = forall a. Maybe a
Prelude.Nothing,
      $sel:stringValue:WorkflowStepOutputUnion' :: Maybe Text
stringValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The integer value.
workflowStepOutputUnion_integerValue :: Lens.Lens' WorkflowStepOutputUnion (Prelude.Maybe Prelude.Int)
workflowStepOutputUnion_integerValue :: Lens' WorkflowStepOutputUnion (Maybe Int)
workflowStepOutputUnion_integerValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutputUnion' {Maybe Int
integerValue :: Maybe Int
$sel:integerValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Int
integerValue} -> Maybe Int
integerValue) (\s :: WorkflowStepOutputUnion
s@WorkflowStepOutputUnion' {} Maybe Int
a -> WorkflowStepOutputUnion
s {$sel:integerValue:WorkflowStepOutputUnion' :: Maybe Int
integerValue = Maybe Int
a} :: WorkflowStepOutputUnion)

-- | The list of string value.
workflowStepOutputUnion_listOfStringValue :: Lens.Lens' WorkflowStepOutputUnion (Prelude.Maybe [Prelude.Text])
workflowStepOutputUnion_listOfStringValue :: Lens' WorkflowStepOutputUnion (Maybe [Text])
workflowStepOutputUnion_listOfStringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutputUnion' {Maybe [Text]
listOfStringValue :: Maybe [Text]
$sel:listOfStringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe [Text]
listOfStringValue} -> Maybe [Text]
listOfStringValue) (\s :: WorkflowStepOutputUnion
s@WorkflowStepOutputUnion' {} Maybe [Text]
a -> WorkflowStepOutputUnion
s {$sel:listOfStringValue:WorkflowStepOutputUnion' :: Maybe [Text]
listOfStringValue = Maybe [Text]
a} :: WorkflowStepOutputUnion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The string value.
workflowStepOutputUnion_stringValue :: Lens.Lens' WorkflowStepOutputUnion (Prelude.Maybe Prelude.Text)
workflowStepOutputUnion_stringValue :: Lens' WorkflowStepOutputUnion (Maybe Text)
workflowStepOutputUnion_stringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepOutputUnion' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: WorkflowStepOutputUnion
s@WorkflowStepOutputUnion' {} Maybe Text
a -> WorkflowStepOutputUnion
s {$sel:stringValue:WorkflowStepOutputUnion' :: Maybe Text
stringValue = Maybe Text
a} :: WorkflowStepOutputUnion)

instance Data.FromJSON WorkflowStepOutputUnion where
  parseJSON :: Value -> Parser WorkflowStepOutputUnion
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowStepOutputUnion"
      ( \Object
x ->
          Maybe Int -> Maybe [Text] -> Maybe Text -> WorkflowStepOutputUnion
WorkflowStepOutputUnion'
            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
"integerValue")
            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
"listOfStringValue"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"stringValue")
      )

instance Prelude.Hashable WorkflowStepOutputUnion where
  hashWithSalt :: Int -> WorkflowStepOutputUnion -> Int
hashWithSalt Int
_salt WorkflowStepOutputUnion' {Maybe Int
Maybe [Text]
Maybe Text
stringValue :: Maybe Text
listOfStringValue :: Maybe [Text]
integerValue :: Maybe Int
$sel:stringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Text
$sel:listOfStringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe [Text]
$sel:integerValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
integerValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
listOfStringValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stringValue

instance Prelude.NFData WorkflowStepOutputUnion where
  rnf :: WorkflowStepOutputUnion -> ()
rnf WorkflowStepOutputUnion' {Maybe Int
Maybe [Text]
Maybe Text
stringValue :: Maybe Text
listOfStringValue :: Maybe [Text]
integerValue :: Maybe Int
$sel:stringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Text
$sel:listOfStringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe [Text]
$sel:integerValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
integerValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
listOfStringValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stringValue

instance Data.ToJSON WorkflowStepOutputUnion where
  toJSON :: WorkflowStepOutputUnion -> Value
toJSON WorkflowStepOutputUnion' {Maybe Int
Maybe [Text]
Maybe Text
stringValue :: Maybe Text
listOfStringValue :: Maybe [Text]
integerValue :: Maybe Int
$sel:stringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Text
$sel:listOfStringValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe [Text]
$sel:integerValue:WorkflowStepOutputUnion' :: WorkflowStepOutputUnion -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"integerValue" 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 Int
integerValue,
            (Key
"listOfStringValue" 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]
listOfStringValue,
            (Key
"stringValue" 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
stringValue
          ]
      )