{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.PersonalizeEvents.Types.Event
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | Represents user interaction event information sent using the @PutEvents@
-- API.
--
-- /See:/ 'newEvent' smart constructor.
data Event = Event'
  { -- | An ID associated with the event. If an event ID is not provided, Amazon
    -- Personalize generates a unique ID for the event. An event ID is not used
    -- as an input to the model. Amazon Personalize uses the event ID to
    -- distinquish unique events. Any subsequent events after the first with
    -- the same event ID are not used in model training.
    Event -> Maybe Text
eventId :: Prelude.Maybe Prelude.Text,
    -- | The event value that corresponds to the @EVENT_VALUE@ field of the
    -- Interactions schema.
    Event -> Maybe Double
eventValue :: Prelude.Maybe Prelude.Double,
    -- | A list of item IDs that represents the sequence of items you have shown
    -- the user. For example, @[\"itemId1\", \"itemId2\", \"itemId3\"]@.
    -- Provide a list of items to manually record impressions data for an
    -- event. For more information on recording impressions data, see
    -- <https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data Recording impressions data>.
    Event -> Maybe (NonEmpty (Sensitive Text))
impression :: Prelude.Maybe (Prelude.NonEmpty (Data.Sensitive Prelude.Text)),
    -- | The item ID key that corresponds to the @ITEM_ID@ field of the
    -- Interactions schema.
    Event -> Maybe (Sensitive Text)
itemId :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | Contains information about the metric attribution associated with an
    -- event. For more information about metric attributions, see
    -- <https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html Measuring impact of recommendations>.
    Event -> Maybe MetricAttribution
metricAttribution :: Prelude.Maybe MetricAttribution,
    -- | A string map of event-specific data that you might choose to record. For
    -- example, if a user rates a movie on your site, other than movie ID
    -- (@itemId@) and rating (@eventValue@) , you might also send the number of
    -- movie ratings made by the user.
    --
    -- Each item in the map consists of a key-value pair. For example,
    --
    -- @{\"numberOfRatings\": \"12\"}@
    --
    -- The keys use camel case names that match the fields in the Interactions
    -- schema. In the above example, the @numberOfRatings@ would match the
    -- \'NUMBER_OF_RATINGS\' field defined in the Interactions schema.
    Event -> Maybe (Sensitive Text)
properties :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The ID of the list of recommendations that contains the item the user
    -- interacted with. Provide a @recommendationId@ to have Amazon Personalize
    -- implicitly record the recommendations you show your user as impressions
    -- data. Or provide a @recommendationId@ if you use a metric attribution to
    -- measure the impact of recommendations.
    --
    -- For more information on recording impressions data, see
    -- <https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data Recording impressions data>.
    -- For more information on creating a metric attribution see
    -- <https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html Measuring impact of recommendations>.
    Event -> Maybe Text
recommendationId :: Prelude.Maybe Prelude.Text,
    -- | The type of event, such as click or download. This property corresponds
    -- to the @EVENT_TYPE@ field of your Interactions schema and depends on the
    -- types of events you are tracking.
    Event -> Text
eventType :: Prelude.Text,
    -- | The timestamp (in Unix time) on the client side when the event occurred.
    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)

-- |
-- Create a value of 'Event' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'eventId', 'event_eventId' - An ID associated with the event. If an event ID is not provided, Amazon
-- Personalize generates a unique ID for the event. An event ID is not used
-- as an input to the model. Amazon Personalize uses the event ID to
-- distinquish unique events. Any subsequent events after the first with
-- the same event ID are not used in model training.
--
-- 'eventValue', 'event_eventValue' - The event value that corresponds to the @EVENT_VALUE@ field of the
-- Interactions schema.
--
-- 'impression', 'event_impression' - A list of item IDs that represents the sequence of items you have shown
-- the user. For example, @[\"itemId1\", \"itemId2\", \"itemId3\"]@.
-- Provide a list of items to manually record impressions data for an
-- event. For more information on recording impressions data, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data Recording impressions data>.
--
-- 'itemId', 'event_itemId' - The item ID key that corresponds to the @ITEM_ID@ field of the
-- Interactions schema.
--
-- 'metricAttribution', 'event_metricAttribution' - Contains information about the metric attribution associated with an
-- event. For more information about metric attributions, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html Measuring impact of recommendations>.
--
-- 'properties', 'event_properties' - A string map of event-specific data that you might choose to record. For
-- example, if a user rates a movie on your site, other than movie ID
-- (@itemId@) and rating (@eventValue@) , you might also send the number of
-- movie ratings made by the user.
--
-- Each item in the map consists of a key-value pair. For example,
--
-- @{\"numberOfRatings\": \"12\"}@
--
-- The keys use camel case names that match the fields in the Interactions
-- schema. In the above example, the @numberOfRatings@ would match the
-- \'NUMBER_OF_RATINGS\' field defined in the Interactions schema.
--
-- 'recommendationId', 'event_recommendationId' - The ID of the list of recommendations that contains the item the user
-- interacted with. Provide a @recommendationId@ to have Amazon Personalize
-- implicitly record the recommendations you show your user as impressions
-- data. Or provide a @recommendationId@ if you use a metric attribution to
-- measure the impact of recommendations.
--
-- For more information on recording impressions data, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data Recording impressions data>.
-- For more information on creating a metric attribution see
-- <https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html Measuring impact of recommendations>.
--
-- 'eventType', 'event_eventType' - The type of event, such as click or download. This property corresponds
-- to the @EVENT_TYPE@ field of your Interactions schema and depends on the
-- types of events you are tracking.
--
-- 'sentAt', 'event_sentAt' - The timestamp (in Unix time) on the client side when the event occurred.
newEvent ::
  -- | 'eventType'
  Prelude.Text ->
  -- | 'sentAt'
  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_
    }

-- | An ID associated with the event. If an event ID is not provided, Amazon
-- Personalize generates a unique ID for the event. An event ID is not used
-- as an input to the model. Amazon Personalize uses the event ID to
-- distinquish unique events. Any subsequent events after the first with
-- the same event ID are not used in model training.
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)

-- | The event value that corresponds to the @EVENT_VALUE@ field of the
-- Interactions schema.
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)

-- | A list of item IDs that represents the sequence of items you have shown
-- the user. For example, @[\"itemId1\", \"itemId2\", \"itemId3\"]@.
-- Provide a list of items to manually record impressions data for an
-- event. For more information on recording impressions data, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data Recording impressions data>.
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

-- | The item ID key that corresponds to the @ITEM_ID@ field of the
-- Interactions schema.
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

-- | Contains information about the metric attribution associated with an
-- event. For more information about metric attributions, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html Measuring impact of recommendations>.
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)

-- | A string map of event-specific data that you might choose to record. For
-- example, if a user rates a movie on your site, other than movie ID
-- (@itemId@) and rating (@eventValue@) , you might also send the number of
-- movie ratings made by the user.
--
-- Each item in the map consists of a key-value pair. For example,
--
-- @{\"numberOfRatings\": \"12\"}@
--
-- The keys use camel case names that match the fields in the Interactions
-- schema. In the above example, the @numberOfRatings@ would match the
-- \'NUMBER_OF_RATINGS\' field defined in the Interactions schema.
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

-- | The ID of the list of recommendations that contains the item the user
-- interacted with. Provide a @recommendationId@ to have Amazon Personalize
-- implicitly record the recommendations you show your user as impressions
-- data. Or provide a @recommendationId@ if you use a metric attribution to
-- measure the impact of recommendations.
--
-- For more information on recording impressions data, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/recording-events.html#putevents-including-impressions-data Recording impressions data>.
-- For more information on creating a metric attribution see
-- <https://docs.aws.amazon.com/personalize/latest/dg/measuring-recommendation-impact.html Measuring impact of recommendations>.
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)

-- | The type of event, such as click or download. This property corresponds
-- to the @EVENT_TYPE@ field of your Interactions schema and depends on the
-- types of events you are tracking.
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)

-- | The timestamp (in Unix time) on the client side when the event occurred.
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)
          ]
      )