<?php
namespace App\Entity\ExternalPartner;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="external_partner_event_aggregations"
* )
*/
class ExternalPartnerEventAggregation
{
public const RESOLUTION_DAILY = 1;
public const RESOLUTION_WEEKLY = 2;
public const RESOLUTION_MONTHLY = 3;
public const RESOLUTION_ALLTIME = 4;
public const AGGREGATION_TYPE_RECURRENT_JOB_CREATED = 0;
public const AGGREGATION_TYPE_RECURRENT_JOB_UPDATED = 1;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL = 2;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_REGISTERED = 3;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_UNREGISTERED = 4;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_WITH_CV = 5;
public const AGGREGATION_TYPE_JOBRADAR_CREATED = 6;
public const AGGREGATION_TYPE_PREMIUM_JOBRADAR_CREATED = 7;
public const AGGREGATION_TYPE_RECURRENT_JOB_SHARE_PAGE_REQUESTED = 8;
public const AGGREGATION_TYPE_USER_CREATED = 9;
public const AGGREGATION_TYPE_RECURRENT_JOB_HAS_BEEN_PROLONGED = 10;
public const AGGREGATION_TYPE_RECURRENT_JOB_HAS_BEEN_REACTIVATED_BECAUSE_QUOTA_BECAME_AVAILABLE_AGAIN = 11;
public const AGGREGATION_TYPE_RECURRENT_JOB_HAS_BEEN_DEACTIVATED = 12;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED = 13;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_CONTENT_DISTRIBUTION_PARTNER = 14;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_JOBLIFT = 15;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_TALENTCOM = 16;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_JOBRAPIDO = 17;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_INDEED = 18;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_EBAY = 19;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_KIMETA = 20;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_STELLENONLINE = 21;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_GOOGLE_FOR_JOBS = 22;
public const AGGREGATION_TYPE_RECURRENT_JOB_HAS_BEEN_REACTIVATED_BECAUSE_RECURRENT_JOBS_LIMIT_HAS_CAPACITY_AGAIN = 23;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_AGENTUR_FUER_ARBEIT = 24;
public const AGGREGRATION_TYPE_FORWARDED_ON_PLATFORM_SITE_JOBOO = 25;
public const AGGREGRATION_TYPE_FORWARDED_ON_PLATFORM_SITE_JOBOO_ONLINE = 26;
public const AGGREGRATION_TYPE_FORWARDED_ON_PLATFORM_SITE_RECRUIT_DL = 27;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_CONTENT_DISTRIBUTION_PARTNER = 28;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_JOBLIFT = 29;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_TALENTCOM = 30;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_JOBRAPIDO = 31;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_INDEED = 32;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_EBAY = 33;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_KIMETA = 34;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_STELLENONLINE = 35;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_GOOGLE_FOR_JOBS = 36;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_AGENTUR_FUER_ARBEIT = 37;
public const AGGREGRATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_ON_PLATFORM_SITE_JOBOO = 38;
public const AGGREGRATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_ON_PLATFORM_SITE_JOBOO_ONLINE = 39;
public const AGGREGRATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_ON_PLATFORM_SITE_RECRUIT_DL = 40;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_FACEBOOK = 41;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_GOOGLE_ADS = 42;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_FACEBOOK = 43;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_GOOGLE_ADS = 44;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_MEINESTADT = 45;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_MEINESTADT = 46;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_JOBIJOBA = 47;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_JOBIJOBA = 48;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_WHATJOBS = 49;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_WHATJOBS = 50;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_JOOBLE = 51;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_JOOBLE = 52;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_CRITEO = 53;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_CRITEO = 54;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_PERSPECTIVE = 55;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_STEPSTONE = 56;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_STEPSTONE = 57;
public const AGGREGATION_TYPE_EXTENDED_APPLICATION_HAS_BEEN_CREATED_VIA_PERSOMATCH = 58;
public const AGGREGATION_TYPE_FORWARDED_TO_EXTERNAL_PARTNER_URL_VIA_PERSOMATCH = 59;
/**
* (Note that we use CET and CEST interchangeably here, because we mean the time in Germany, regardless of whether
* it's winter or summer time.).
*
* We normally store all timestamps in our DB tables as UTC date-times only. However, this is not possible here.
* The reason is that we need to report the aggregated values for a timezone. Because the
* "resolution starting at" info is not a discrete point in time which can later be recalculated
* safely to the corresponding point in time in any other timezone, we would end up with wrong data.
* Instead, the timestamp refers to the first timestamp of a whole day, week, or month.
*
* Sadly, we cannot store both timestamps together.
*
* Here's why: It's 22:59 o'clock in UTC and 23:59 o'clock in CET on January 1, 2021.
*
* The timestamps are thus: 2021-01-01 22:59:00 in UTC and 2021-01-01 23:59:00 in CET.
*
* A row is inserted or updated that says that the $numberOfOccurrences for $aggregationType X on that day is 10,
* like this:
*
* resolution=day
* aggregationType=X
* resolutionStartingAtUtc=2021-01-01 00:00:00
* resolutionStartingAtCet=2021-01-01 00:00:00
* numberOfOccurrences=10
*
* Here is what would happen 3 minutes later:
*
* It's now 23:02 o'clock on January 1, 2021 in UTC, but 00:02 o'clock in CET on January 2(!), 2021.
*
* The $numberOfOccurrences for UTC would need to be increased from 10 to 11, because the event occured while it
* was still January 1 in UTC.
*
* But if we would update the above row accordingly, like this:
*
* resolution=day
* aggregationType=X
* resolutionStartingAtUtc=2021-01-01 00:00:00
* resolutionStartingAtCet=2021-01-01 00:00:00
* numberOfOccurrences=11
*
* then the information is now correct for UTC, but incorrect for CET, because the 11th occurrence happened
* while it was already January 2 in CET.
*
* Thus, it would be correct to persist that
* the numberOfOccurrences=10 where resolutionStartingAtCet=2021-01-01 00:00:00,
* and numberOfOccurrences=1 where resolutionStartingAtCet=2021-01-02 00:00:00.
*
* If we have the UTC and CET timestamp together in one row, it is not possible to persist the data correctly.
*
* We therefore aggregate twice, with one row where the date-time is from UTC and one from CET.
*/
/**
* @ORM\Column(name="timezone", type="smallint", nullable=false)
*
* @ORM\Id
*/
private int $timezone;
/**
* @ORM\Column(name="resolution", type="smallint", nullable=false)
*
* @ORM\Id
*/
private int $resolution;
/**
* @ORM\Column(name="aggregation_type", type="smallint", nullable=false)
*
* @ORM\Id
*/
private int $aggregationType;
/**
* @ORM\Column(name="resolution_starting_at", type="datetime", nullable=false)
*
* @ORM\Id
*/
private DateTime $resolutionStartingAt;
/**
* @ORM\Column(name="integrated_external_partner_customer_id", type="guid", nullable=false)
*
* @ORM\Id
*/
protected string $integratedExternalPartnerCustomerId;
/**
* @ORM\Column(name="number_of_occurrences", type="integer", nullable=false)
*/
private int $numberOfOccurrences;
}