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

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

-- | Detailed information about an activity type.
--
-- /See:/ 'newActivityTypeInfo' smart constructor.
data ActivityTypeInfo = ActivityTypeInfo'
  { -- | If DEPRECATED, the date and time DeprecateActivityType was called.
    ActivityTypeInfo -> Maybe POSIX
deprecationDate :: Prelude.Maybe Core.POSIX,
    -- | The description of the activity type provided in RegisterActivityType.
    ActivityTypeInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ActivityType type structure representing the activity type.
    ActivityTypeInfo -> ActivityType
activityType :: ActivityType,
    -- | The current status of the activity type.
    ActivityTypeInfo -> RegistrationStatus
status :: RegistrationStatus,
    -- | The date and time this activity type was created through
    -- RegisterActivityType.
    ActivityTypeInfo -> POSIX
creationDate :: Core.POSIX
  }
  deriving (ActivityTypeInfo -> ActivityTypeInfo -> Bool
(ActivityTypeInfo -> ActivityTypeInfo -> Bool)
-> (ActivityTypeInfo -> ActivityTypeInfo -> Bool)
-> Eq ActivityTypeInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivityTypeInfo -> ActivityTypeInfo -> Bool
$c/= :: ActivityTypeInfo -> ActivityTypeInfo -> Bool
== :: ActivityTypeInfo -> ActivityTypeInfo -> Bool
$c== :: ActivityTypeInfo -> ActivityTypeInfo -> Bool
Prelude.Eq, ReadPrec [ActivityTypeInfo]
ReadPrec ActivityTypeInfo
Int -> ReadS ActivityTypeInfo
ReadS [ActivityTypeInfo]
(Int -> ReadS ActivityTypeInfo)
-> ReadS [ActivityTypeInfo]
-> ReadPrec ActivityTypeInfo
-> ReadPrec [ActivityTypeInfo]
-> Read ActivityTypeInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivityTypeInfo]
$creadListPrec :: ReadPrec [ActivityTypeInfo]
readPrec :: ReadPrec ActivityTypeInfo
$creadPrec :: ReadPrec ActivityTypeInfo
readList :: ReadS [ActivityTypeInfo]
$creadList :: ReadS [ActivityTypeInfo]
readsPrec :: Int -> ReadS ActivityTypeInfo
$creadsPrec :: Int -> ReadS ActivityTypeInfo
Prelude.Read, Int -> ActivityTypeInfo -> ShowS
[ActivityTypeInfo] -> ShowS
ActivityTypeInfo -> String
(Int -> ActivityTypeInfo -> ShowS)
-> (ActivityTypeInfo -> String)
-> ([ActivityTypeInfo] -> ShowS)
-> Show ActivityTypeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivityTypeInfo] -> ShowS
$cshowList :: [ActivityTypeInfo] -> ShowS
show :: ActivityTypeInfo -> String
$cshow :: ActivityTypeInfo -> String
showsPrec :: Int -> ActivityTypeInfo -> ShowS
$cshowsPrec :: Int -> ActivityTypeInfo -> ShowS
Prelude.Show, (forall x. ActivityTypeInfo -> Rep ActivityTypeInfo x)
-> (forall x. Rep ActivityTypeInfo x -> ActivityTypeInfo)
-> Generic ActivityTypeInfo
forall x. Rep ActivityTypeInfo x -> ActivityTypeInfo
forall x. ActivityTypeInfo -> Rep ActivityTypeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActivityTypeInfo x -> ActivityTypeInfo
$cfrom :: forall x. ActivityTypeInfo -> Rep ActivityTypeInfo x
Prelude.Generic)

-- |
-- Create a value of 'ActivityTypeInfo' 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', 'activityTypeInfo_deprecationDate' - If DEPRECATED, the date and time DeprecateActivityType was called.
--
-- 'description', 'activityTypeInfo_description' - The description of the activity type provided in RegisterActivityType.
--
-- 'activityType', 'activityTypeInfo_activityType' - The ActivityType type structure representing the activity type.
--
-- 'status', 'activityTypeInfo_status' - The current status of the activity type.
--
-- 'creationDate', 'activityTypeInfo_creationDate' - The date and time this activity type was created through
-- RegisterActivityType.
newActivityTypeInfo ::
  -- | 'activityType'
  ActivityType ->
  -- | 'status'
  RegistrationStatus ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  ActivityTypeInfo
newActivityTypeInfo :: ActivityType -> RegistrationStatus -> UTCTime -> ActivityTypeInfo
newActivityTypeInfo
  ActivityType
pActivityType_
  RegistrationStatus
pStatus_
  UTCTime
pCreationDate_ =
    ActivityTypeInfo' :: Maybe POSIX
-> Maybe Text
-> ActivityType
-> RegistrationStatus
-> POSIX
-> ActivityTypeInfo
ActivityTypeInfo'
      { $sel:deprecationDate:ActivityTypeInfo' :: Maybe POSIX
deprecationDate =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:description:ActivityTypeInfo' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:activityType:ActivityTypeInfo' :: ActivityType
activityType = ActivityType
pActivityType_,
        $sel:status:ActivityTypeInfo' :: RegistrationStatus
status = RegistrationStatus
pStatus_,
        $sel:creationDate:ActivityTypeInfo' :: 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 DEPRECATED, the date and time DeprecateActivityType was called.
activityTypeInfo_deprecationDate :: Lens.Lens' ActivityTypeInfo (Prelude.Maybe Prelude.UTCTime)
activityTypeInfo_deprecationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ActivityTypeInfo -> f ActivityTypeInfo
activityTypeInfo_deprecationDate = (ActivityTypeInfo -> Maybe POSIX)
-> (ActivityTypeInfo -> Maybe POSIX -> ActivityTypeInfo)
-> Lens
     ActivityTypeInfo ActivityTypeInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTypeInfo' {Maybe POSIX
deprecationDate :: Maybe POSIX
$sel:deprecationDate:ActivityTypeInfo' :: ActivityTypeInfo -> Maybe POSIX
deprecationDate} -> Maybe POSIX
deprecationDate) (\s :: ActivityTypeInfo
s@ActivityTypeInfo' {} Maybe POSIX
a -> ActivityTypeInfo
s {$sel:deprecationDate:ActivityTypeInfo' :: Maybe POSIX
deprecationDate = Maybe POSIX
a} :: ActivityTypeInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> ActivityTypeInfo -> f ActivityTypeInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ActivityTypeInfo
-> f ActivityTypeInfo
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 activity type provided in RegisterActivityType.
activityTypeInfo_description :: Lens.Lens' ActivityTypeInfo (Prelude.Maybe Prelude.Text)
activityTypeInfo_description :: (Maybe Text -> f (Maybe Text))
-> ActivityTypeInfo -> f ActivityTypeInfo
activityTypeInfo_description = (ActivityTypeInfo -> Maybe Text)
-> (ActivityTypeInfo -> Maybe Text -> ActivityTypeInfo)
-> Lens ActivityTypeInfo ActivityTypeInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTypeInfo' {Maybe Text
description :: Maybe Text
$sel:description:ActivityTypeInfo' :: ActivityTypeInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: ActivityTypeInfo
s@ActivityTypeInfo' {} Maybe Text
a -> ActivityTypeInfo
s {$sel:description:ActivityTypeInfo' :: Maybe Text
description = Maybe Text
a} :: ActivityTypeInfo)

-- | The ActivityType type structure representing the activity type.
activityTypeInfo_activityType :: Lens.Lens' ActivityTypeInfo ActivityType
activityTypeInfo_activityType :: (ActivityType -> f ActivityType)
-> ActivityTypeInfo -> f ActivityTypeInfo
activityTypeInfo_activityType = (ActivityTypeInfo -> ActivityType)
-> (ActivityTypeInfo -> ActivityType -> ActivityTypeInfo)
-> Lens ActivityTypeInfo ActivityTypeInfo ActivityType ActivityType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTypeInfo' {ActivityType
activityType :: ActivityType
$sel:activityType:ActivityTypeInfo' :: ActivityTypeInfo -> ActivityType
activityType} -> ActivityType
activityType) (\s :: ActivityTypeInfo
s@ActivityTypeInfo' {} ActivityType
a -> ActivityTypeInfo
s {$sel:activityType:ActivityTypeInfo' :: ActivityType
activityType = ActivityType
a} :: ActivityTypeInfo)

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

-- | The date and time this activity type was created through
-- RegisterActivityType.
activityTypeInfo_creationDate :: Lens.Lens' ActivityTypeInfo Prelude.UTCTime
activityTypeInfo_creationDate :: (UTCTime -> f UTCTime) -> ActivityTypeInfo -> f ActivityTypeInfo
activityTypeInfo_creationDate = (ActivityTypeInfo -> POSIX)
-> (ActivityTypeInfo -> POSIX -> ActivityTypeInfo)
-> Lens ActivityTypeInfo ActivityTypeInfo POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTypeInfo' {POSIX
creationDate :: POSIX
$sel:creationDate:ActivityTypeInfo' :: ActivityTypeInfo -> POSIX
creationDate} -> POSIX
creationDate) (\s :: ActivityTypeInfo
s@ActivityTypeInfo' {} POSIX
a -> ActivityTypeInfo
s {$sel:creationDate:ActivityTypeInfo' :: POSIX
creationDate = POSIX
a} :: ActivityTypeInfo) ((POSIX -> f POSIX) -> ActivityTypeInfo -> f ActivityTypeInfo)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ActivityTypeInfo
-> f ActivityTypeInfo
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 ActivityTypeInfo where
  parseJSON :: Value -> Parser ActivityTypeInfo
parseJSON =
    String
-> (Object -> Parser ActivityTypeInfo)
-> Value
-> Parser ActivityTypeInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActivityTypeInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> ActivityType
-> RegistrationStatus
-> POSIX
-> ActivityTypeInfo
ActivityTypeInfo'
            (Maybe POSIX
 -> Maybe Text
 -> ActivityType
 -> RegistrationStatus
 -> POSIX
 -> ActivityTypeInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> ActivityType -> RegistrationStatus -> POSIX -> ActivityTypeInfo)
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
   -> ActivityType -> RegistrationStatus -> POSIX -> ActivityTypeInfo)
-> Parser (Maybe Text)
-> Parser
     (ActivityType -> RegistrationStatus -> POSIX -> ActivityTypeInfo)
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
  (ActivityType -> RegistrationStatus -> POSIX -> ActivityTypeInfo)
-> Parser ActivityType
-> Parser (RegistrationStatus -> POSIX -> ActivityTypeInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActivityType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"activityType")
            Parser (RegistrationStatus -> POSIX -> ActivityTypeInfo)
-> Parser RegistrationStatus -> Parser (POSIX -> ActivityTypeInfo)
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 -> ActivityTypeInfo)
-> Parser POSIX -> Parser ActivityTypeInfo
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 ActivityTypeInfo

instance Prelude.NFData ActivityTypeInfo