{-# 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.PersonalizeEvents.Types.Event where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PersonalizeEvents.Types.MetricAttribution
import qualified Amazonka.Prelude as Prelude
data Event = Event'
{
Event -> Maybe Text
eventId :: Prelude.Maybe Prelude.Text,
Event -> Maybe Double
eventValue :: Prelude.Maybe Prelude.Double,
Event -> Maybe (NonEmpty (Sensitive Text))
impression :: Prelude.Maybe (Prelude.NonEmpty (Data.Sensitive Prelude.Text)),
Event -> Maybe (Sensitive Text)
itemId :: Prelude.Maybe (Data.Sensitive Prelude.Text),
Event -> Maybe MetricAttribution
metricAttribution :: Prelude.Maybe MetricAttribution,
Event -> Maybe (Sensitive Text)
properties :: Prelude.Maybe (Data.Sensitive Prelude.Text),
Event -> Maybe Text
recommendationId :: Prelude.Maybe Prelude.Text,
Event -> Text
eventType :: Prelude.Text,
Event -> POSIX
sentAt :: Data.POSIX
}
deriving (Event -> Event -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Event -> Event -> Bool
$c/= :: Event -> Event -> Bool
== :: Event -> Event -> Bool
$c== :: Event -> Event -> Bool
Prelude.Eq, Int -> Event -> ShowS
[Event] -> ShowS
Event -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Event] -> ShowS
$cshowList :: [Event] -> ShowS
show :: Event -> String
$cshow :: Event -> String
showsPrec :: Int -> Event -> ShowS
$cshowsPrec :: Int -> Event -> ShowS
Prelude.Show, forall x. Rep Event x -> Event
forall x. Event -> Rep Event x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Event x -> Event
$cfrom :: forall x. Event -> Rep Event x
Prelude.Generic)
newEvent ::
Prelude.Text ->
Prelude.UTCTime ->
Event
newEvent :: Text -> UTCTime -> Event
newEvent Text
pEventType_ UTCTime
pSentAt_ =
Event'
{ $sel:eventId:Event' :: Maybe Text
eventId = forall a. Maybe a
Prelude.Nothing,
$sel:eventValue:Event' :: Maybe Double
eventValue = forall a. Maybe a
Prelude.Nothing,
$sel:impression:Event' :: Maybe (NonEmpty (Sensitive Text))
impression = forall a. Maybe a
Prelude.Nothing,
$sel:itemId:Event' :: Maybe (Sensitive Text)
itemId = forall a. Maybe a
Prelude.Nothing,
$sel:metricAttribution:Event' :: Maybe MetricAttribution
metricAttribution = forall a. Maybe a
Prelude.Nothing,
$sel:properties:Event' :: Maybe (Sensitive Text)
properties = forall a. Maybe a
Prelude.Nothing,
$sel:recommendationId:Event' :: Maybe Text
recommendationId = forall a. Maybe a
Prelude.Nothing,
$sel:eventType:Event' :: Text
eventType = Text
pEventType_,
$sel:sentAt:Event' :: POSIX
sentAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSentAt_
}
event_eventId :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_eventId :: Lens' Event (Maybe Text)
event_eventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe Text
eventId :: Maybe Text
$sel:eventId:Event' :: Event -> Maybe Text
eventId} -> Maybe Text
eventId) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:eventId:Event' :: Maybe Text
eventId = Maybe Text
a} :: Event)
event_eventValue :: Lens.Lens' Event (Prelude.Maybe Prelude.Double)
event_eventValue :: Lens' Event (Maybe Double)
event_eventValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe Double
eventValue :: Maybe Double
$sel:eventValue:Event' :: Event -> Maybe Double
eventValue} -> Maybe Double
eventValue) (\s :: Event
s@Event' {} Maybe Double
a -> Event
s {$sel:eventValue:Event' :: Maybe Double
eventValue = Maybe Double
a} :: Event)
event_impression :: Lens.Lens' Event (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
event_impression :: Lens' Event (Maybe (NonEmpty Text))
event_impression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe (NonEmpty (Sensitive Text))
impression :: Maybe (NonEmpty (Sensitive Text))
$sel:impression:Event' :: Event -> Maybe (NonEmpty (Sensitive Text))
impression} -> Maybe (NonEmpty (Sensitive Text))
impression) (\s :: Event
s@Event' {} Maybe (NonEmpty (Sensitive Text))
a -> Event
s {$sel:impression:Event' :: Maybe (NonEmpty (Sensitive Text))
impression = Maybe (NonEmpty (Sensitive Text))
a} :: Event) 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
event_itemId :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_itemId :: Lens' Event (Maybe Text)
event_itemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe (Sensitive Text)
itemId :: Maybe (Sensitive Text)
$sel:itemId:Event' :: Event -> Maybe (Sensitive Text)
itemId} -> Maybe (Sensitive Text)
itemId) (\s :: Event
s@Event' {} Maybe (Sensitive Text)
a -> Event
s {$sel:itemId:Event' :: Maybe (Sensitive Text)
itemId = Maybe (Sensitive Text)
a} :: Event) 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 a. Iso' (Sensitive a) a
Data._Sensitive
event_metricAttribution :: Lens.Lens' Event (Prelude.Maybe MetricAttribution)
event_metricAttribution :: Lens' Event (Maybe MetricAttribution)
event_metricAttribution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe MetricAttribution
metricAttribution :: Maybe MetricAttribution
$sel:metricAttribution:Event' :: Event -> Maybe MetricAttribution
metricAttribution} -> Maybe MetricAttribution
metricAttribution) (\s :: Event
s@Event' {} Maybe MetricAttribution
a -> Event
s {$sel:metricAttribution:Event' :: Maybe MetricAttribution
metricAttribution = Maybe MetricAttribution
a} :: Event)
event_properties :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_properties :: Lens' Event (Maybe Text)
event_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe (Sensitive Text)
properties :: Maybe (Sensitive Text)
$sel:properties:Event' :: Event -> Maybe (Sensitive Text)
properties} -> Maybe (Sensitive Text)
properties) (\s :: Event
s@Event' {} Maybe (Sensitive Text)
a -> Event
s {$sel:properties:Event' :: Maybe (Sensitive Text)
properties = Maybe (Sensitive Text)
a} :: Event) 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 a. Iso' (Sensitive a) a
Data._Sensitive
event_recommendationId :: Lens.Lens' Event (Prelude.Maybe Prelude.Text)
event_recommendationId :: Lens' Event (Maybe Text)
event_recommendationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Maybe Text
recommendationId :: Maybe Text
$sel:recommendationId:Event' :: Event -> Maybe Text
recommendationId} -> Maybe Text
recommendationId) (\s :: Event
s@Event' {} Maybe Text
a -> Event
s {$sel:recommendationId:Event' :: Maybe Text
recommendationId = Maybe Text
a} :: Event)
event_eventType :: Lens.Lens' Event Prelude.Text
event_eventType :: Lens' Event Text
event_eventType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Text
eventType :: Text
$sel:eventType:Event' :: Event -> Text
eventType} -> Text
eventType) (\s :: Event
s@Event' {} Text
a -> Event
s {$sel:eventType:Event' :: Text
eventType = Text
a} :: Event)
event_sentAt :: Lens.Lens' Event Prelude.UTCTime
event_sentAt :: Lens' Event UTCTime
event_sentAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {POSIX
sentAt :: POSIX
$sel:sentAt:Event' :: Event -> POSIX
sentAt} -> POSIX
sentAt) (\s :: Event
s@Event' {} POSIX
a -> Event
s {$sel:sentAt:Event' :: POSIX
sentAt = POSIX
a} :: Event) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
instance Prelude.Hashable Event where
hashWithSalt :: Int -> Event -> Int
hashWithSalt Int
_salt Event' {Maybe Double
Maybe (NonEmpty (Sensitive Text))
Maybe Text
Maybe (Sensitive Text)
Maybe MetricAttribution
Text
POSIX
sentAt :: POSIX
eventType :: Text
recommendationId :: Maybe Text
properties :: Maybe (Sensitive Text)
metricAttribution :: Maybe MetricAttribution
itemId :: Maybe (Sensitive Text)
impression :: Maybe (NonEmpty (Sensitive Text))
eventValue :: Maybe Double
eventId :: Maybe Text
$sel:sentAt:Event' :: Event -> POSIX
$sel:eventType:Event' :: Event -> Text
$sel:recommendationId:Event' :: Event -> Maybe Text
$sel:properties:Event' :: Event -> Maybe (Sensitive Text)
$sel:metricAttribution:Event' :: Event -> Maybe MetricAttribution
$sel:itemId:Event' :: Event -> Maybe (Sensitive Text)
$sel:impression:Event' :: Event -> Maybe (NonEmpty (Sensitive Text))
$sel:eventValue:Event' :: Event -> Maybe Double
$sel:eventId:Event' :: Event -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
eventValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty (Sensitive Text))
impression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
itemId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MetricAttribution
metricAttribution
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
properties
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recommendationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
sentAt
instance Prelude.NFData Event where
rnf :: Event -> ()
rnf Event' {Maybe Double
Maybe (NonEmpty (Sensitive Text))
Maybe Text
Maybe (Sensitive Text)
Maybe MetricAttribution
Text
POSIX
sentAt :: POSIX
eventType :: Text
recommendationId :: Maybe Text
properties :: Maybe (Sensitive Text)
metricAttribution :: Maybe MetricAttribution
itemId :: Maybe (Sensitive Text)
impression :: Maybe (NonEmpty (Sensitive Text))
eventValue :: Maybe Double
eventId :: Maybe Text
$sel:sentAt:Event' :: Event -> POSIX
$sel:eventType:Event' :: Event -> Text
$sel:recommendationId:Event' :: Event -> Maybe Text
$sel:properties:Event' :: Event -> Maybe (Sensitive Text)
$sel:metricAttribution:Event' :: Event -> Maybe MetricAttribution
$sel:itemId:Event' :: Event -> Maybe (Sensitive Text)
$sel:impression:Event' :: Event -> Maybe (NonEmpty (Sensitive Text))
$sel:eventValue:Event' :: Event -> Maybe Double
$sel:eventId:Event' :: Event -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
eventValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty (Sensitive Text))
impression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
itemId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MetricAttribution
metricAttribution
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
properties
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recommendationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
sentAt
instance Data.ToJSON Event where
toJSON :: Event -> Value
toJSON Event' {Maybe Double
Maybe (NonEmpty (Sensitive Text))
Maybe Text
Maybe (Sensitive Text)
Maybe MetricAttribution
Text
POSIX
sentAt :: POSIX
eventType :: Text
recommendationId :: Maybe Text
properties :: Maybe (Sensitive Text)
metricAttribution :: Maybe MetricAttribution
itemId :: Maybe (Sensitive Text)
impression :: Maybe (NonEmpty (Sensitive Text))
eventValue :: Maybe Double
eventId :: Maybe Text
$sel:sentAt:Event' :: Event -> POSIX
$sel:eventType:Event' :: Event -> Text
$sel:recommendationId:Event' :: Event -> Maybe Text
$sel:properties:Event' :: Event -> Maybe (Sensitive Text)
$sel:metricAttribution:Event' :: Event -> Maybe MetricAttribution
$sel:itemId:Event' :: Event -> Maybe (Sensitive Text)
$sel:impression:Event' :: Event -> Maybe (NonEmpty (Sensitive Text))
$sel:eventValue:Event' :: Event -> Maybe Double
$sel:eventId:Event' :: Event -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"eventId" 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 Text
eventId,
(Key
"eventValue" 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 Double
eventValue,
(Key
"impression" 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 (NonEmpty (Sensitive Text))
impression,
(Key
"itemId" 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 (Sensitive Text)
itemId,
(Key
"metricAttribution" 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 MetricAttribution
metricAttribution,
(Key
"properties" 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 (Sensitive Text)
properties,
(Key
"recommendationId" 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 Text
recommendationId,
forall a. a -> Maybe a
Prelude.Just (Key
"eventType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eventType),
forall a. a -> Maybe a
Prelude.Just (Key
"sentAt" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
sentAt)
]
)