<?php
namespace App\Entity\ContentDistribution;
use App\Entity\ExternalPartner\IntegratedExternalPartnerCustomer;
use App\Utility\ReflectionHelper;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="integrated_external_partner_content_distribution_values"
* )
*/
class IntegratedExternalPartnerCustomerContentDistributionValue
{
public const NAME_MAX_USER_CLICKS_ON_RECURRENT_JOB_ON_INDEED_SITE_PER_MONTH_INDEED_AB_FEED = 'maxUserClicksOnRecurrentJobOnIndeedSitePerMonthABFeed';
public const NAME_MAX_USER_CLICKS_ON_RECURRENT_JOB_ON_INDEED_SITE_PER_MONTH_INDEED_C_FEED = 'maxUserClicksOnRecurrentJobOnIndeedSitePerMonthCFeed';
public const NAME_MAX_RECURRENT_JOBS_EBAY_FEED = 'maxRecurrentJobsEbayFeed';
public const NAME_BUSINESS_NAME_EBAY_FEED = 'businessNameEbayFeed';
public const NAME_RELEASED_FOR_TALENTCOM = 'releasedForTalentcom';
public const NAME_RELEASED_FOR_JOBLIFT = 'releasedForJoblift';
public const NAME_RELEASED_FOR_STELLENONLINE = 'releasedForStellenonline';
public const NAME_RELEASED_FOR_MEINESTADT = 'releasedForMeinestadt';
public const NAME_RELEASED_FOR_JOBIJOBA = 'releasedForJobijoba';
public const NAME_RELEASED_FOR_WHATJOBS = 'releasedForWhatjobs';
public const NAME_RELEASED_FOR_INDEED = 'releasedForIndeed';
public const NAME_RELEASED_FOR_AGENTURFUERARBEIT = 'releasedForAgenturfuerarbeit';
public const NAME_RELEASED_FOR_EBAY = 'releasedForEbay';
public const NAME_RELEASED_FOR_PERSOMATCH = 'releasedForPersomatch';
public const NAME_RELEASED_FOR_STEPSTONE = 'releasedForStepstone';
public const NAME_RELEASED_FOR_XING = 'releasedForXing';
public const NAME_KLEINANZEIGEN_IMAGE_EXISTS = 'kleinanzeigenImageExists';
public const NAME_RELEASED_FOR_JOOBLE = 'releasedForJooble';
public const NAME_CPC_TALENTCOM = 'cpcTalentcom';
public const NAME_CPC_JOBLIFT = 'cpcJoblift';
public const NAME_CPC_STELLENONLINE = 'cpcStellenonline';
public const NAME_CPC_MEINESTADT = 'cpcMeinestadt';
public const NAME_CPC_JOBIJOBA = 'cpcJobijoba';
public const NAME_CPC_WHATJOBS = 'cpcWhatjobs';
public const NAME_CPC_INDEED = 'cpcIndeed';
public const NAME_CPC_JOOBLE = 'cpcJooble';
public const NAME_CPC_STEPSTONE = 'cpcStepstone';
public const NAME_CPC_PERSOMATCH = 'cpcPersomatch';
public const NAME_CPC_XING = 'cpcXing';
public const NAME_MAX_RECURRENT_JOBS_INDEED_FEED = 'maxRecurrentJobsIndeedFeed';
public const TYPE_STRING = 0;
public const TYPE_FLOAT = 1;
public const TYPE_BOOL = 2;
public const NAMES_TO_TYPES = [
self::NAME_MAX_USER_CLICKS_ON_RECURRENT_JOB_ON_INDEED_SITE_PER_MONTH_INDEED_AB_FEED => self::TYPE_FLOAT,
self::NAME_MAX_USER_CLICKS_ON_RECURRENT_JOB_ON_INDEED_SITE_PER_MONTH_INDEED_C_FEED => self::TYPE_FLOAT,
self::NAME_MAX_RECURRENT_JOBS_EBAY_FEED => self::TYPE_FLOAT,
self::NAME_BUSINESS_NAME_EBAY_FEED => self::TYPE_STRING,
self::NAME_RELEASED_FOR_TALENTCOM => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_JOBLIFT => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_STELLENONLINE => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_MEINESTADT => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_JOBIJOBA => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_WHATJOBS => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_INDEED => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_AGENTURFUERARBEIT => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_EBAY => self::TYPE_BOOL,
self::NAME_CPC_INDEED => self::TYPE_FLOAT,
self::NAME_CPC_TALENTCOM => self::TYPE_FLOAT,
self::NAME_CPC_WHATJOBS => self::TYPE_FLOAT,
self::NAME_CPC_JOBIJOBA => self::TYPE_FLOAT,
self::NAME_CPC_JOBLIFT => self::TYPE_FLOAT,
self::NAME_CPC_STELLENONLINE => self::TYPE_FLOAT,
self::NAME_CPC_MEINESTADT => self::TYPE_FLOAT,
self::NAME_KLEINANZEIGEN_IMAGE_EXISTS => self::TYPE_BOOL,
self::NAME_MAX_RECURRENT_JOBS_INDEED_FEED => self::TYPE_FLOAT,
self::NAME_CPC_JOOBLE => self::TYPE_FLOAT,
self::NAME_RELEASED_FOR_JOOBLE => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_PERSOMATCH => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_STEPSTONE => self::TYPE_BOOL,
self::NAME_RELEASED_FOR_XING => self::TYPE_BOOL,
self::NAME_CPC_STEPSTONE => self::TYPE_FLOAT,
self::NAME_CPC_PERSOMATCH => self::TYPE_FLOAT,
self::NAME_CPC_XING => self::TYPE_FLOAT
];
/**
* @ORM\Id
*
* @ORM\Column(type="string", nullable=false)
*/
private string $name;
/**
* @ORM\Column(type="string", name="string_value", nullable=true, length=4096)
*/
private ?string $stringValue;
/**
* @ORM\Column(type="float", name="float_value", nullable=true)
*/
private ?float $floatValue;
/**
* @ORM\Column(type="boolean", name="bool_value", nullable=true)
*/
private ?bool $boolValue;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ExternalPartner\IntegratedExternalPartnerCustomer", inversedBy="contentDistributionValues", cascade={"persist"})
*
* @ORM\Id
*
* @ORM\JoinColumn(name="integrated_external_partner_customer_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
private IntegratedExternalPartnerCustomer $integratedExternalPartnerCustomer;
/** @throws Exception */
public static function createWithStringValue(
IntegratedExternalPartnerCustomer $integratedExternalPartnerCustomer,
string $name,
string $stringValue
): self {
if (!ReflectionHelper::hasConstWithValue(self::class, 'NAME_', $name)) {
throw new Exception("Not a name: '{$name}'.");
}
if (self::NAMES_TO_TYPES[$name] !== self::TYPE_STRING) {
throw new Exception("Value type for name {$name} cannot be 'string'.");
}
$distributionValue = new self();
$distributionValue->integratedExternalPartnerCustomer = $integratedExternalPartnerCustomer;
$distributionValue->name = $name;
$distributionValue->stringValue = $stringValue;
return $distributionValue;
}
/** @throws Exception */
public static function createWithFloatValue(
IntegratedExternalPartnerCustomer $integratedExternalPartnerCustomer,
string $name,
float $floatValue
): self {
$distributionValue = new self();
$distributionValue->integratedExternalPartnerCustomer = $integratedExternalPartnerCustomer;
$distributionValue->name = $name;
$distributionValue->floatValue = $floatValue;
return $distributionValue;
}
/** @throws Exception */
public static function createWithBoolValue(
IntegratedExternalPartnerCustomer $integratedExternalPartnerCustomer,
string $name,
float $boolValue
): self {
if (!ReflectionHelper::hasConstWithValue(self::class, 'NAME_', $name)) {
throw new Exception("Not a name: '{$name}'.");
}
if (self::NAMES_TO_TYPES[$name] !== self::TYPE_BOOL) {
throw new Exception("Value type for name {$name} cannot be 'float'.");
}
$distributionValue = new self();
$distributionValue->integratedExternalPartnerCustomer = $integratedExternalPartnerCustomer;
$distributionValue->name = $name;
$distributionValue->boolValue = $boolValue;
return $distributionValue;
}
public function getName(): string
{
return $this->name;
}
/** @throws Exception */
public function setStringValue(?string $stringValue): void
{
if (self::NAMES_TO_TYPES[$this->name] !== self::TYPE_STRING) {
throw new Exception("Value type for name {$this->name} cannot be 'string'.");
}
$this->stringValue = $stringValue;
}
public function getStringValue(): ?string
{
return $this->stringValue;
}
/** @throws Exception */
public function setFloatValue(?float $floatValue): void
{
$this->floatValue = $floatValue;
}
public function getFloatValue(): ?float
{
return $this->floatValue;
}
/** @throws Exception */
public function setBoolValue(?bool $boolValue): void
{
if (self::NAMES_TO_TYPES[$this->name] !== self::TYPE_BOOL) {
throw new Exception("Value type for name {$this->name} cannot be 'bool'.");
}
$this->boolValue = $boolValue;
}
public function getBoolValue(): ?bool
{
return $this->boolValue;
}
public function getIntegratedExternalPartnerCustomer(): IntegratedExternalPartnerCustomer
{
return $this->integratedExternalPartnerCustomer;
}
}