{-# 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 #-}
module Amazonka.LexModels.Types.FulfillmentActivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.CodeHook
import Amazonka.LexModels.Types.FulfillmentActivityType
import qualified Amazonka.Prelude as Prelude
data FulfillmentActivity = FulfillmentActivity'
{
FulfillmentActivity -> Maybe CodeHook
codeHook :: Prelude.Maybe CodeHook,
FulfillmentActivity -> FulfillmentActivityType
type' :: FulfillmentActivityType
}
deriving (FulfillmentActivity -> FulfillmentActivity -> Bool
(FulfillmentActivity -> FulfillmentActivity -> Bool)
-> (FulfillmentActivity -> FulfillmentActivity -> Bool)
-> Eq FulfillmentActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FulfillmentActivity -> FulfillmentActivity -> Bool
$c/= :: FulfillmentActivity -> FulfillmentActivity -> Bool
== :: FulfillmentActivity -> FulfillmentActivity -> Bool
$c== :: FulfillmentActivity -> FulfillmentActivity -> Bool
Prelude.Eq, ReadPrec [FulfillmentActivity]
ReadPrec FulfillmentActivity
Int -> ReadS FulfillmentActivity
ReadS [FulfillmentActivity]
(Int -> ReadS FulfillmentActivity)
-> ReadS [FulfillmentActivity]
-> ReadPrec FulfillmentActivity
-> ReadPrec [FulfillmentActivity]
-> Read FulfillmentActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FulfillmentActivity]
$creadListPrec :: ReadPrec [FulfillmentActivity]
readPrec :: ReadPrec FulfillmentActivity
$creadPrec :: ReadPrec FulfillmentActivity
readList :: ReadS [FulfillmentActivity]
$creadList :: ReadS [FulfillmentActivity]
readsPrec :: Int -> ReadS FulfillmentActivity
$creadsPrec :: Int -> ReadS FulfillmentActivity
Prelude.Read, Int -> FulfillmentActivity -> ShowS
[FulfillmentActivity] -> ShowS
FulfillmentActivity -> String
(Int -> FulfillmentActivity -> ShowS)
-> (FulfillmentActivity -> String)
-> ([FulfillmentActivity] -> ShowS)
-> Show FulfillmentActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FulfillmentActivity] -> ShowS
$cshowList :: [FulfillmentActivity] -> ShowS
show :: FulfillmentActivity -> String
$cshow :: FulfillmentActivity -> String
showsPrec :: Int -> FulfillmentActivity -> ShowS
$cshowsPrec :: Int -> FulfillmentActivity -> ShowS
Prelude.Show, (forall x. FulfillmentActivity -> Rep FulfillmentActivity x)
-> (forall x. Rep FulfillmentActivity x -> FulfillmentActivity)
-> Generic FulfillmentActivity
forall x. Rep FulfillmentActivity x -> FulfillmentActivity
forall x. FulfillmentActivity -> Rep FulfillmentActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FulfillmentActivity x -> FulfillmentActivity
$cfrom :: forall x. FulfillmentActivity -> Rep FulfillmentActivity x
Prelude.Generic)
newFulfillmentActivity ::
FulfillmentActivityType ->
FulfillmentActivity
newFulfillmentActivity :: FulfillmentActivityType -> FulfillmentActivity
newFulfillmentActivity FulfillmentActivityType
pType_ =
FulfillmentActivity' :: Maybe CodeHook -> FulfillmentActivityType -> FulfillmentActivity
FulfillmentActivity'
{ $sel:codeHook:FulfillmentActivity' :: Maybe CodeHook
codeHook = Maybe CodeHook
forall a. Maybe a
Prelude.Nothing,
$sel:type':FulfillmentActivity' :: FulfillmentActivityType
type' = FulfillmentActivityType
pType_
}
fulfillmentActivity_codeHook :: Lens.Lens' FulfillmentActivity (Prelude.Maybe CodeHook)
fulfillmentActivity_codeHook :: (Maybe CodeHook -> f (Maybe CodeHook))
-> FulfillmentActivity -> f FulfillmentActivity
fulfillmentActivity_codeHook = (FulfillmentActivity -> Maybe CodeHook)
-> (FulfillmentActivity -> Maybe CodeHook -> FulfillmentActivity)
-> Lens
FulfillmentActivity
FulfillmentActivity
(Maybe CodeHook)
(Maybe CodeHook)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FulfillmentActivity' {Maybe CodeHook
codeHook :: Maybe CodeHook
$sel:codeHook:FulfillmentActivity' :: FulfillmentActivity -> Maybe CodeHook
codeHook} -> Maybe CodeHook
codeHook) (\s :: FulfillmentActivity
s@FulfillmentActivity' {} Maybe CodeHook
a -> FulfillmentActivity
s {$sel:codeHook:FulfillmentActivity' :: Maybe CodeHook
codeHook = Maybe CodeHook
a} :: FulfillmentActivity)
fulfillmentActivity_type :: Lens.Lens' FulfillmentActivity FulfillmentActivityType
fulfillmentActivity_type :: (FulfillmentActivityType -> f FulfillmentActivityType)
-> FulfillmentActivity -> f FulfillmentActivity
fulfillmentActivity_type = (FulfillmentActivity -> FulfillmentActivityType)
-> (FulfillmentActivity
-> FulfillmentActivityType -> FulfillmentActivity)
-> Lens
FulfillmentActivity
FulfillmentActivity
FulfillmentActivityType
FulfillmentActivityType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FulfillmentActivity' {FulfillmentActivityType
type' :: FulfillmentActivityType
$sel:type':FulfillmentActivity' :: FulfillmentActivity -> FulfillmentActivityType
type'} -> FulfillmentActivityType
type') (\s :: FulfillmentActivity
s@FulfillmentActivity' {} FulfillmentActivityType
a -> FulfillmentActivity
s {$sel:type':FulfillmentActivity' :: FulfillmentActivityType
type' = FulfillmentActivityType
a} :: FulfillmentActivity)
instance Core.FromJSON FulfillmentActivity where
parseJSON :: Value -> Parser FulfillmentActivity
parseJSON =
String
-> (Object -> Parser FulfillmentActivity)
-> Value
-> Parser FulfillmentActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FulfillmentActivity"
( \Object
x ->
Maybe CodeHook -> FulfillmentActivityType -> FulfillmentActivity
FulfillmentActivity'
(Maybe CodeHook -> FulfillmentActivityType -> FulfillmentActivity)
-> Parser (Maybe CodeHook)
-> Parser (FulfillmentActivityType -> FulfillmentActivity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CodeHook)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"codeHook")
Parser (FulfillmentActivityType -> FulfillmentActivity)
-> Parser FulfillmentActivityType -> Parser FulfillmentActivity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FulfillmentActivityType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable FulfillmentActivity
instance Prelude.NFData FulfillmentActivity
instance Core.ToJSON FulfillmentActivity where
toJSON :: FulfillmentActivity -> Value
toJSON FulfillmentActivity' {Maybe CodeHook
FulfillmentActivityType
type' :: FulfillmentActivityType
codeHook :: Maybe CodeHook
$sel:type':FulfillmentActivity' :: FulfillmentActivity -> FulfillmentActivityType
$sel:codeHook:FulfillmentActivity' :: FulfillmentActivity -> Maybe CodeHook
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"codeHook" Text -> CodeHook -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CodeHook -> Pair) -> Maybe CodeHook -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeHook
codeHook,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> FulfillmentActivityType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FulfillmentActivityType
type')
]
)