{-# 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.SegmentDemographics where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.SetDimension
import qualified Amazonka.Prelude as Prelude
data SegmentDemographics = SegmentDemographics'
{
SegmentDemographics -> Maybe SetDimension
platform :: Prelude.Maybe SetDimension,
SegmentDemographics -> Maybe SetDimension
appVersion :: Prelude.Maybe SetDimension,
SegmentDemographics -> Maybe SetDimension
channel :: Prelude.Maybe SetDimension,
SegmentDemographics -> Maybe SetDimension
model :: Prelude.Maybe SetDimension,
SegmentDemographics -> Maybe SetDimension
make :: Prelude.Maybe SetDimension,
SegmentDemographics -> Maybe SetDimension
deviceType :: Prelude.Maybe SetDimension
}
deriving (SegmentDemographics -> SegmentDemographics -> Bool
(SegmentDemographics -> SegmentDemographics -> Bool)
-> (SegmentDemographics -> SegmentDemographics -> Bool)
-> Eq SegmentDemographics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SegmentDemographics -> SegmentDemographics -> Bool
$c/= :: SegmentDemographics -> SegmentDemographics -> Bool
== :: SegmentDemographics -> SegmentDemographics -> Bool
$c== :: SegmentDemographics -> SegmentDemographics -> Bool
Prelude.Eq, ReadPrec [SegmentDemographics]
ReadPrec SegmentDemographics
Int -> ReadS SegmentDemographics
ReadS [SegmentDemographics]
(Int -> ReadS SegmentDemographics)
-> ReadS [SegmentDemographics]
-> ReadPrec SegmentDemographics
-> ReadPrec [SegmentDemographics]
-> Read SegmentDemographics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SegmentDemographics]
$creadListPrec :: ReadPrec [SegmentDemographics]
readPrec :: ReadPrec SegmentDemographics
$creadPrec :: ReadPrec SegmentDemographics
readList :: ReadS [SegmentDemographics]
$creadList :: ReadS [SegmentDemographics]
readsPrec :: Int -> ReadS SegmentDemographics
$creadsPrec :: Int -> ReadS SegmentDemographics
Prelude.Read, Int -> SegmentDemographics -> ShowS
[SegmentDemographics] -> ShowS
SegmentDemographics -> String
(Int -> SegmentDemographics -> ShowS)
-> (SegmentDemographics -> String)
-> ([SegmentDemographics] -> ShowS)
-> Show SegmentDemographics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SegmentDemographics] -> ShowS
$cshowList :: [SegmentDemographics] -> ShowS
show :: SegmentDemographics -> String
$cshow :: SegmentDemographics -> String
showsPrec :: Int -> SegmentDemographics -> ShowS
$cshowsPrec :: Int -> SegmentDemographics -> ShowS
Prelude.Show, (forall x. SegmentDemographics -> Rep SegmentDemographics x)
-> (forall x. Rep SegmentDemographics x -> SegmentDemographics)
-> Generic SegmentDemographics
forall x. Rep SegmentDemographics x -> SegmentDemographics
forall x. SegmentDemographics -> Rep SegmentDemographics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SegmentDemographics x -> SegmentDemographics
$cfrom :: forall x. SegmentDemographics -> Rep SegmentDemographics x
Prelude.Generic)
newSegmentDemographics ::
SegmentDemographics
newSegmentDemographics :: SegmentDemographics
newSegmentDemographics =
SegmentDemographics' :: Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics
SegmentDemographics'
{ $sel:platform:SegmentDemographics' :: Maybe SetDimension
platform = Maybe SetDimension
forall a. Maybe a
Prelude.Nothing,
$sel:appVersion:SegmentDemographics' :: Maybe SetDimension
appVersion = Maybe SetDimension
forall a. Maybe a
Prelude.Nothing,
$sel:channel:SegmentDemographics' :: Maybe SetDimension
channel = Maybe SetDimension
forall a. Maybe a
Prelude.Nothing,
$sel:model:SegmentDemographics' :: Maybe SetDimension
model = Maybe SetDimension
forall a. Maybe a
Prelude.Nothing,
$sel:make:SegmentDemographics' :: Maybe SetDimension
make = Maybe SetDimension
forall a. Maybe a
Prelude.Nothing,
$sel:deviceType:SegmentDemographics' :: Maybe SetDimension
deviceType = Maybe SetDimension
forall a. Maybe a
Prelude.Nothing
}
segmentDemographics_platform :: Lens.Lens' SegmentDemographics (Prelude.Maybe SetDimension)
segmentDemographics_platform :: (Maybe SetDimension -> f (Maybe SetDimension))
-> SegmentDemographics -> f SegmentDemographics
segmentDemographics_platform = (SegmentDemographics -> Maybe SetDimension)
-> (SegmentDemographics
-> Maybe SetDimension -> SegmentDemographics)
-> Lens
SegmentDemographics
SegmentDemographics
(Maybe SetDimension)
(Maybe SetDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDemographics' {Maybe SetDimension
platform :: Maybe SetDimension
$sel:platform:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
platform} -> Maybe SetDimension
platform) (\s :: SegmentDemographics
s@SegmentDemographics' {} Maybe SetDimension
a -> SegmentDemographics
s {$sel:platform:SegmentDemographics' :: Maybe SetDimension
platform = Maybe SetDimension
a} :: SegmentDemographics)
segmentDemographics_appVersion :: Lens.Lens' SegmentDemographics (Prelude.Maybe SetDimension)
segmentDemographics_appVersion :: (Maybe SetDimension -> f (Maybe SetDimension))
-> SegmentDemographics -> f SegmentDemographics
segmentDemographics_appVersion = (SegmentDemographics -> Maybe SetDimension)
-> (SegmentDemographics
-> Maybe SetDimension -> SegmentDemographics)
-> Lens
SegmentDemographics
SegmentDemographics
(Maybe SetDimension)
(Maybe SetDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDemographics' {Maybe SetDimension
appVersion :: Maybe SetDimension
$sel:appVersion:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
appVersion} -> Maybe SetDimension
appVersion) (\s :: SegmentDemographics
s@SegmentDemographics' {} Maybe SetDimension
a -> SegmentDemographics
s {$sel:appVersion:SegmentDemographics' :: Maybe SetDimension
appVersion = Maybe SetDimension
a} :: SegmentDemographics)
segmentDemographics_channel :: Lens.Lens' SegmentDemographics (Prelude.Maybe SetDimension)
segmentDemographics_channel :: (Maybe SetDimension -> f (Maybe SetDimension))
-> SegmentDemographics -> f SegmentDemographics
segmentDemographics_channel = (SegmentDemographics -> Maybe SetDimension)
-> (SegmentDemographics
-> Maybe SetDimension -> SegmentDemographics)
-> Lens
SegmentDemographics
SegmentDemographics
(Maybe SetDimension)
(Maybe SetDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDemographics' {Maybe SetDimension
channel :: Maybe SetDimension
$sel:channel:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
channel} -> Maybe SetDimension
channel) (\s :: SegmentDemographics
s@SegmentDemographics' {} Maybe SetDimension
a -> SegmentDemographics
s {$sel:channel:SegmentDemographics' :: Maybe SetDimension
channel = Maybe SetDimension
a} :: SegmentDemographics)
segmentDemographics_model :: Lens.Lens' SegmentDemographics (Prelude.Maybe SetDimension)
segmentDemographics_model :: (Maybe SetDimension -> f (Maybe SetDimension))
-> SegmentDemographics -> f SegmentDemographics
segmentDemographics_model = (SegmentDemographics -> Maybe SetDimension)
-> (SegmentDemographics
-> Maybe SetDimension -> SegmentDemographics)
-> Lens
SegmentDemographics
SegmentDemographics
(Maybe SetDimension)
(Maybe SetDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDemographics' {Maybe SetDimension
model :: Maybe SetDimension
$sel:model:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
model} -> Maybe SetDimension
model) (\s :: SegmentDemographics
s@SegmentDemographics' {} Maybe SetDimension
a -> SegmentDemographics
s {$sel:model:SegmentDemographics' :: Maybe SetDimension
model = Maybe SetDimension
a} :: SegmentDemographics)
segmentDemographics_make :: Lens.Lens' SegmentDemographics (Prelude.Maybe SetDimension)
segmentDemographics_make :: (Maybe SetDimension -> f (Maybe SetDimension))
-> SegmentDemographics -> f SegmentDemographics
segmentDemographics_make = (SegmentDemographics -> Maybe SetDimension)
-> (SegmentDemographics
-> Maybe SetDimension -> SegmentDemographics)
-> Lens
SegmentDemographics
SegmentDemographics
(Maybe SetDimension)
(Maybe SetDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDemographics' {Maybe SetDimension
make :: Maybe SetDimension
$sel:make:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
make} -> Maybe SetDimension
make) (\s :: SegmentDemographics
s@SegmentDemographics' {} Maybe SetDimension
a -> SegmentDemographics
s {$sel:make:SegmentDemographics' :: Maybe SetDimension
make = Maybe SetDimension
a} :: SegmentDemographics)
segmentDemographics_deviceType :: Lens.Lens' SegmentDemographics (Prelude.Maybe SetDimension)
segmentDemographics_deviceType :: (Maybe SetDimension -> f (Maybe SetDimension))
-> SegmentDemographics -> f SegmentDemographics
segmentDemographics_deviceType = (SegmentDemographics -> Maybe SetDimension)
-> (SegmentDemographics
-> Maybe SetDimension -> SegmentDemographics)
-> Lens
SegmentDemographics
SegmentDemographics
(Maybe SetDimension)
(Maybe SetDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDemographics' {Maybe SetDimension
deviceType :: Maybe SetDimension
$sel:deviceType:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
deviceType} -> Maybe SetDimension
deviceType) (\s :: SegmentDemographics
s@SegmentDemographics' {} Maybe SetDimension
a -> SegmentDemographics
s {$sel:deviceType:SegmentDemographics' :: Maybe SetDimension
deviceType = Maybe SetDimension
a} :: SegmentDemographics)
instance Core.FromJSON SegmentDemographics where
parseJSON :: Value -> Parser SegmentDemographics
parseJSON =
String
-> (Object -> Parser SegmentDemographics)
-> Value
-> Parser SegmentDemographics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SegmentDemographics"
( \Object
x ->
Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics
SegmentDemographics'
(Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics)
-> Parser (Maybe SetDimension)
-> Parser
(Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SetDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Platform")
Parser
(Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics)
-> Parser (Maybe SetDimension)
-> Parser
(Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SetDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AppVersion")
Parser
(Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> Maybe SetDimension
-> SegmentDemographics)
-> Parser (Maybe SetDimension)
-> Parser
(Maybe SetDimension
-> Maybe SetDimension -> Maybe SetDimension -> SegmentDemographics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SetDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Channel")
Parser
(Maybe SetDimension
-> Maybe SetDimension -> Maybe SetDimension -> SegmentDemographics)
-> Parser (Maybe SetDimension)
-> Parser
(Maybe SetDimension -> Maybe SetDimension -> SegmentDemographics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SetDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Model")
Parser
(Maybe SetDimension -> Maybe SetDimension -> SegmentDemographics)
-> Parser (Maybe SetDimension)
-> Parser (Maybe SetDimension -> SegmentDemographics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SetDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Make")
Parser (Maybe SetDimension -> SegmentDemographics)
-> Parser (Maybe SetDimension) -> Parser SegmentDemographics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SetDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeviceType")
)
instance Prelude.Hashable SegmentDemographics
instance Prelude.NFData SegmentDemographics
instance Core.ToJSON SegmentDemographics where
toJSON :: SegmentDemographics -> Value
toJSON SegmentDemographics' {Maybe SetDimension
deviceType :: Maybe SetDimension
make :: Maybe SetDimension
model :: Maybe SetDimension
channel :: Maybe SetDimension
appVersion :: Maybe SetDimension
platform :: Maybe SetDimension
$sel:deviceType:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
$sel:make:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
$sel:model:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
$sel:channel:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
$sel:appVersion:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
$sel:platform:SegmentDemographics' :: SegmentDemographics -> Maybe SetDimension
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Platform" Text -> SetDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetDimension -> Pair) -> Maybe SetDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetDimension
platform,
(Text
"AppVersion" Text -> SetDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetDimension -> Pair) -> Maybe SetDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetDimension
appVersion,
(Text
"Channel" Text -> SetDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetDimension -> Pair) -> Maybe SetDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetDimension
channel,
(Text
"Model" Text -> SetDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetDimension -> Pair) -> Maybe SetDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetDimension
model,
(Text
"Make" Text -> SetDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetDimension -> Pair) -> Maybe SetDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetDimension
make,
(Text
"DeviceType" Text -> SetDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetDimension -> Pair) -> Maybe SetDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetDimension
deviceType
]
)