{-# 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.SimpleCondition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.EventCondition
import Amazonka.Pinpoint.Types.SegmentCondition
import Amazonka.Pinpoint.Types.SegmentDimensions
import qualified Amazonka.Prelude as Prelude
data SimpleCondition = SimpleCondition'
{
SimpleCondition -> Maybe EventCondition
eventCondition :: Prelude.Maybe EventCondition,
SimpleCondition -> Maybe SegmentCondition
segmentCondition :: Prelude.Maybe SegmentCondition,
SimpleCondition -> Maybe SegmentDimensions
segmentDimensions :: Prelude.Maybe SegmentDimensions
}
deriving (SimpleCondition -> SimpleCondition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SimpleCondition -> SimpleCondition -> Bool
$c/= :: SimpleCondition -> SimpleCondition -> Bool
== :: SimpleCondition -> SimpleCondition -> Bool
$c== :: SimpleCondition -> SimpleCondition -> Bool
Prelude.Eq, ReadPrec [SimpleCondition]
ReadPrec SimpleCondition
Int -> ReadS SimpleCondition
ReadS [SimpleCondition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SimpleCondition]
$creadListPrec :: ReadPrec [SimpleCondition]
readPrec :: ReadPrec SimpleCondition
$creadPrec :: ReadPrec SimpleCondition
readList :: ReadS [SimpleCondition]
$creadList :: ReadS [SimpleCondition]
readsPrec :: Int -> ReadS SimpleCondition
$creadsPrec :: Int -> ReadS SimpleCondition
Prelude.Read, Int -> SimpleCondition -> ShowS
[SimpleCondition] -> ShowS
SimpleCondition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SimpleCondition] -> ShowS
$cshowList :: [SimpleCondition] -> ShowS
show :: SimpleCondition -> String
$cshow :: SimpleCondition -> String
showsPrec :: Int -> SimpleCondition -> ShowS
$cshowsPrec :: Int -> SimpleCondition -> ShowS
Prelude.Show, forall x. Rep SimpleCondition x -> SimpleCondition
forall x. SimpleCondition -> Rep SimpleCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SimpleCondition x -> SimpleCondition
$cfrom :: forall x. SimpleCondition -> Rep SimpleCondition x
Prelude.Generic)
newSimpleCondition ::
SimpleCondition
newSimpleCondition :: SimpleCondition
newSimpleCondition =
SimpleCondition'
{ $sel:eventCondition:SimpleCondition' :: Maybe EventCondition
eventCondition = forall a. Maybe a
Prelude.Nothing,
$sel:segmentCondition:SimpleCondition' :: Maybe SegmentCondition
segmentCondition = forall a. Maybe a
Prelude.Nothing,
$sel:segmentDimensions:SimpleCondition' :: Maybe SegmentDimensions
segmentDimensions = forall a. Maybe a
Prelude.Nothing
}
simpleCondition_eventCondition :: Lens.Lens' SimpleCondition (Prelude.Maybe EventCondition)
simpleCondition_eventCondition :: Lens' SimpleCondition (Maybe EventCondition)
simpleCondition_eventCondition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleCondition' {Maybe EventCondition
eventCondition :: Maybe EventCondition
$sel:eventCondition:SimpleCondition' :: SimpleCondition -> Maybe EventCondition
eventCondition} -> Maybe EventCondition
eventCondition) (\s :: SimpleCondition
s@SimpleCondition' {} Maybe EventCondition
a -> SimpleCondition
s {$sel:eventCondition:SimpleCondition' :: Maybe EventCondition
eventCondition = Maybe EventCondition
a} :: SimpleCondition)
simpleCondition_segmentCondition :: Lens.Lens' SimpleCondition (Prelude.Maybe SegmentCondition)
simpleCondition_segmentCondition :: Lens' SimpleCondition (Maybe SegmentCondition)
simpleCondition_segmentCondition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleCondition' {Maybe SegmentCondition
segmentCondition :: Maybe SegmentCondition
$sel:segmentCondition:SimpleCondition' :: SimpleCondition -> Maybe SegmentCondition
segmentCondition} -> Maybe SegmentCondition
segmentCondition) (\s :: SimpleCondition
s@SimpleCondition' {} Maybe SegmentCondition
a -> SimpleCondition
s {$sel:segmentCondition:SimpleCondition' :: Maybe SegmentCondition
segmentCondition = Maybe SegmentCondition
a} :: SimpleCondition)
simpleCondition_segmentDimensions :: Lens.Lens' SimpleCondition (Prelude.Maybe SegmentDimensions)
simpleCondition_segmentDimensions :: Lens' SimpleCondition (Maybe SegmentDimensions)
simpleCondition_segmentDimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleCondition' {Maybe SegmentDimensions
segmentDimensions :: Maybe SegmentDimensions
$sel:segmentDimensions:SimpleCondition' :: SimpleCondition -> Maybe SegmentDimensions
segmentDimensions} -> Maybe SegmentDimensions
segmentDimensions) (\s :: SimpleCondition
s@SimpleCondition' {} Maybe SegmentDimensions
a -> SimpleCondition
s {$sel:segmentDimensions:SimpleCondition' :: Maybe SegmentDimensions
segmentDimensions = Maybe SegmentDimensions
a} :: SimpleCondition)
instance Data.FromJSON SimpleCondition where
parseJSON :: Value -> Parser SimpleCondition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SimpleCondition"
( \Object
x ->
Maybe EventCondition
-> Maybe SegmentCondition
-> Maybe SegmentDimensions
-> SimpleCondition
SimpleCondition'
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
"EventCondition")
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
"SegmentCondition")
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
"segmentDimensions")
)
instance Prelude.Hashable SimpleCondition where
hashWithSalt :: Int -> SimpleCondition -> Int
hashWithSalt Int
_salt SimpleCondition' {Maybe SegmentCondition
Maybe SegmentDimensions
Maybe EventCondition
segmentDimensions :: Maybe SegmentDimensions
segmentCondition :: Maybe SegmentCondition
eventCondition :: Maybe EventCondition
$sel:segmentDimensions:SimpleCondition' :: SimpleCondition -> Maybe SegmentDimensions
$sel:segmentCondition:SimpleCondition' :: SimpleCondition -> Maybe SegmentCondition
$sel:eventCondition:SimpleCondition' :: SimpleCondition -> Maybe EventCondition
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventCondition
eventCondition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SegmentCondition
segmentCondition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SegmentDimensions
segmentDimensions
instance Prelude.NFData SimpleCondition where
rnf :: SimpleCondition -> ()
rnf SimpleCondition' {Maybe SegmentCondition
Maybe SegmentDimensions
Maybe EventCondition
segmentDimensions :: Maybe SegmentDimensions
segmentCondition :: Maybe SegmentCondition
eventCondition :: Maybe EventCondition
$sel:segmentDimensions:SimpleCondition' :: SimpleCondition -> Maybe SegmentDimensions
$sel:segmentCondition:SimpleCondition' :: SimpleCondition -> Maybe SegmentCondition
$sel:eventCondition:SimpleCondition' :: SimpleCondition -> Maybe EventCondition
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe EventCondition
eventCondition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SegmentCondition
segmentCondition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SegmentDimensions
segmentDimensions
instance Data.ToJSON SimpleCondition where
toJSON :: SimpleCondition -> Value
toJSON SimpleCondition' {Maybe SegmentCondition
Maybe SegmentDimensions
Maybe EventCondition
segmentDimensions :: Maybe SegmentDimensions
segmentCondition :: Maybe SegmentCondition
eventCondition :: Maybe EventCondition
$sel:segmentDimensions:SimpleCondition' :: SimpleCondition -> Maybe SegmentDimensions
$sel:segmentCondition:SimpleCondition' :: SimpleCondition -> Maybe SegmentCondition
$sel:eventCondition:SimpleCondition' :: SimpleCondition -> Maybe EventCondition
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"EventCondition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EventCondition
eventCondition,
(Key
"SegmentCondition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SegmentCondition
segmentCondition,
(Key
"segmentDimensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SegmentDimensions
segmentDimensions
]
)