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