{-# 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.Pinpoint.Types.ConditionalSplitActivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.Condition
import Amazonka.Pinpoint.Types.WaitTime
import qualified Amazonka.Prelude as Prelude
data ConditionalSplitActivity = ConditionalSplitActivity'
{
ConditionalSplitActivity -> Maybe WaitTime
evaluationWaitTime :: Prelude.Maybe WaitTime,
ConditionalSplitActivity -> Maybe Text
trueActivity :: Prelude.Maybe Prelude.Text,
ConditionalSplitActivity -> Maybe Text
falseActivity :: Prelude.Maybe Prelude.Text,
ConditionalSplitActivity -> Maybe Condition
condition :: Prelude.Maybe Condition
}
deriving (ConditionalSplitActivity -> ConditionalSplitActivity -> Bool
(ConditionalSplitActivity -> ConditionalSplitActivity -> Bool)
-> (ConditionalSplitActivity -> ConditionalSplitActivity -> Bool)
-> Eq ConditionalSplitActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConditionalSplitActivity -> ConditionalSplitActivity -> Bool
$c/= :: ConditionalSplitActivity -> ConditionalSplitActivity -> Bool
== :: ConditionalSplitActivity -> ConditionalSplitActivity -> Bool
$c== :: ConditionalSplitActivity -> ConditionalSplitActivity -> Bool
Prelude.Eq, ReadPrec [ConditionalSplitActivity]
ReadPrec ConditionalSplitActivity
Int -> ReadS ConditionalSplitActivity
ReadS [ConditionalSplitActivity]
(Int -> ReadS ConditionalSplitActivity)
-> ReadS [ConditionalSplitActivity]
-> ReadPrec ConditionalSplitActivity
-> ReadPrec [ConditionalSplitActivity]
-> Read ConditionalSplitActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConditionalSplitActivity]
$creadListPrec :: ReadPrec [ConditionalSplitActivity]
readPrec :: ReadPrec ConditionalSplitActivity
$creadPrec :: ReadPrec ConditionalSplitActivity
readList :: ReadS [ConditionalSplitActivity]
$creadList :: ReadS [ConditionalSplitActivity]
readsPrec :: Int -> ReadS ConditionalSplitActivity
$creadsPrec :: Int -> ReadS ConditionalSplitActivity
Prelude.Read, Int -> ConditionalSplitActivity -> ShowS
[ConditionalSplitActivity] -> ShowS
ConditionalSplitActivity -> String
(Int -> ConditionalSplitActivity -> ShowS)
-> (ConditionalSplitActivity -> String)
-> ([ConditionalSplitActivity] -> ShowS)
-> Show ConditionalSplitActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConditionalSplitActivity] -> ShowS
$cshowList :: [ConditionalSplitActivity] -> ShowS
show :: ConditionalSplitActivity -> String
$cshow :: ConditionalSplitActivity -> String
showsPrec :: Int -> ConditionalSplitActivity -> ShowS
$cshowsPrec :: Int -> ConditionalSplitActivity -> ShowS
Prelude.Show, (forall x.
ConditionalSplitActivity -> Rep ConditionalSplitActivity x)
-> (forall x.
Rep ConditionalSplitActivity x -> ConditionalSplitActivity)
-> Generic ConditionalSplitActivity
forall x.
Rep ConditionalSplitActivity x -> ConditionalSplitActivity
forall x.
ConditionalSplitActivity -> Rep ConditionalSplitActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConditionalSplitActivity x -> ConditionalSplitActivity
$cfrom :: forall x.
ConditionalSplitActivity -> Rep ConditionalSplitActivity x
Prelude.Generic)
newConditionalSplitActivity ::
ConditionalSplitActivity
newConditionalSplitActivity :: ConditionalSplitActivity
newConditionalSplitActivity =
ConditionalSplitActivity' :: Maybe WaitTime
-> Maybe Text
-> Maybe Text
-> Maybe Condition
-> ConditionalSplitActivity
ConditionalSplitActivity'
{ $sel:evaluationWaitTime:ConditionalSplitActivity' :: Maybe WaitTime
evaluationWaitTime =
Maybe WaitTime
forall a. Maybe a
Prelude.Nothing,
$sel:trueActivity:ConditionalSplitActivity' :: Maybe Text
trueActivity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:falseActivity:ConditionalSplitActivity' :: Maybe Text
falseActivity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:condition:ConditionalSplitActivity' :: Maybe Condition
condition = Maybe Condition
forall a. Maybe a
Prelude.Nothing
}
conditionalSplitActivity_evaluationWaitTime :: Lens.Lens' ConditionalSplitActivity (Prelude.Maybe WaitTime)
conditionalSplitActivity_evaluationWaitTime :: (Maybe WaitTime -> f (Maybe WaitTime))
-> ConditionalSplitActivity -> f ConditionalSplitActivity
conditionalSplitActivity_evaluationWaitTime = (ConditionalSplitActivity -> Maybe WaitTime)
-> (ConditionalSplitActivity
-> Maybe WaitTime -> ConditionalSplitActivity)
-> Lens
ConditionalSplitActivity
ConditionalSplitActivity
(Maybe WaitTime)
(Maybe WaitTime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalSplitActivity' {Maybe WaitTime
evaluationWaitTime :: Maybe WaitTime
$sel:evaluationWaitTime:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe WaitTime
evaluationWaitTime} -> Maybe WaitTime
evaluationWaitTime) (\s :: ConditionalSplitActivity
s@ConditionalSplitActivity' {} Maybe WaitTime
a -> ConditionalSplitActivity
s {$sel:evaluationWaitTime:ConditionalSplitActivity' :: Maybe WaitTime
evaluationWaitTime = Maybe WaitTime
a} :: ConditionalSplitActivity)
conditionalSplitActivity_trueActivity :: Lens.Lens' ConditionalSplitActivity (Prelude.Maybe Prelude.Text)
conditionalSplitActivity_trueActivity :: (Maybe Text -> f (Maybe Text))
-> ConditionalSplitActivity -> f ConditionalSplitActivity
conditionalSplitActivity_trueActivity = (ConditionalSplitActivity -> Maybe Text)
-> (ConditionalSplitActivity
-> Maybe Text -> ConditionalSplitActivity)
-> Lens
ConditionalSplitActivity
ConditionalSplitActivity
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalSplitActivity' {Maybe Text
trueActivity :: Maybe Text
$sel:trueActivity:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe Text
trueActivity} -> Maybe Text
trueActivity) (\s :: ConditionalSplitActivity
s@ConditionalSplitActivity' {} Maybe Text
a -> ConditionalSplitActivity
s {$sel:trueActivity:ConditionalSplitActivity' :: Maybe Text
trueActivity = Maybe Text
a} :: ConditionalSplitActivity)
conditionalSplitActivity_falseActivity :: Lens.Lens' ConditionalSplitActivity (Prelude.Maybe Prelude.Text)
conditionalSplitActivity_falseActivity :: (Maybe Text -> f (Maybe Text))
-> ConditionalSplitActivity -> f ConditionalSplitActivity
conditionalSplitActivity_falseActivity = (ConditionalSplitActivity -> Maybe Text)
-> (ConditionalSplitActivity
-> Maybe Text -> ConditionalSplitActivity)
-> Lens
ConditionalSplitActivity
ConditionalSplitActivity
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalSplitActivity' {Maybe Text
falseActivity :: Maybe Text
$sel:falseActivity:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe Text
falseActivity} -> Maybe Text
falseActivity) (\s :: ConditionalSplitActivity
s@ConditionalSplitActivity' {} Maybe Text
a -> ConditionalSplitActivity
s {$sel:falseActivity:ConditionalSplitActivity' :: Maybe Text
falseActivity = Maybe Text
a} :: ConditionalSplitActivity)
conditionalSplitActivity_condition :: Lens.Lens' ConditionalSplitActivity (Prelude.Maybe Condition)
conditionalSplitActivity_condition :: (Maybe Condition -> f (Maybe Condition))
-> ConditionalSplitActivity -> f ConditionalSplitActivity
conditionalSplitActivity_condition = (ConditionalSplitActivity -> Maybe Condition)
-> (ConditionalSplitActivity
-> Maybe Condition -> ConditionalSplitActivity)
-> Lens
ConditionalSplitActivity
ConditionalSplitActivity
(Maybe Condition)
(Maybe Condition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalSplitActivity' {Maybe Condition
condition :: Maybe Condition
$sel:condition:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe Condition
condition} -> Maybe Condition
condition) (\s :: ConditionalSplitActivity
s@ConditionalSplitActivity' {} Maybe Condition
a -> ConditionalSplitActivity
s {$sel:condition:ConditionalSplitActivity' :: Maybe Condition
condition = Maybe Condition
a} :: ConditionalSplitActivity)
instance Core.FromJSON ConditionalSplitActivity where
parseJSON :: Value -> Parser ConditionalSplitActivity
parseJSON =
String
-> (Object -> Parser ConditionalSplitActivity)
-> Value
-> Parser ConditionalSplitActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConditionalSplitActivity"
( \Object
x ->
Maybe WaitTime
-> Maybe Text
-> Maybe Text
-> Maybe Condition
-> ConditionalSplitActivity
ConditionalSplitActivity'
(Maybe WaitTime
-> Maybe Text
-> Maybe Text
-> Maybe Condition
-> ConditionalSplitActivity)
-> Parser (Maybe WaitTime)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Condition -> ConditionalSplitActivity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe WaitTime)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EvaluationWaitTime")
Parser
(Maybe Text
-> Maybe Text -> Maybe Condition -> ConditionalSplitActivity)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Condition -> ConditionalSplitActivity)
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
"TrueActivity")
Parser (Maybe Text -> Maybe Condition -> ConditionalSplitActivity)
-> Parser (Maybe Text)
-> Parser (Maybe Condition -> ConditionalSplitActivity)
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
"FalseActivity")
Parser (Maybe Condition -> ConditionalSplitActivity)
-> Parser (Maybe Condition) -> Parser ConditionalSplitActivity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Condition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Condition")
)
instance Prelude.Hashable ConditionalSplitActivity
instance Prelude.NFData ConditionalSplitActivity
instance Core.ToJSON ConditionalSplitActivity where
toJSON :: ConditionalSplitActivity -> Value
toJSON ConditionalSplitActivity' {Maybe Text
Maybe Condition
Maybe WaitTime
condition :: Maybe Condition
falseActivity :: Maybe Text
trueActivity :: Maybe Text
evaluationWaitTime :: Maybe WaitTime
$sel:condition:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe Condition
$sel:falseActivity:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe Text
$sel:trueActivity:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe Text
$sel:evaluationWaitTime:ConditionalSplitActivity' :: ConditionalSplitActivity -> Maybe WaitTime
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EvaluationWaitTime" Text -> WaitTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(WaitTime -> Pair) -> Maybe WaitTime -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WaitTime
evaluationWaitTime,
(Text
"TrueActivity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
trueActivity,
(Text
"FalseActivity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
falseActivity,
(Text
"Condition" Text -> Condition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Condition -> Pair) -> Maybe Condition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Condition
condition
]
)