{-# 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.RecencyDimension 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.Duration
import Amazonka.Pinpoint.Types.RecencyType
import qualified Amazonka.Prelude as Prelude
data RecencyDimension = RecencyDimension'
{
RecencyDimension -> Duration
duration :: Duration,
RecencyDimension -> RecencyType
recencyType :: RecencyType
}
deriving (RecencyDimension -> RecencyDimension -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecencyDimension -> RecencyDimension -> Bool
$c/= :: RecencyDimension -> RecencyDimension -> Bool
== :: RecencyDimension -> RecencyDimension -> Bool
$c== :: RecencyDimension -> RecencyDimension -> Bool
Prelude.Eq, ReadPrec [RecencyDimension]
ReadPrec RecencyDimension
Int -> ReadS RecencyDimension
ReadS [RecencyDimension]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecencyDimension]
$creadListPrec :: ReadPrec [RecencyDimension]
readPrec :: ReadPrec RecencyDimension
$creadPrec :: ReadPrec RecencyDimension
readList :: ReadS [RecencyDimension]
$creadList :: ReadS [RecencyDimension]
readsPrec :: Int -> ReadS RecencyDimension
$creadsPrec :: Int -> ReadS RecencyDimension
Prelude.Read, Int -> RecencyDimension -> ShowS
[RecencyDimension] -> ShowS
RecencyDimension -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecencyDimension] -> ShowS
$cshowList :: [RecencyDimension] -> ShowS
show :: RecencyDimension -> String
$cshow :: RecencyDimension -> String
showsPrec :: Int -> RecencyDimension -> ShowS
$cshowsPrec :: Int -> RecencyDimension -> ShowS
Prelude.Show, forall x. Rep RecencyDimension x -> RecencyDimension
forall x. RecencyDimension -> Rep RecencyDimension x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecencyDimension x -> RecencyDimension
$cfrom :: forall x. RecencyDimension -> Rep RecencyDimension x
Prelude.Generic)
newRecencyDimension ::
Duration ->
RecencyType ->
RecencyDimension
newRecencyDimension :: Duration -> RecencyType -> RecencyDimension
newRecencyDimension Duration
pDuration_ RecencyType
pRecencyType_ =
RecencyDimension'
{ $sel:duration:RecencyDimension' :: Duration
duration = Duration
pDuration_,
$sel:recencyType:RecencyDimension' :: RecencyType
recencyType = RecencyType
pRecencyType_
}
recencyDimension_duration :: Lens.Lens' RecencyDimension Duration
recencyDimension_duration :: Lens' RecencyDimension Duration
recencyDimension_duration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecencyDimension' {Duration
duration :: Duration
$sel:duration:RecencyDimension' :: RecencyDimension -> Duration
duration} -> Duration
duration) (\s :: RecencyDimension
s@RecencyDimension' {} Duration
a -> RecencyDimension
s {$sel:duration:RecencyDimension' :: Duration
duration = Duration
a} :: RecencyDimension)
recencyDimension_recencyType :: Lens.Lens' RecencyDimension RecencyType
recencyDimension_recencyType :: Lens' RecencyDimension RecencyType
recencyDimension_recencyType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecencyDimension' {RecencyType
recencyType :: RecencyType
$sel:recencyType:RecencyDimension' :: RecencyDimension -> RecencyType
recencyType} -> RecencyType
recencyType) (\s :: RecencyDimension
s@RecencyDimension' {} RecencyType
a -> RecencyDimension
s {$sel:recencyType:RecencyDimension' :: RecencyType
recencyType = RecencyType
a} :: RecencyDimension)
instance Data.FromJSON RecencyDimension where
parseJSON :: Value -> Parser RecencyDimension
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RecencyDimension"
( \Object
x ->
Duration -> RecencyType -> RecencyDimension
RecencyDimension'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Duration")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RecencyType")
)
instance Prelude.Hashable RecencyDimension where
hashWithSalt :: Int -> RecencyDimension -> Int
hashWithSalt Int
_salt RecencyDimension' {Duration
RecencyType
recencyType :: RecencyType
duration :: Duration
$sel:recencyType:RecencyDimension' :: RecencyDimension -> RecencyType
$sel:duration:RecencyDimension' :: RecencyDimension -> Duration
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Duration
duration
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RecencyType
recencyType
instance Prelude.NFData RecencyDimension where
rnf :: RecencyDimension -> ()
rnf RecencyDimension' {Duration
RecencyType
recencyType :: RecencyType
duration :: Duration
$sel:recencyType:RecencyDimension' :: RecencyDimension -> RecencyType
$sel:duration:RecencyDimension' :: RecencyDimension -> Duration
..} =
forall a. NFData a => a -> ()
Prelude.rnf Duration
duration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RecencyType
recencyType
instance Data.ToJSON RecencyDimension where
toJSON :: RecencyDimension -> Value
toJSON RecencyDimension' {Duration
RecencyType
recencyType :: RecencyType
duration :: Duration
$sel:recencyType:RecencyDimension' :: RecencyDimension -> RecencyType
$sel:duration:RecencyDimension' :: RecencyDimension -> Duration
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Duration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Duration
duration),
forall a. a -> Maybe a
Prelude.Just (Key
"RecencyType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RecencyType
recencyType)
]
)