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

-- | 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
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]
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
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. 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' {$sel:name:TaskList' :: Text
name = Text
pName_}

-- | The name of the task list.
taskList_name :: Lens.Lens' TaskList Prelude.Text
taskList_name :: Lens' TaskList Text
taskList_name = 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 Data.FromJSON TaskList where
  parseJSON :: Value -> Parser TaskList
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TaskList"
      (\Object
x -> Text -> TaskList
TaskList' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name"))

instance Prelude.Hashable TaskList where
  hashWithSalt :: Int -> TaskList -> Int
hashWithSalt Int
_salt TaskList' {Text
name :: Text
$sel:name:TaskList' :: TaskList -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData TaskList where
  rnf :: TaskList -> ()
rnf TaskList' {Text
name :: Text
$sel:name:TaskList' :: TaskList -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

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