<?php
namespace App\Entity;
use App\Utility\ReflectionHelper;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* Usage Event: track what users do in order to decide how the platform presentation or behaviour should change for them.
*
* While Business-, Application-, and Webrequest-Events are tracked for statistical use in the Data Warehouse, Usage
* Events are collected to keep track of how a given user uses our platform, because the behaviour of a user can change
* the behaviour of our software. Example: if a user has seen the recurrent job editor at least once, then stop showing
* them an info box related to recurrent jobs on the Dashboard.
*
* The big advantage of this event format is that it is very lean in terms of storage space - for every combination
* of user<->eventType, only one database row is needed; no matter how often event X is tracked for user Y,
* this one row of information is sufficient to answer the questions "how often did the event occur?" and
* "when was the last time the event occured?".
*
* @see ActivityMonitoringEvent for an extended explanation and a comparison with Activity Monitoring Events
*
* @ORM\Entity()
*
* @ORM\Table(
* name="usage_events"
* )
*/
class UsageEvent
{
public const EVENT_TYPE_USER_HAS_SEEN_JOB_EDITOR = 0;
public const EVENT_TYPE_USER_HAS_SENT_MULTIPLE_MESSAGES = 1;
public const EVENT_TYPE_USER_HAS_COMPLETED_BASE_PROFILE = 2;
public const EVENT_TYPE_USER_HAS_COMPLETED_EXTENDED_PROFILE = 3;
public const EVENT_TYPE_USER_HAS_COMPLETED_SUBSCRIPTION = 4;
public const EVENT_TYPE_USER_HAS_SEEN_SUBSCRIPTION_PAGE = 5;
public const EVENT_TYPE_USER_RATES_POSITIVE = 6;
public const EVENT_TYPE_USER_HAS_RATED = 7;
public const EVENT_TYPE_USER_HAS_CLICKED_RATING_LINK = 8;
public const EVENT_TYPE_USER_RECEIVED_FIVE_MESSAGES_EXCLUDING_JOBRADAR = 9;
public const EVENT_TYPE_JOBSEEKER_HAS_USED_SEARCH_FOR_RECURRENT_JOBS = 10;
public const EVENT_TYPE_JOBSEEKER_HAS_CLICKED_DETAIL_VIEW_OF_RECURRENT_JOB = 11;
public const EVENT_TYPE_JOBSEEKER_HAS_CLICKED_PHONE_BUTTON = 12;
public const EVENT_TYPE_USER_REACTED_TO_JOBRADAR = 13;
public const EVENT_TYPE_JOBSEEKER_SENT_MESSAGE = 14;
public const EVENT_TYPE_JOBOFFERER_SENT_MESSAGE = 15;
public const EVENT_TYPE_JOBOFFERER_CLICKED_SHARE_RECURRENT_JOB_ICON = 16;
public const EVENT_TYPE_USER_HAS_ADDED_PROFILE_PICTURE = 17;
public const EVENT_TYPE_USER_SENT_CONVERSATION_MESSAGE = 18;
public const EVENT_TYPE_USER_HAS_BEEN_INFORMED_ABOUT_PAYMENT_ESCALATED = 19;
public const EVENT_TYPE_USER_HAS_DELETED_PROFILE_PICTURE = 20;
public const EVENT_TYPE_NEW_USER_HAS_CONFIRMED_ACCOUNT = 21;
public const EVENT_TYPE_JOBOFFERER_HAS_USED_SEARCH_FOR_WANTED_JOBS = 22;
public const EVENT_TYPE_JOBOFFERER_HAS_CLICKED_DETAIL_VIEW_OF_WANTED_JOB = 23;
public const EVENT_TYPE_JOBOFFERER_HAS_CLICKED_PHONE_BUTTON = 24;
public const EVENT_TYPE_JOBSEEKER_CLICKED_SHARE_WANTED_JOB_ICON = 25;
public const EVENT_TYPE_GG_USER_HAS_LOGGED_IN = 26;
public const EVENT_TYPE_USER_HAS_RECEIVED_CANCELLATION_EMAIL = 27;
public const EVENT_TYPE_USER_HAS_CLICKED_JOBLIFT_JOBOFFER = 28;
public const EVENT_TYPE_WISAG_WAS_INFORMED_ABOUT_PREMIUM_MESSAGES = 29;
public const EVENT_TYPE_USER_HAS_GOT_SELFDESCRIPTION_PROPOSAL = 30;
public const EVENT_TYPE_USER_HAS_CHANGED_SELFDESCRIPTION_PROPOSAL = 31;
public const EVENT_TYPE_NEW_GERMAN_PERSONNEL_BILLED_JOB = 32;
public const EVENT_TYPE_EXTERNAL_PARTNER_RECURRENT_JOB_HAS_BEEN_PROLONGED = 33;
public const EVENT_TYPE_USER_HAS_BEEN_INFORMED_ABOUT_RECURRENT_JOBS_BELONGING_TO_JOBOO_GMBH = 34;
public const EVENT_TYPE_USER_HAS_REQUESTED_MYDAYS_VOUCHER = 35;
public const EVENT_TYPE_USER_HAS_VISITED_EXTERNAL_JOBOFFER = 36;
public const EVENT_TYPE_JOBSEEKER_HAS_CLICKED_PHONE_BUTTON_IN_RECURRENT_JOBS_SEARCH = 37;
public const EVENT_TYPE_JOBSEEKER_HAS_CLICKED_PHONE_BUTTON_IN_RECURRENT_JOBS_SEARCH_ALL_JOBS = 38;
public const EVENT_TYPE_JOBOFFERER_GOT_75_PERCENT_DISCOUNT_CODE = 39;
public const EVENT_TYPE_JOBOFFERER_GOT_FREE_MONTH_CODE = 40;
public const EVENT_TYPE_USER_SAW_MEMBERSHIP_MODAL = 41;
public const EVENT_TYPE_USER_HAS_BEEN_SENT_GOOGLE_RATING_REQUEST = 42;
public const EVENT_TYPE_USER_HAS_BEEN_INFORMED_ABOUT_SCHEDULING_STATUS_CHANGE = 43;
/**
* @ORM\Id
*
* @ORM\ManyToOne(targetEntity="App\Entity\User", cascade={"persist"})
*
* @ORM\JoinColumn(name="users_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
private User $user;
public function setUser(User $user): void
{
$this->user = $user;
}
public function getUser(): User
{
return $this->user;
}
/**
* @ORM\Id
*
* @ORM\Column(name="event_type", type="smallint", nullable=false)
*/
private int $eventType;
/**
* @throws Exception
*/
public function setEventType(int $eventType): void
{
if (!ReflectionHelper::hasConstWithValue(self::class, 'EVENT_TYPE_', $eventType)) {
throw new Exception('Value ' . $eventType . ' not allowed for eventType.');
}
$this->eventType = $eventType;
}
public function getEventType(): int
{
return $this->eventType;
}
/**
* @ORM\Column(name="last_occurred_at", type="datetime", nullable=false)
*/
private DateTime $lastOccurredAt;
public function getLastOccurredAt(): DateTime
{
return $this->lastOccurredAt;
}
public function setLastOccurredAt(DateTime $lastOccurredAt)
{
$this->lastOccurredAt = $lastOccurredAt;
}
/**
* @ORM\Column(name="number_of_occurrences", type="integer", nullable=false)
*/
private int $numberOfOccurrences;
public function setNumberOfOccurrences(int $numberOfOccurrences): void
{
$this->numberOfOccurrences = $numberOfOccurrences;
}
public function getNumberOfOccurrences(): int
{
return $this->numberOfOccurrences;
}
}