{-# 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.SegmentGroupList 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.Include
import Amazonka.Pinpoint.Types.SegmentGroup
import qualified Amazonka.Prelude as Prelude
data SegmentGroupList = SegmentGroupList'
{
SegmentGroupList -> Maybe [SegmentGroup]
groups :: Prelude.Maybe [SegmentGroup],
SegmentGroupList -> Maybe Include
include :: Prelude.Maybe Include
}
deriving (SegmentGroupList -> SegmentGroupList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SegmentGroupList -> SegmentGroupList -> Bool
$c/= :: SegmentGroupList -> SegmentGroupList -> Bool
== :: SegmentGroupList -> SegmentGroupList -> Bool
$c== :: SegmentGroupList -> SegmentGroupList -> Bool
Prelude.Eq, ReadPrec [SegmentGroupList]
ReadPrec SegmentGroupList
Int -> ReadS SegmentGroupList
ReadS [SegmentGroupList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SegmentGroupList]
$creadListPrec :: ReadPrec [SegmentGroupList]
readPrec :: ReadPrec SegmentGroupList
$creadPrec :: ReadPrec SegmentGroupList
readList :: ReadS [SegmentGroupList]
$creadList :: ReadS [SegmentGroupList]
readsPrec :: Int -> ReadS SegmentGroupList
$creadsPrec :: Int -> ReadS SegmentGroupList
Prelude.Read, Int -> SegmentGroupList -> ShowS
[SegmentGroupList] -> ShowS
SegmentGroupList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SegmentGroupList] -> ShowS
$cshowList :: [SegmentGroupList] -> ShowS
show :: SegmentGroupList -> String
$cshow :: SegmentGroupList -> String
showsPrec :: Int -> SegmentGroupList -> ShowS
$cshowsPrec :: Int -> SegmentGroupList -> ShowS
Prelude.Show, forall x. Rep SegmentGroupList x -> SegmentGroupList
forall x. SegmentGroupList -> Rep SegmentGroupList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SegmentGroupList x -> SegmentGroupList
$cfrom :: forall x. SegmentGroupList -> Rep SegmentGroupList x
Prelude.Generic)
newSegmentGroupList ::
SegmentGroupList
newSegmentGroupList :: SegmentGroupList
newSegmentGroupList =
SegmentGroupList'
{ $sel:groups:SegmentGroupList' :: Maybe [SegmentGroup]
groups = forall a. Maybe a
Prelude.Nothing,
$sel:include:SegmentGroupList' :: Maybe Include
include = forall a. Maybe a
Prelude.Nothing
}
segmentGroupList_groups :: Lens.Lens' SegmentGroupList (Prelude.Maybe [SegmentGroup])
segmentGroupList_groups :: Lens' SegmentGroupList (Maybe [SegmentGroup])
segmentGroupList_groups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentGroupList' {Maybe [SegmentGroup]
groups :: Maybe [SegmentGroup]
$sel:groups:SegmentGroupList' :: SegmentGroupList -> Maybe [SegmentGroup]
groups} -> Maybe [SegmentGroup]
groups) (\s :: SegmentGroupList
s@SegmentGroupList' {} Maybe [SegmentGroup]
a -> SegmentGroupList
s {$sel:groups:SegmentGroupList' :: Maybe [SegmentGroup]
groups = Maybe [SegmentGroup]
a} :: SegmentGroupList) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
segmentGroupList_include :: Lens.Lens' SegmentGroupList (Prelude.Maybe Include)
segmentGroupList_include :: Lens' SegmentGroupList (Maybe Include)
segmentGroupList_include = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentGroupList' {Maybe Include
include :: Maybe Include
$sel:include:SegmentGroupList' :: SegmentGroupList -> Maybe Include
include} -> Maybe Include
include) (\s :: SegmentGroupList
s@SegmentGroupList' {} Maybe Include
a -> SegmentGroupList
s {$sel:include:SegmentGroupList' :: Maybe Include
include = Maybe Include
a} :: SegmentGroupList)
instance Data.FromJSON SegmentGroupList where
parseJSON :: Value -> Parser SegmentGroupList
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SegmentGroupList"
( \Object
x ->
Maybe [SegmentGroup] -> Maybe Include -> SegmentGroupList
SegmentGroupList'
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
"Groups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"Include")
)
instance Prelude.Hashable SegmentGroupList where
hashWithSalt :: Int -> SegmentGroupList -> Int
hashWithSalt Int
_salt SegmentGroupList' {Maybe [SegmentGroup]
Maybe Include
include :: Maybe Include
groups :: Maybe [SegmentGroup]
$sel:include:SegmentGroupList' :: SegmentGroupList -> Maybe Include
$sel:groups:SegmentGroupList' :: SegmentGroupList -> Maybe [SegmentGroup]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SegmentGroup]
groups
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Include
include
instance Prelude.NFData SegmentGroupList where
rnf :: SegmentGroupList -> ()
rnf SegmentGroupList' {Maybe [SegmentGroup]
Maybe Include
include :: Maybe Include
groups :: Maybe [SegmentGroup]
$sel:include:SegmentGroupList' :: SegmentGroupList -> Maybe Include
$sel:groups:SegmentGroupList' :: SegmentGroupList -> Maybe [SegmentGroup]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [SegmentGroup]
groups
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Include
include
instance Data.ToJSON SegmentGroupList where
toJSON :: SegmentGroupList -> Value
toJSON SegmentGroupList' {Maybe [SegmentGroup]
Maybe Include
include :: Maybe Include
groups :: Maybe [SegmentGroup]
$sel:include:SegmentGroupList' :: SegmentGroupList -> Maybe Include
$sel:groups:SegmentGroupList' :: SegmentGroupList -> Maybe [SegmentGroup]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Groups" 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 [SegmentGroup]
groups,
(Key
"Include" 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 Include
include
]
)