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