{-# 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.RandomSplitEntry 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
data RandomSplitEntry = RandomSplitEntry'
{
RandomSplitEntry -> Maybe Text
nextActivity :: Prelude.Maybe Prelude.Text,
RandomSplitEntry -> Maybe Int
percentage :: Prelude.Maybe Prelude.Int
}
deriving (RandomSplitEntry -> RandomSplitEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RandomSplitEntry -> RandomSplitEntry -> Bool
$c/= :: RandomSplitEntry -> RandomSplitEntry -> Bool
== :: RandomSplitEntry -> RandomSplitEntry -> Bool
$c== :: RandomSplitEntry -> RandomSplitEntry -> Bool
Prelude.Eq, ReadPrec [RandomSplitEntry]
ReadPrec RandomSplitEntry
Int -> ReadS RandomSplitEntry
ReadS [RandomSplitEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RandomSplitEntry]
$creadListPrec :: ReadPrec [RandomSplitEntry]
readPrec :: ReadPrec RandomSplitEntry
$creadPrec :: ReadPrec RandomSplitEntry
readList :: ReadS [RandomSplitEntry]
$creadList :: ReadS [RandomSplitEntry]
readsPrec :: Int -> ReadS RandomSplitEntry
$creadsPrec :: Int -> ReadS RandomSplitEntry
Prelude.Read, Int -> RandomSplitEntry -> ShowS
[RandomSplitEntry] -> ShowS
RandomSplitEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RandomSplitEntry] -> ShowS
$cshowList :: [RandomSplitEntry] -> ShowS
show :: RandomSplitEntry -> String
$cshow :: RandomSplitEntry -> String
showsPrec :: Int -> RandomSplitEntry -> ShowS
$cshowsPrec :: Int -> RandomSplitEntry -> ShowS
Prelude.Show, forall x. Rep RandomSplitEntry x -> RandomSplitEntry
forall x. RandomSplitEntry -> Rep RandomSplitEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RandomSplitEntry x -> RandomSplitEntry
$cfrom :: forall x. RandomSplitEntry -> Rep RandomSplitEntry x
Prelude.Generic)
newRandomSplitEntry ::
RandomSplitEntry
newRandomSplitEntry :: RandomSplitEntry
newRandomSplitEntry =
RandomSplitEntry'
{ $sel:nextActivity:RandomSplitEntry' :: Maybe Text
nextActivity = forall a. Maybe a
Prelude.Nothing,
$sel:percentage:RandomSplitEntry' :: Maybe Int
percentage = forall a. Maybe a
Prelude.Nothing
}
randomSplitEntry_nextActivity :: Lens.Lens' RandomSplitEntry (Prelude.Maybe Prelude.Text)
randomSplitEntry_nextActivity :: Lens' RandomSplitEntry (Maybe Text)
randomSplitEntry_nextActivity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RandomSplitEntry' {Maybe Text
nextActivity :: Maybe Text
$sel:nextActivity:RandomSplitEntry' :: RandomSplitEntry -> Maybe Text
nextActivity} -> Maybe Text
nextActivity) (\s :: RandomSplitEntry
s@RandomSplitEntry' {} Maybe Text
a -> RandomSplitEntry
s {$sel:nextActivity:RandomSplitEntry' :: Maybe Text
nextActivity = Maybe Text
a} :: RandomSplitEntry)
randomSplitEntry_percentage :: Lens.Lens' RandomSplitEntry (Prelude.Maybe Prelude.Int)
randomSplitEntry_percentage :: Lens' RandomSplitEntry (Maybe Int)
randomSplitEntry_percentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RandomSplitEntry' {Maybe Int
percentage :: Maybe Int
$sel:percentage:RandomSplitEntry' :: RandomSplitEntry -> Maybe Int
percentage} -> Maybe Int
percentage) (\s :: RandomSplitEntry
s@RandomSplitEntry' {} Maybe Int
a -> RandomSplitEntry
s {$sel:percentage:RandomSplitEntry' :: Maybe Int
percentage = Maybe Int
a} :: RandomSplitEntry)
instance Data.FromJSON RandomSplitEntry where
parseJSON :: Value -> Parser RandomSplitEntry
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RandomSplitEntry"
( \Object
x ->
Maybe Text -> Maybe Int -> RandomSplitEntry
RandomSplitEntry'
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
"NextActivity")
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
"Percentage")
)
instance Prelude.Hashable RandomSplitEntry where
hashWithSalt :: Int -> RandomSplitEntry -> Int
hashWithSalt Int
_salt RandomSplitEntry' {Maybe Int
Maybe Text
percentage :: Maybe Int
nextActivity :: Maybe Text
$sel:percentage:RandomSplitEntry' :: RandomSplitEntry -> Maybe Int
$sel:nextActivity:RandomSplitEntry' :: RandomSplitEntry -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextActivity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
percentage
instance Prelude.NFData RandomSplitEntry where
rnf :: RandomSplitEntry -> ()
rnf RandomSplitEntry' {Maybe Int
Maybe Text
percentage :: Maybe Int
nextActivity :: Maybe Text
$sel:percentage:RandomSplitEntry' :: RandomSplitEntry -> Maybe Int
$sel:nextActivity:RandomSplitEntry' :: RandomSplitEntry -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextActivity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
percentage
instance Data.ToJSON RandomSplitEntry where
toJSON :: RandomSplitEntry -> Value
toJSON RandomSplitEntry' {Maybe Int
Maybe Text
percentage :: Maybe Int
nextActivity :: Maybe Text
$sel:percentage:RandomSplitEntry' :: RandomSplitEntry -> Maybe Int
$sel:nextActivity:RandomSplitEntry' :: RandomSplitEntry -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"NextActivity" 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 Text
nextActivity,
(Key
"Percentage" 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 Int
percentage
]
)