{-# 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.Connect.Types.TaskTemplateMetadata
-- 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.Connect.Types.TaskTemplateMetadata where

import Amazonka.Connect.Types.TaskTemplateStatus
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

-- | Contains summary information about the task template.
--
-- /See:/ 'newTaskTemplateMetadata' smart constructor.
data TaskTemplateMetadata = TaskTemplateMetadata'
  { -- | The Amazon Resource Name (ARN) of the task template.
    TaskTemplateMetadata -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the task template was created.
    TaskTemplateMetadata -> Maybe POSIX
createdTime :: Prelude.Maybe Data.POSIX,
    -- | The description of the task template.
    TaskTemplateMetadata -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the task template.
    TaskTemplateMetadata -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the task template was last modified.
    TaskTemplateMetadata -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the task template.
    TaskTemplateMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Marks a template as @ACTIVE@ or @INACTIVE@ for a task to refer to it.
    -- Tasks can only be created from @ACTIVE@ templates. If a template is
    -- marked as @INACTIVE@, then a task that refers to this template cannot be
    -- created.
    TaskTemplateMetadata -> Maybe TaskTemplateStatus
status :: Prelude.Maybe TaskTemplateStatus
  }
  deriving (TaskTemplateMetadata -> TaskTemplateMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskTemplateMetadata -> TaskTemplateMetadata -> Bool
$c/= :: TaskTemplateMetadata -> TaskTemplateMetadata -> Bool
== :: TaskTemplateMetadata -> TaskTemplateMetadata -> Bool
$c== :: TaskTemplateMetadata -> TaskTemplateMetadata -> Bool
Prelude.Eq, ReadPrec [TaskTemplateMetadata]
ReadPrec TaskTemplateMetadata
Int -> ReadS TaskTemplateMetadata
ReadS [TaskTemplateMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskTemplateMetadata]
$creadListPrec :: ReadPrec [TaskTemplateMetadata]
readPrec :: ReadPrec TaskTemplateMetadata
$creadPrec :: ReadPrec TaskTemplateMetadata
readList :: ReadS [TaskTemplateMetadata]
$creadList :: ReadS [TaskTemplateMetadata]
readsPrec :: Int -> ReadS TaskTemplateMetadata
$creadsPrec :: Int -> ReadS TaskTemplateMetadata
Prelude.Read, Int -> TaskTemplateMetadata -> ShowS
[TaskTemplateMetadata] -> ShowS
TaskTemplateMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskTemplateMetadata] -> ShowS
$cshowList :: [TaskTemplateMetadata] -> ShowS
show :: TaskTemplateMetadata -> String
$cshow :: TaskTemplateMetadata -> String
showsPrec :: Int -> TaskTemplateMetadata -> ShowS
$cshowsPrec :: Int -> TaskTemplateMetadata -> ShowS
Prelude.Show, forall x. Rep TaskTemplateMetadata x -> TaskTemplateMetadata
forall x. TaskTemplateMetadata -> Rep TaskTemplateMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaskTemplateMetadata x -> TaskTemplateMetadata
$cfrom :: forall x. TaskTemplateMetadata -> Rep TaskTemplateMetadata x
Prelude.Generic)

-- |
-- Create a value of 'TaskTemplateMetadata' 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:
--
-- 'arn', 'taskTemplateMetadata_arn' - The Amazon Resource Name (ARN) of the task template.
--
-- 'createdTime', 'taskTemplateMetadata_createdTime' - The timestamp when the task template was created.
--
-- 'description', 'taskTemplateMetadata_description' - The description of the task template.
--
-- 'id', 'taskTemplateMetadata_id' - A unique identifier for the task template.
--
-- 'lastModifiedTime', 'taskTemplateMetadata_lastModifiedTime' - The timestamp when the task template was last modified.
--
-- 'name', 'taskTemplateMetadata_name' - The name of the task template.
--
-- 'status', 'taskTemplateMetadata_status' - Marks a template as @ACTIVE@ or @INACTIVE@ for a task to refer to it.
-- Tasks can only be created from @ACTIVE@ templates. If a template is
-- marked as @INACTIVE@, then a task that refers to this template cannot be
-- created.
newTaskTemplateMetadata ::
  TaskTemplateMetadata
newTaskTemplateMetadata :: TaskTemplateMetadata
newTaskTemplateMetadata =
  TaskTemplateMetadata'
    { $sel:arn:TaskTemplateMetadata' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:TaskTemplateMetadata' :: Maybe POSIX
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:description:TaskTemplateMetadata' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:TaskTemplateMetadata' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:TaskTemplateMetadata' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:TaskTemplateMetadata' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:TaskTemplateMetadata' :: Maybe TaskTemplateStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the task template.
taskTemplateMetadata_arn :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe Prelude.Text)
taskTemplateMetadata_arn :: Lens' TaskTemplateMetadata (Maybe Text)
taskTemplateMetadata_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe Text
arn :: Maybe Text
$sel:arn:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
arn} -> Maybe Text
arn) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe Text
a -> TaskTemplateMetadata
s {$sel:arn:TaskTemplateMetadata' :: Maybe Text
arn = Maybe Text
a} :: TaskTemplateMetadata)

-- | The timestamp when the task template was created.
taskTemplateMetadata_createdTime :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe Prelude.UTCTime)
taskTemplateMetadata_createdTime :: Lens' TaskTemplateMetadata (Maybe UTCTime)
taskTemplateMetadata_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe POSIX
a -> TaskTemplateMetadata
s {$sel:createdTime:TaskTemplateMetadata' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: TaskTemplateMetadata) 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 task template.
taskTemplateMetadata_description :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe Prelude.Text)
taskTemplateMetadata_description :: Lens' TaskTemplateMetadata (Maybe Text)
taskTemplateMetadata_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe Text
description :: Maybe Text
$sel:description:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
description} -> Maybe Text
description) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe Text
a -> TaskTemplateMetadata
s {$sel:description:TaskTemplateMetadata' :: Maybe Text
description = Maybe Text
a} :: TaskTemplateMetadata)

-- | A unique identifier for the task template.
taskTemplateMetadata_id :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe Prelude.Text)
taskTemplateMetadata_id :: Lens' TaskTemplateMetadata (Maybe Text)
taskTemplateMetadata_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe Text
id :: Maybe Text
$sel:id:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
id} -> Maybe Text
id) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe Text
a -> TaskTemplateMetadata
s {$sel:id:TaskTemplateMetadata' :: Maybe Text
id = Maybe Text
a} :: TaskTemplateMetadata)

-- | The timestamp when the task template was last modified.
taskTemplateMetadata_lastModifiedTime :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe Prelude.UTCTime)
taskTemplateMetadata_lastModifiedTime :: Lens' TaskTemplateMetadata (Maybe UTCTime)
taskTemplateMetadata_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe POSIX
a -> TaskTemplateMetadata
s {$sel:lastModifiedTime:TaskTemplateMetadata' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: TaskTemplateMetadata) 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 name of the task template.
taskTemplateMetadata_name :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe Prelude.Text)
taskTemplateMetadata_name :: Lens' TaskTemplateMetadata (Maybe Text)
taskTemplateMetadata_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe Text
name :: Maybe Text
$sel:name:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
name} -> Maybe Text
name) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe Text
a -> TaskTemplateMetadata
s {$sel:name:TaskTemplateMetadata' :: Maybe Text
name = Maybe Text
a} :: TaskTemplateMetadata)

-- | Marks a template as @ACTIVE@ or @INACTIVE@ for a task to refer to it.
-- Tasks can only be created from @ACTIVE@ templates. If a template is
-- marked as @INACTIVE@, then a task that refers to this template cannot be
-- created.
taskTemplateMetadata_status :: Lens.Lens' TaskTemplateMetadata (Prelude.Maybe TaskTemplateStatus)
taskTemplateMetadata_status :: Lens' TaskTemplateMetadata (Maybe TaskTemplateStatus)
taskTemplateMetadata_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskTemplateMetadata' {Maybe TaskTemplateStatus
status :: Maybe TaskTemplateStatus
$sel:status:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe TaskTemplateStatus
status} -> Maybe TaskTemplateStatus
status) (\s :: TaskTemplateMetadata
s@TaskTemplateMetadata' {} Maybe TaskTemplateStatus
a -> TaskTemplateMetadata
s {$sel:status:TaskTemplateMetadata' :: Maybe TaskTemplateStatus
status = Maybe TaskTemplateStatus
a} :: TaskTemplateMetadata)

instance Data.FromJSON TaskTemplateMetadata where
  parseJSON :: Value -> Parser TaskTemplateMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TaskTemplateMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe TaskTemplateStatus
-> TaskTemplateMetadata
TaskTemplateMetadata'
            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
"Arn")
            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
"CreatedTime")
            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 (Maybe a)
Data..:? Key
"Id")
            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
"LastModifiedTime")
            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
"Name")
            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
"Status")
      )

instance Prelude.Hashable TaskTemplateMetadata where
  hashWithSalt :: Int -> TaskTemplateMetadata -> Int
hashWithSalt Int
_salt TaskTemplateMetadata' {Maybe Text
Maybe POSIX
Maybe TaskTemplateStatus
status :: Maybe TaskTemplateStatus
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
id :: Maybe Text
description :: Maybe Text
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:status:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe TaskTemplateStatus
$sel:name:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
$sel:lastModifiedTime:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe POSIX
$sel:id:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
$sel:description:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
$sel:createdTime:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe POSIX
$sel:arn:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaskTemplateStatus
status

instance Prelude.NFData TaskTemplateMetadata where
  rnf :: TaskTemplateMetadata -> ()
rnf TaskTemplateMetadata' {Maybe Text
Maybe POSIX
Maybe TaskTemplateStatus
status :: Maybe TaskTemplateStatus
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
id :: Maybe Text
description :: Maybe Text
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:status:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe TaskTemplateStatus
$sel:name:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
$sel:lastModifiedTime:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe POSIX
$sel:id:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
$sel:description:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
$sel:createdTime:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe POSIX
$sel:arn:TaskTemplateMetadata' :: TaskTemplateMetadata -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTime
      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 Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskTemplateStatus
status