{-# 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.SWF.Types.WorkflowTypeInfo
-- 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.SWF.Types.WorkflowTypeInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.RegistrationStatus
import Amazonka.SWF.Types.WorkflowType

-- | Contains information about a workflow type.
--
-- /See:/ 'newWorkflowTypeInfo' smart constructor.
data WorkflowTypeInfo = WorkflowTypeInfo'
  { -- | If the type is in deprecated state, then it is set to the date when the
    -- type was deprecated.
    WorkflowTypeInfo -> Maybe POSIX
deprecationDate :: Prelude.Maybe Core.POSIX,
    -- | The description of the type registered through RegisterWorkflowType.
    WorkflowTypeInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The workflow type this information is about.
    WorkflowTypeInfo -> WorkflowType
workflowType :: WorkflowType,
    -- | The current status of the workflow type.
    WorkflowTypeInfo -> RegistrationStatus
status :: RegistrationStatus,
    -- | The date when this type was registered.
    WorkflowTypeInfo -> POSIX
creationDate :: Core.POSIX
  }
  deriving (WorkflowTypeInfo -> WorkflowTypeInfo -> Bool
(WorkflowTypeInfo -> WorkflowTypeInfo -> Bool)
-> (WorkflowTypeInfo -> WorkflowTypeInfo -> Bool)
-> Eq WorkflowTypeInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowTypeInfo -> WorkflowTypeInfo -> Bool
$c/= :: WorkflowTypeInfo -> WorkflowTypeInfo -> Bool
== :: WorkflowTypeInfo -> WorkflowTypeInfo -> Bool
$c== :: WorkflowTypeInfo -> WorkflowTypeInfo -> Bool
Prelude.Eq, ReadPrec [WorkflowTypeInfo]
ReadPrec WorkflowTypeInfo
Int -> ReadS WorkflowTypeInfo
ReadS [WorkflowTypeInfo]
(Int -> ReadS WorkflowTypeInfo)
-> ReadS [WorkflowTypeInfo]
-> ReadPrec WorkflowTypeInfo
-> ReadPrec [WorkflowTypeInfo]
-> Read WorkflowTypeInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowTypeInfo]
$creadListPrec :: ReadPrec [WorkflowTypeInfo]
readPrec :: ReadPrec WorkflowTypeInfo
$creadPrec :: ReadPrec WorkflowTypeInfo
readList :: ReadS [WorkflowTypeInfo]
$creadList :: ReadS [WorkflowTypeInfo]
readsPrec :: Int -> ReadS WorkflowTypeInfo
$creadsPrec :: Int -> ReadS WorkflowTypeInfo
Prelude.Read, Int -> WorkflowTypeInfo -> ShowS
[WorkflowTypeInfo] -> ShowS
WorkflowTypeInfo -> String
(Int -> WorkflowTypeInfo -> ShowS)
-> (WorkflowTypeInfo -> String)
-> ([WorkflowTypeInfo] -> ShowS)
-> Show WorkflowTypeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowTypeInfo] -> ShowS
$cshowList :: [WorkflowTypeInfo] -> ShowS
show :: WorkflowTypeInfo -> String
$cshow :: WorkflowTypeInfo -> String
showsPrec :: Int -> WorkflowTypeInfo -> ShowS
$cshowsPrec :: Int -> WorkflowTypeInfo -> ShowS
Prelude.Show, (forall x. WorkflowTypeInfo -> Rep WorkflowTypeInfo x)
-> (forall x. Rep WorkflowTypeInfo x -> WorkflowTypeInfo)
-> Generic WorkflowTypeInfo
forall x. Rep WorkflowTypeInfo x -> WorkflowTypeInfo
forall x. WorkflowTypeInfo -> Rep WorkflowTypeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowTypeInfo x -> WorkflowTypeInfo
$cfrom :: forall x. WorkflowTypeInfo -> Rep WorkflowTypeInfo x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowTypeInfo' 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:
--
-- 'deprecationDate', 'workflowTypeInfo_deprecationDate' - If the type is in deprecated state, then it is set to the date when the
-- type was deprecated.
--
-- 'description', 'workflowTypeInfo_description' - The description of the type registered through RegisterWorkflowType.
--
-- 'workflowType', 'workflowTypeInfo_workflowType' - The workflow type this information is about.
--
-- 'status', 'workflowTypeInfo_status' - The current status of the workflow type.
--
-- 'creationDate', 'workflowTypeInfo_creationDate' - The date when this type was registered.
newWorkflowTypeInfo ::
  -- | 'workflowType'
  WorkflowType ->
  -- | 'status'
  RegistrationStatus ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  WorkflowTypeInfo
newWorkflowTypeInfo :: WorkflowType -> RegistrationStatus -> UTCTime -> WorkflowTypeInfo
newWorkflowTypeInfo
  WorkflowType
pWorkflowType_
  RegistrationStatus
pStatus_
  UTCTime
pCreationDate_ =
    WorkflowTypeInfo' :: Maybe POSIX
-> Maybe Text
-> WorkflowType
-> RegistrationStatus
-> POSIX
-> WorkflowTypeInfo
WorkflowTypeInfo'
      { $sel:deprecationDate:WorkflowTypeInfo' :: Maybe POSIX
deprecationDate =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:description:WorkflowTypeInfo' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:workflowType:WorkflowTypeInfo' :: WorkflowType
workflowType = WorkflowType
pWorkflowType_,
        $sel:status:WorkflowTypeInfo' :: RegistrationStatus
status = RegistrationStatus
pStatus_,
        $sel:creationDate:WorkflowTypeInfo' :: POSIX
creationDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_
      }

-- | If the type is in deprecated state, then it is set to the date when the
-- type was deprecated.
workflowTypeInfo_deprecationDate :: Lens.Lens' WorkflowTypeInfo (Prelude.Maybe Prelude.UTCTime)
workflowTypeInfo_deprecationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> WorkflowTypeInfo -> f WorkflowTypeInfo
workflowTypeInfo_deprecationDate = (WorkflowTypeInfo -> Maybe POSIX)
-> (WorkflowTypeInfo -> Maybe POSIX -> WorkflowTypeInfo)
-> Lens
     WorkflowTypeInfo WorkflowTypeInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowTypeInfo' {Maybe POSIX
deprecationDate :: Maybe POSIX
$sel:deprecationDate:WorkflowTypeInfo' :: WorkflowTypeInfo -> Maybe POSIX
deprecationDate} -> Maybe POSIX
deprecationDate) (\s :: WorkflowTypeInfo
s@WorkflowTypeInfo' {} Maybe POSIX
a -> WorkflowTypeInfo
s {$sel:deprecationDate:WorkflowTypeInfo' :: Maybe POSIX
deprecationDate = Maybe POSIX
a} :: WorkflowTypeInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> WorkflowTypeInfo -> f WorkflowTypeInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> WorkflowTypeInfo
-> f WorkflowTypeInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The description of the type registered through RegisterWorkflowType.
workflowTypeInfo_description :: Lens.Lens' WorkflowTypeInfo (Prelude.Maybe Prelude.Text)
workflowTypeInfo_description :: (Maybe Text -> f (Maybe Text))
-> WorkflowTypeInfo -> f WorkflowTypeInfo
workflowTypeInfo_description = (WorkflowTypeInfo -> Maybe Text)
-> (WorkflowTypeInfo -> Maybe Text -> WorkflowTypeInfo)
-> Lens WorkflowTypeInfo WorkflowTypeInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowTypeInfo' {Maybe Text
description :: Maybe Text
$sel:description:WorkflowTypeInfo' :: WorkflowTypeInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: WorkflowTypeInfo
s@WorkflowTypeInfo' {} Maybe Text
a -> WorkflowTypeInfo
s {$sel:description:WorkflowTypeInfo' :: Maybe Text
description = Maybe Text
a} :: WorkflowTypeInfo)

-- | The workflow type this information is about.
workflowTypeInfo_workflowType :: Lens.Lens' WorkflowTypeInfo WorkflowType
workflowTypeInfo_workflowType :: (WorkflowType -> f WorkflowType)
-> WorkflowTypeInfo -> f WorkflowTypeInfo
workflowTypeInfo_workflowType = (WorkflowTypeInfo -> WorkflowType)
-> (WorkflowTypeInfo -> WorkflowType -> WorkflowTypeInfo)
-> Lens WorkflowTypeInfo WorkflowTypeInfo WorkflowType WorkflowType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowTypeInfo' {WorkflowType
workflowType :: WorkflowType
$sel:workflowType:WorkflowTypeInfo' :: WorkflowTypeInfo -> WorkflowType
workflowType} -> WorkflowType
workflowType) (\s :: WorkflowTypeInfo
s@WorkflowTypeInfo' {} WorkflowType
a -> WorkflowTypeInfo
s {$sel:workflowType:WorkflowTypeInfo' :: WorkflowType
workflowType = WorkflowType
a} :: WorkflowTypeInfo)

-- | The current status of the workflow type.
workflowTypeInfo_status :: Lens.Lens' WorkflowTypeInfo RegistrationStatus
workflowTypeInfo_status :: (RegistrationStatus -> f RegistrationStatus)
-> WorkflowTypeInfo -> f WorkflowTypeInfo
workflowTypeInfo_status = (WorkflowTypeInfo -> RegistrationStatus)
-> (WorkflowTypeInfo -> RegistrationStatus -> WorkflowTypeInfo)
-> Lens
     WorkflowTypeInfo
     WorkflowTypeInfo
     RegistrationStatus
     RegistrationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowTypeInfo' {RegistrationStatus
status :: RegistrationStatus
$sel:status:WorkflowTypeInfo' :: WorkflowTypeInfo -> RegistrationStatus
status} -> RegistrationStatus
status) (\s :: WorkflowTypeInfo
s@WorkflowTypeInfo' {} RegistrationStatus
a -> WorkflowTypeInfo
s {$sel:status:WorkflowTypeInfo' :: RegistrationStatus
status = RegistrationStatus
a} :: WorkflowTypeInfo)

-- | The date when this type was registered.
workflowTypeInfo_creationDate :: Lens.Lens' WorkflowTypeInfo Prelude.UTCTime
workflowTypeInfo_creationDate :: (UTCTime -> f UTCTime) -> WorkflowTypeInfo -> f WorkflowTypeInfo
workflowTypeInfo_creationDate = (WorkflowTypeInfo -> POSIX)
-> (WorkflowTypeInfo -> POSIX -> WorkflowTypeInfo)
-> Lens WorkflowTypeInfo WorkflowTypeInfo POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowTypeInfo' {POSIX
creationDate :: POSIX
$sel:creationDate:WorkflowTypeInfo' :: WorkflowTypeInfo -> POSIX
creationDate} -> POSIX
creationDate) (\s :: WorkflowTypeInfo
s@WorkflowTypeInfo' {} POSIX
a -> WorkflowTypeInfo
s {$sel:creationDate:WorkflowTypeInfo' :: POSIX
creationDate = POSIX
a} :: WorkflowTypeInfo) ((POSIX -> f POSIX) -> WorkflowTypeInfo -> f WorkflowTypeInfo)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> WorkflowTypeInfo
-> f WorkflowTypeInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON WorkflowTypeInfo where
  parseJSON :: Value -> Parser WorkflowTypeInfo
parseJSON =
    String
-> (Object -> Parser WorkflowTypeInfo)
-> Value
-> Parser WorkflowTypeInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowTypeInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> WorkflowType
-> RegistrationStatus
-> POSIX
-> WorkflowTypeInfo
WorkflowTypeInfo'
            (Maybe POSIX
 -> Maybe Text
 -> WorkflowType
 -> RegistrationStatus
 -> POSIX
 -> WorkflowTypeInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> WorkflowType -> RegistrationStatus -> POSIX -> WorkflowTypeInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deprecationDate")
            Parser
  (Maybe Text
   -> WorkflowType -> RegistrationStatus -> POSIX -> WorkflowTypeInfo)
-> Parser (Maybe Text)
-> Parser
     (WorkflowType -> RegistrationStatus -> POSIX -> WorkflowTypeInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser
  (WorkflowType -> RegistrationStatus -> POSIX -> WorkflowTypeInfo)
-> Parser WorkflowType
-> Parser (RegistrationStatus -> POSIX -> WorkflowTypeInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WorkflowType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workflowType")
            Parser (RegistrationStatus -> POSIX -> WorkflowTypeInfo)
-> Parser RegistrationStatus -> Parser (POSIX -> WorkflowTypeInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RegistrationStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (POSIX -> WorkflowTypeInfo)
-> Parser POSIX -> Parser WorkflowTypeInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"creationDate")
      )

instance Prelude.Hashable WorkflowTypeInfo

instance Prelude.NFData WorkflowTypeInfo