{-# 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.IoTThingsGraph.Types.FlowTemplateDescription
-- 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.IoTThingsGraph.Types.FlowTemplateDescription where

import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.Types.DefinitionDocument
import Amazonka.IoTThingsGraph.Types.FlowTemplateSummary
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that contains a workflow\'s definition and summary
-- information.
--
-- /See:/ 'newFlowTemplateDescription' smart constructor.
data FlowTemplateDescription = FlowTemplateDescription'
  { -- | An object that contains summary information about a workflow.
    FlowTemplateDescription -> Maybe FlowTemplateSummary
summary :: Prelude.Maybe FlowTemplateSummary,
    -- | A workflow\'s definition document.
    FlowTemplateDescription -> Maybe DefinitionDocument
definition :: Prelude.Maybe DefinitionDocument,
    -- | The version of the user\'s namespace against which the workflow was
    -- validated. Use this value in your system instance.
    FlowTemplateDescription -> Maybe Integer
validatedNamespaceVersion :: Prelude.Maybe Prelude.Integer
  }
  deriving (FlowTemplateDescription -> FlowTemplateDescription -> Bool
(FlowTemplateDescription -> FlowTemplateDescription -> Bool)
-> (FlowTemplateDescription -> FlowTemplateDescription -> Bool)
-> Eq FlowTemplateDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlowTemplateDescription -> FlowTemplateDescription -> Bool
$c/= :: FlowTemplateDescription -> FlowTemplateDescription -> Bool
== :: FlowTemplateDescription -> FlowTemplateDescription -> Bool
$c== :: FlowTemplateDescription -> FlowTemplateDescription -> Bool
Prelude.Eq, ReadPrec [FlowTemplateDescription]
ReadPrec FlowTemplateDescription
Int -> ReadS FlowTemplateDescription
ReadS [FlowTemplateDescription]
(Int -> ReadS FlowTemplateDescription)
-> ReadS [FlowTemplateDescription]
-> ReadPrec FlowTemplateDescription
-> ReadPrec [FlowTemplateDescription]
-> Read FlowTemplateDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlowTemplateDescription]
$creadListPrec :: ReadPrec [FlowTemplateDescription]
readPrec :: ReadPrec FlowTemplateDescription
$creadPrec :: ReadPrec FlowTemplateDescription
readList :: ReadS [FlowTemplateDescription]
$creadList :: ReadS [FlowTemplateDescription]
readsPrec :: Int -> ReadS FlowTemplateDescription
$creadsPrec :: Int -> ReadS FlowTemplateDescription
Prelude.Read, Int -> FlowTemplateDescription -> ShowS
[FlowTemplateDescription] -> ShowS
FlowTemplateDescription -> String
(Int -> FlowTemplateDescription -> ShowS)
-> (FlowTemplateDescription -> String)
-> ([FlowTemplateDescription] -> ShowS)
-> Show FlowTemplateDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlowTemplateDescription] -> ShowS
$cshowList :: [FlowTemplateDescription] -> ShowS
show :: FlowTemplateDescription -> String
$cshow :: FlowTemplateDescription -> String
showsPrec :: Int -> FlowTemplateDescription -> ShowS
$cshowsPrec :: Int -> FlowTemplateDescription -> ShowS
Prelude.Show, (forall x.
 FlowTemplateDescription -> Rep FlowTemplateDescription x)
-> (forall x.
    Rep FlowTemplateDescription x -> FlowTemplateDescription)
-> Generic FlowTemplateDescription
forall x. Rep FlowTemplateDescription x -> FlowTemplateDescription
forall x. FlowTemplateDescription -> Rep FlowTemplateDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FlowTemplateDescription x -> FlowTemplateDescription
$cfrom :: forall x. FlowTemplateDescription -> Rep FlowTemplateDescription x
Prelude.Generic)

-- |
-- Create a value of 'FlowTemplateDescription' 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:
--
-- 'summary', 'flowTemplateDescription_summary' - An object that contains summary information about a workflow.
--
-- 'definition', 'flowTemplateDescription_definition' - A workflow\'s definition document.
--
-- 'validatedNamespaceVersion', 'flowTemplateDescription_validatedNamespaceVersion' - The version of the user\'s namespace against which the workflow was
-- validated. Use this value in your system instance.
newFlowTemplateDescription ::
  FlowTemplateDescription
newFlowTemplateDescription :: FlowTemplateDescription
newFlowTemplateDescription =
  FlowTemplateDescription' :: Maybe FlowTemplateSummary
-> Maybe DefinitionDocument
-> Maybe Integer
-> FlowTemplateDescription
FlowTemplateDescription'
    { $sel:summary:FlowTemplateDescription' :: Maybe FlowTemplateSummary
summary = Maybe FlowTemplateSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:definition:FlowTemplateDescription' :: Maybe DefinitionDocument
definition = Maybe DefinitionDocument
forall a. Maybe a
Prelude.Nothing,
      $sel:validatedNamespaceVersion:FlowTemplateDescription' :: Maybe Integer
validatedNamespaceVersion = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | An object that contains summary information about a workflow.
flowTemplateDescription_summary :: Lens.Lens' FlowTemplateDescription (Prelude.Maybe FlowTemplateSummary)
flowTemplateDescription_summary :: (Maybe FlowTemplateSummary -> f (Maybe FlowTemplateSummary))
-> FlowTemplateDescription -> f FlowTemplateDescription
flowTemplateDescription_summary = (FlowTemplateDescription -> Maybe FlowTemplateSummary)
-> (FlowTemplateDescription
    -> Maybe FlowTemplateSummary -> FlowTemplateDescription)
-> Lens
     FlowTemplateDescription
     FlowTemplateDescription
     (Maybe FlowTemplateSummary)
     (Maybe FlowTemplateSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowTemplateDescription' {Maybe FlowTemplateSummary
summary :: Maybe FlowTemplateSummary
$sel:summary:FlowTemplateDescription' :: FlowTemplateDescription -> Maybe FlowTemplateSummary
summary} -> Maybe FlowTemplateSummary
summary) (\s :: FlowTemplateDescription
s@FlowTemplateDescription' {} Maybe FlowTemplateSummary
a -> FlowTemplateDescription
s {$sel:summary:FlowTemplateDescription' :: Maybe FlowTemplateSummary
summary = Maybe FlowTemplateSummary
a} :: FlowTemplateDescription)

-- | A workflow\'s definition document.
flowTemplateDescription_definition :: Lens.Lens' FlowTemplateDescription (Prelude.Maybe DefinitionDocument)
flowTemplateDescription_definition :: (Maybe DefinitionDocument -> f (Maybe DefinitionDocument))
-> FlowTemplateDescription -> f FlowTemplateDescription
flowTemplateDescription_definition = (FlowTemplateDescription -> Maybe DefinitionDocument)
-> (FlowTemplateDescription
    -> Maybe DefinitionDocument -> FlowTemplateDescription)
-> Lens
     FlowTemplateDescription
     FlowTemplateDescription
     (Maybe DefinitionDocument)
     (Maybe DefinitionDocument)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowTemplateDescription' {Maybe DefinitionDocument
definition :: Maybe DefinitionDocument
$sel:definition:FlowTemplateDescription' :: FlowTemplateDescription -> Maybe DefinitionDocument
definition} -> Maybe DefinitionDocument
definition) (\s :: FlowTemplateDescription
s@FlowTemplateDescription' {} Maybe DefinitionDocument
a -> FlowTemplateDescription
s {$sel:definition:FlowTemplateDescription' :: Maybe DefinitionDocument
definition = Maybe DefinitionDocument
a} :: FlowTemplateDescription)

-- | The version of the user\'s namespace against which the workflow was
-- validated. Use this value in your system instance.
flowTemplateDescription_validatedNamespaceVersion :: Lens.Lens' FlowTemplateDescription (Prelude.Maybe Prelude.Integer)
flowTemplateDescription_validatedNamespaceVersion :: (Maybe Integer -> f (Maybe Integer))
-> FlowTemplateDescription -> f FlowTemplateDescription
flowTemplateDescription_validatedNamespaceVersion = (FlowTemplateDescription -> Maybe Integer)
-> (FlowTemplateDescription
    -> Maybe Integer -> FlowTemplateDescription)
-> Lens
     FlowTemplateDescription
     FlowTemplateDescription
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowTemplateDescription' {Maybe Integer
validatedNamespaceVersion :: Maybe Integer
$sel:validatedNamespaceVersion:FlowTemplateDescription' :: FlowTemplateDescription -> Maybe Integer
validatedNamespaceVersion} -> Maybe Integer
validatedNamespaceVersion) (\s :: FlowTemplateDescription
s@FlowTemplateDescription' {} Maybe Integer
a -> FlowTemplateDescription
s {$sel:validatedNamespaceVersion:FlowTemplateDescription' :: Maybe Integer
validatedNamespaceVersion = Maybe Integer
a} :: FlowTemplateDescription)

instance Core.FromJSON FlowTemplateDescription where
  parseJSON :: Value -> Parser FlowTemplateDescription
parseJSON =
    String
-> (Object -> Parser FlowTemplateDescription)
-> Value
-> Parser FlowTemplateDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FlowTemplateDescription"
      ( \Object
x ->
          Maybe FlowTemplateSummary
-> Maybe DefinitionDocument
-> Maybe Integer
-> FlowTemplateDescription
FlowTemplateDescription'
            (Maybe FlowTemplateSummary
 -> Maybe DefinitionDocument
 -> Maybe Integer
 -> FlowTemplateDescription)
-> Parser (Maybe FlowTemplateSummary)
-> Parser
     (Maybe DefinitionDocument
      -> Maybe Integer -> FlowTemplateDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FlowTemplateSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"summary")
            Parser
  (Maybe DefinitionDocument
   -> Maybe Integer -> FlowTemplateDescription)
-> Parser (Maybe DefinitionDocument)
-> Parser (Maybe Integer -> FlowTemplateDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DefinitionDocument)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"definition")
            Parser (Maybe Integer -> FlowTemplateDescription)
-> Parser (Maybe Integer) -> Parser FlowTemplateDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"validatedNamespaceVersion")
      )

instance Prelude.Hashable FlowTemplateDescription

instance Prelude.NFData FlowTemplateDescription