{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SWF.Types.WorkflowTypeInfo 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
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 Data.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 :: Data.POSIX
  }
  deriving (WorkflowTypeInfo -> WorkflowTypeInfo -> Bool
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]
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
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. 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'
      { $sel:deprecationDate:WorkflowTypeInfo' :: Maybe POSIX
deprecationDate =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:WorkflowTypeInfo' :: Maybe Text
description = 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 = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time 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 :: Lens' WorkflowTypeInfo (Maybe UTCTime)
workflowTypeInfo_deprecationDate = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the type registered through RegisterWorkflowType.
workflowTypeInfo_description :: Lens.Lens' WorkflowTypeInfo (Prelude.Maybe Prelude.Text)
workflowTypeInfo_description :: Lens' WorkflowTypeInfo (Maybe Text)
workflowTypeInfo_description = 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 :: Lens' WorkflowTypeInfo WorkflowType
workflowTypeInfo_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 :: Lens' WorkflowTypeInfo RegistrationStatus
workflowTypeInfo_status = 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 :: Lens' WorkflowTypeInfo UTCTime
workflowTypeInfo_creationDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON WorkflowTypeInfo where
  parseJSON :: Value -> Parser WorkflowTypeInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowTypeInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> WorkflowType
-> RegistrationStatus
-> POSIX
-> WorkflowTypeInfo
WorkflowTypeInfo'
            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
"deprecationDate")
            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
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"workflowType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"creationDate")
      )

instance Prelude.Hashable WorkflowTypeInfo where
  hashWithSalt :: Int -> WorkflowTypeInfo -> Int
hashWithSalt Int
_salt WorkflowTypeInfo' {Maybe Text
Maybe POSIX
POSIX
RegistrationStatus
WorkflowType
creationDate :: POSIX
status :: RegistrationStatus
workflowType :: WorkflowType
description :: Maybe Text
deprecationDate :: Maybe POSIX
$sel:creationDate:WorkflowTypeInfo' :: WorkflowTypeInfo -> POSIX
$sel:status:WorkflowTypeInfo' :: WorkflowTypeInfo -> RegistrationStatus
$sel:workflowType:WorkflowTypeInfo' :: WorkflowTypeInfo -> WorkflowType
$sel:description:WorkflowTypeInfo' :: WorkflowTypeInfo -> Maybe Text
$sel:deprecationDate:WorkflowTypeInfo' :: WorkflowTypeInfo -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
deprecationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowType
workflowType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RegistrationStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationDate

instance Prelude.NFData WorkflowTypeInfo where
  rnf :: WorkflowTypeInfo -> ()
rnf WorkflowTypeInfo' {Maybe Text
Maybe POSIX
POSIX
RegistrationStatus
WorkflowType
creationDate :: POSIX
status :: RegistrationStatus
workflowType :: WorkflowType
description :: Maybe Text
deprecationDate :: Maybe POSIX
$sel:creationDate:WorkflowTypeInfo' :: WorkflowTypeInfo -> POSIX
$sel:status:WorkflowTypeInfo' :: WorkflowTypeInfo -> RegistrationStatus
$sel:workflowType:WorkflowTypeInfo' :: WorkflowTypeInfo -> WorkflowType
$sel:description:WorkflowTypeInfo' :: WorkflowTypeInfo -> Maybe Text
$sel:deprecationDate:WorkflowTypeInfo' :: WorkflowTypeInfo -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
deprecationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WorkflowType
workflowType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RegistrationStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationDate