{-# 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.RandomSplitActivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.RandomSplitEntry
import qualified Amazonka.Prelude as Prelude
data RandomSplitActivity = RandomSplitActivity'
{
RandomSplitActivity -> Maybe [RandomSplitEntry]
branches :: Prelude.Maybe [RandomSplitEntry]
}
deriving (RandomSplitActivity -> RandomSplitActivity -> Bool
(RandomSplitActivity -> RandomSplitActivity -> Bool)
-> (RandomSplitActivity -> RandomSplitActivity -> Bool)
-> Eq RandomSplitActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RandomSplitActivity -> RandomSplitActivity -> Bool
$c/= :: RandomSplitActivity -> RandomSplitActivity -> Bool
== :: RandomSplitActivity -> RandomSplitActivity -> Bool
$c== :: RandomSplitActivity -> RandomSplitActivity -> Bool
Prelude.Eq, ReadPrec [RandomSplitActivity]
ReadPrec RandomSplitActivity
Int -> ReadS RandomSplitActivity
ReadS [RandomSplitActivity]
(Int -> ReadS RandomSplitActivity)
-> ReadS [RandomSplitActivity]
-> ReadPrec RandomSplitActivity
-> ReadPrec [RandomSplitActivity]
-> Read RandomSplitActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RandomSplitActivity]
$creadListPrec :: ReadPrec [RandomSplitActivity]
readPrec :: ReadPrec RandomSplitActivity
$creadPrec :: ReadPrec RandomSplitActivity
readList :: ReadS [RandomSplitActivity]
$creadList :: ReadS [RandomSplitActivity]
readsPrec :: Int -> ReadS RandomSplitActivity
$creadsPrec :: Int -> ReadS RandomSplitActivity
Prelude.Read, Int -> RandomSplitActivity -> ShowS
[RandomSplitActivity] -> ShowS
RandomSplitActivity -> String
(Int -> RandomSplitActivity -> ShowS)
-> (RandomSplitActivity -> String)
-> ([RandomSplitActivity] -> ShowS)
-> Show RandomSplitActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RandomSplitActivity] -> ShowS
$cshowList :: [RandomSplitActivity] -> ShowS
show :: RandomSplitActivity -> String
$cshow :: RandomSplitActivity -> String
showsPrec :: Int -> RandomSplitActivity -> ShowS
$cshowsPrec :: Int -> RandomSplitActivity -> ShowS
Prelude.Show, (forall x. RandomSplitActivity -> Rep RandomSplitActivity x)
-> (forall x. Rep RandomSplitActivity x -> RandomSplitActivity)
-> Generic RandomSplitActivity
forall x. Rep RandomSplitActivity x -> RandomSplitActivity
forall x. RandomSplitActivity -> Rep RandomSplitActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RandomSplitActivity x -> RandomSplitActivity
$cfrom :: forall x. RandomSplitActivity -> Rep RandomSplitActivity x
Prelude.Generic)
newRandomSplitActivity ::
RandomSplitActivity
newRandomSplitActivity :: RandomSplitActivity
newRandomSplitActivity =
RandomSplitActivity' :: Maybe [RandomSplitEntry] -> RandomSplitActivity
RandomSplitActivity' {$sel:branches:RandomSplitActivity' :: Maybe [RandomSplitEntry]
branches = Maybe [RandomSplitEntry]
forall a. Maybe a
Prelude.Nothing}
randomSplitActivity_branches :: Lens.Lens' RandomSplitActivity (Prelude.Maybe [RandomSplitEntry])
randomSplitActivity_branches :: (Maybe [RandomSplitEntry] -> f (Maybe [RandomSplitEntry]))
-> RandomSplitActivity -> f RandomSplitActivity
randomSplitActivity_branches = (RandomSplitActivity -> Maybe [RandomSplitEntry])
-> (RandomSplitActivity
-> Maybe [RandomSplitEntry] -> RandomSplitActivity)
-> Lens
RandomSplitActivity
RandomSplitActivity
(Maybe [RandomSplitEntry])
(Maybe [RandomSplitEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RandomSplitActivity' {Maybe [RandomSplitEntry]
branches :: Maybe [RandomSplitEntry]
$sel:branches:RandomSplitActivity' :: RandomSplitActivity -> Maybe [RandomSplitEntry]
branches} -> Maybe [RandomSplitEntry]
branches) (\s :: RandomSplitActivity
s@RandomSplitActivity' {} Maybe [RandomSplitEntry]
a -> RandomSplitActivity
s {$sel:branches:RandomSplitActivity' :: Maybe [RandomSplitEntry]
branches = Maybe [RandomSplitEntry]
a} :: RandomSplitActivity) ((Maybe [RandomSplitEntry] -> f (Maybe [RandomSplitEntry]))
-> RandomSplitActivity -> f RandomSplitActivity)
-> ((Maybe [RandomSplitEntry] -> f (Maybe [RandomSplitEntry]))
-> Maybe [RandomSplitEntry] -> f (Maybe [RandomSplitEntry]))
-> (Maybe [RandomSplitEntry] -> f (Maybe [RandomSplitEntry]))
-> RandomSplitActivity
-> f RandomSplitActivity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RandomSplitEntry]
[RandomSplitEntry]
[RandomSplitEntry]
[RandomSplitEntry]
-> Iso
(Maybe [RandomSplitEntry])
(Maybe [RandomSplitEntry])
(Maybe [RandomSplitEntry])
(Maybe [RandomSplitEntry])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[RandomSplitEntry]
[RandomSplitEntry]
[RandomSplitEntry]
[RandomSplitEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON RandomSplitActivity where
parseJSON :: Value -> Parser RandomSplitActivity
parseJSON =
String
-> (Object -> Parser RandomSplitActivity)
-> Value
-> Parser RandomSplitActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RandomSplitActivity"
( \Object
x ->
Maybe [RandomSplitEntry] -> RandomSplitActivity
RandomSplitActivity'
(Maybe [RandomSplitEntry] -> RandomSplitActivity)
-> Parser (Maybe [RandomSplitEntry]) -> Parser RandomSplitActivity
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [RandomSplitEntry]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Branches" Parser (Maybe (Maybe [RandomSplitEntry]))
-> Maybe [RandomSplitEntry] -> Parser (Maybe [RandomSplitEntry])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RandomSplitEntry]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable RandomSplitActivity
instance Prelude.NFData RandomSplitActivity
instance Core.ToJSON RandomSplitActivity where
toJSON :: RandomSplitActivity -> Value
toJSON RandomSplitActivity' {Maybe [RandomSplitEntry]
branches :: Maybe [RandomSplitEntry]
$sel:branches:RandomSplitActivity' :: RandomSplitActivity -> Maybe [RandomSplitEntry]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Branches" Text -> [RandomSplitEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([RandomSplitEntry] -> Pair)
-> Maybe [RandomSplitEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RandomSplitEntry]
branches]
)