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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a task list.
--
-- /See:/ 'newTaskList' smart constructor.
data TaskList = TaskList'
  { -- | The name of the task list.
    TaskList -> Text
name :: Prelude.Text
  }
  deriving (TaskList -> TaskList -> Bool
(TaskList -> TaskList -> Bool)
-> (TaskList -> TaskList -> Bool) -> Eq TaskList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskList -> TaskList -> Bool
$c/= :: TaskList -> TaskList -> Bool
== :: TaskList -> TaskList -> Bool
$c== :: TaskList -> TaskList -> Bool
Prelude.Eq, ReadPrec [TaskList]
ReadPrec TaskList
Int -> ReadS TaskList
ReadS [TaskList]
(Int -> ReadS TaskList)
-> ReadS [TaskList]
-> ReadPrec TaskList
-> ReadPrec [TaskList]
-> Read TaskList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskList]
$creadListPrec :: ReadPrec [TaskList]
readPrec :: ReadPrec TaskList
$creadPrec :: ReadPrec TaskList
readList :: ReadS [TaskList]
$creadList :: ReadS [TaskList]
readsPrec :: Int -> ReadS TaskList
$creadsPrec :: Int -> ReadS TaskList
Prelude.Read, Int -> TaskList -> ShowS
[TaskList] -> ShowS
TaskList -> String
(Int -> TaskList -> ShowS)
-> (TaskList -> String) -> ([TaskList] -> ShowS) -> Show TaskList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskList] -> ShowS
$cshowList :: [TaskList] -> ShowS
show :: TaskList -> String
$cshow :: TaskList -> String
showsPrec :: Int -> TaskList -> ShowS
$cshowsPrec :: Int -> TaskList -> ShowS
Prelude.Show, (forall x. TaskList -> Rep TaskList x)
-> (forall x. Rep TaskList x -> TaskList) -> Generic TaskList
forall x. Rep TaskList x -> TaskList
forall x. TaskList -> Rep TaskList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaskList x -> TaskList
$cfrom :: forall x. TaskList -> Rep TaskList x
Prelude.Generic)

-- |
-- Create a value of 'TaskList' 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:
--
-- 'name', 'taskList_name' - The name of the task list.
newTaskList ::
  -- | 'name'
  Prelude.Text ->
  TaskList
newTaskList :: Text -> TaskList
newTaskList Text
pName_ = TaskList' :: Text -> TaskList
TaskList' {$sel:name:TaskList' :: Text
name = Text
pName_}

-- | The name of the task list.
taskList_name :: Lens.Lens' TaskList Prelude.Text
taskList_name :: (Text -> f Text) -> TaskList -> f TaskList
taskList_name = (TaskList -> Text)
-> (TaskList -> Text -> TaskList)
-> Lens TaskList TaskList Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskList' {Text
name :: Text
$sel:name:TaskList' :: TaskList -> Text
name} -> Text
name) (\s :: TaskList
s@TaskList' {} Text
a -> TaskList
s {$sel:name:TaskList' :: Text
name = Text
a} :: TaskList)

instance Core.FromJSON TaskList where
  parseJSON :: Value -> Parser TaskList
parseJSON =
    String -> (Object -> Parser TaskList) -> Value -> Parser TaskList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskList"
      (\Object
x -> Text -> TaskList
TaskList' (Text -> TaskList) -> Parser Text -> Parser TaskList
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name"))

instance Prelude.Hashable TaskList

instance Prelude.NFData TaskList

instance Core.ToJSON TaskList where
  toJSON :: TaskList -> Value
toJSON TaskList' {Text
name :: Text
$sel:name:TaskList' :: TaskList -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )