<?php
declare(strict_types=1);
namespace JanusHercules\IndeedCampaignManagement\Domain\Entity;
use App\Entity\RecurrentJob;
use App\Utility\DatabaseIdGenerator;
use App\Utility\DateTimeUtility;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use JanusHercules\IndeedCampaignManagement\Domain\Dto\RecurrentJobInfoDto;
#[ORM\Entity]
#[ORM\Table(name: 'icm_campaign_content_snapshots')]
class CampaignContentSnapshot
{
/**
* @throws Exception
*/
public function __construct(
RecurrentJobInfoDto $recurrentJobInfo,
bool $recurrentJobNoLongerExists = false,
bool $recurrentJobNoLongerProvided = false
) {
$this->createdAt = DateTimeUtility::createDateTimeUtc();
$this->recurrentJobCreatedAt = $recurrentJobInfo->createdAt;
$this->recurrentJobId = $recurrentJobInfo->recurrentJobId;
$this->recurrentJobUserId = $recurrentJobInfo->userId;
$this->recurrentJobUserEmail = $recurrentJobInfo->userEmail;
$this->recurrentJobStatus = $recurrentJobInfo->status;
$this->recurrentJobJoboffererProfileBusinessName = $recurrentJobInfo->joboffererProfileBusinessName;
$this->recurrentJobCustomerInternalId = $recurrentJobInfo->customerInternalId;
$this->title = $recurrentJobInfo->title;
$this->description = $recurrentJobInfo->description;
$this->additionalDescription = $recurrentJobInfo->additionalDescription;
$this->selfdescription = $recurrentJobInfo->selfdescription;
$this->employmentTypes = json_encode($recurrentJobInfo->employmentTypes) ?: null;
$this->requiredExperience = $recurrentJobInfo->requiredExperience;
$this->address = $recurrentJobInfo->address;
$this->city = $recurrentJobInfo->city;
$this->zipcode = $recurrentJobInfo->zipcode;
$this->bundesland = $recurrentJobInfo->bundesland;
$this->occupationalFieldSearchterm = $recurrentJobInfo->occupationalFieldSearchterm;
$this->hasActiveSelfServiceTrafficCampaign = $recurrentJobInfo->hasActiveSelfServiceTrafficCampaign;
$this->userHasActiveHigherPricedFlexMembership = $recurrentJobInfo->userHasActiveHigherPricedFlexMembership;
$this->isBlacklistedForIndeed = $recurrentJobInfo->isBlacklistedForIndeed;
$this->isProfilePaused = $recurrentJobInfo->isProfilePaused;
$this->isCustomerReleasedForIndeed = $recurrentJobInfo->isCustomerReleasedForIndeed;
$this->inFeedIndeedStatus = $recurrentJobInfo->inFeedIndeedStatus;
$this->xmlFeedCategory = $recurrentJobInfo->xmlFeedCategory;
$this->recurrentJobNoLongerExists = $recurrentJobNoLongerExists;
$this->recurrentJobNoLongerProvided = $recurrentJobNoLongerProvided;
}
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
#[ORM\Column(
type : Types::GUID,
unique: true
)]
private ?string $id = null;
public function getId(): ?string
{
return $this->id;
}
#[ORM\Column(
type : Types::DATETIME_MUTABLE,
nullable: false
)]
private DateTime $createdAt;
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
#[ORM\Column(
type : Types::DATETIME_MUTABLE,
nullable: false
)]
private DateTime $recurrentJobCreatedAt;
public function getRecurrentJobCreatedAt(): DateTime
{
return $this->recurrentJobCreatedAt;
}
#[ORM\Column(
type : Types::GUID,
nullable: false
)]
private string $recurrentJobId;
public function getRecurrentJobId(): string
{
return $this->recurrentJobId;
}
#[ORM\Column(
type : Types::GUID,
nullable: false
)]
private string $recurrentJobUserId;
public function getRecurrentJobUserId(): string
{
return $this->recurrentJobUserId;
}
#[ORM\Column(
type : Types::STRING,
nullable: false,
)]
private string $recurrentJobUserEmail;
public function getRecurrentJobUserEmail(): string
{
return $this->recurrentJobUserEmail;
}
#[ORM\Column(
type : Types::INTEGER,
nullable: false,
options : ['default' => RecurrentJob::STATUS_ACTIVE]
)]
private int $recurrentJobStatus;
public function getRecurrentJobStatus(): int
{
return $this->recurrentJobStatus;
}
#[ORM\Column(
type : Types::STRING,
nullable: true,
)]
private ?string $recurrentJobJoboffererProfileBusinessName;
public function getRecurrentJobJoboffererProfileBusinessName(): ?string
{
return $this->recurrentJobJoboffererProfileBusinessName;
}
#[ORM\Column(
type : Types::STRING,
nullable: true,
)]
private ?string $recurrentJobCustomerInternalId;
public function getRecurrentJobCustomerInternalId(): ?string
{
return $this->recurrentJobCustomerInternalId;
}
#[ORM\Column(
type : Types::STRING,
nullable: false,
)]
private string $zipcode;
public function getZipcode(): string
{
return $this->zipcode;
}
#[ORM\Column(
type : Types::STRING,
nullable: false,
)]
private string $occupationalFieldSearchterm;
public function getOccupationalFieldSearchterm(): string
{
return $this->occupationalFieldSearchterm;
}
#[ORM\Column(
type : Types::BOOLEAN,
nullable: false,
options : ['default' => false]
)]
private bool $recurrentJobNoLongerExists;
public function getRecurrentJobNoLongerExists(): bool
{
return $this->recurrentJobNoLongerExists;
}
public function setRecurrentJobNoLongerExists(bool $recurrentJobNoLongerExists): void
{
$this->recurrentJobNoLongerExists = $recurrentJobNoLongerExists;
}
#[ORM\Column(
type : Types::BOOLEAN,
nullable: false,
options : ['default' => false]
)]
private bool $recurrentJobNoLongerProvided;
public function getRecurrentJobNoLongerProvided(): bool
{
return $this->recurrentJobNoLongerProvided;
}
public function setRecurrentJobNoLongerProvided(bool $recurrentJobNoLongerProvided): void
{
$this->recurrentJobNoLongerProvided = $recurrentJobNoLongerProvided;
}
#[ORM\Column(name: 'title', type: Types::STRING, nullable: true)]
private ?string $title;
public function getTitle(): ?string
{
return $this->title;
}
#[ORM\Column(name: 'description', type: Types::TEXT, nullable: true)]
private ?string $description;
public function getDescription(): ?string
{
return $this->description;
}
#[ORM\Column(name: 'additional_description', type: Types::TEXT, nullable: true)]
private ?string $additionalDescription;
public function getAdditionalDescription(): ?string
{
return $this->additionalDescription;
}
#[ORM\Column(name: 'selfdescription', type: Types::TEXT, nullable: true)]
private ?string $selfdescription;
public function getSelfdescription(): ?string
{
return $this->selfdescription;
}
#[ORM\Column(name: 'employment_types', type: Types::JSON, nullable: true)]
private ?string $employmentTypes;
/**
* @return string[]|null
*/
public function getEmploymentTypes(): ?array
{
if ($this->employmentTypes === null) {
return null;
}
$decoded = json_decode($this->employmentTypes, true);
return is_array($decoded) ? $decoded : null;
}
#[ORM\Column(name: 'required_experience', type: Types::INTEGER, nullable: true)]
private ?int $requiredExperience;
public function getRequiredExperience(): ?int
{
return $this->requiredExperience;
}
#[ORM\Column(name: 'address', type: Types::STRING, nullable: true)]
private ?string $address;
public function getAddress(): ?string
{
return $this->address;
}
#[ORM\Column(name: 'city', type: Types::STRING, nullable: true)]
private ?string $city;
public function getCity(): ?string
{
return $this->city;
}
#[ORM\Column(name: 'bundesland', type: Types::STRING, nullable: true)]
private ?string $bundesland;
public function getBundesland(): ?string
{
return $this->bundesland;
}
#[ORM\Column(
type : Types::BOOLEAN,
nullable: false,
options : ['default' => false]
)]
private bool $hasActiveSelfServiceTrafficCampaign;
public function hasActiveSelfServiceTrafficCampaign(): bool
{
return $this->hasActiveSelfServiceTrafficCampaign;
}
#[ORM\Column(
name : 'user_has_active_higher_priced_flex_membership',
type : Types::BOOLEAN,
nullable: false,
options : ['default' => false]
)]
private bool $userHasActiveHigherPricedFlexMembership;
public function userHasActiveHigherPricedFlexMembership(): bool
{
return $this->userHasActiveHigherPricedFlexMembership;
}
#[ORM\Column(
type : Types::BOOLEAN,
nullable: false,
options : ['default' => false]
)]
private bool $isBlacklistedForIndeed;
public function isBlacklistedForIndeed(): bool
{
return $this->isBlacklistedForIndeed;
}
#[ORM\Column(
type : Types::BOOLEAN,
nullable: false,
options : ['default' => false]
)]
private bool $isProfilePaused;
public function isProfilePaused(): bool
{
return $this->isProfilePaused;
}
#[ORM\Column(
type : Types::BOOLEAN,
nullable: true
)]
private ?bool $isCustomerReleasedForIndeed;
public function isCustomerReleasedForIndeed(): ?bool
{
return $this->isCustomerReleasedForIndeed;
}
#[ORM\Column(
type : Types::STRING,
nullable: true
)]
private ?string $inFeedIndeedStatus;
public function getInFeedIndeedStatus(): ?string
{
return $this->inFeedIndeedStatus;
}
#[ORM\Column(
type : Types::STRING,
nullable: true
)]
private ?string $xmlFeedCategory;
public function getXmlFeedCategory(): ?string
{
return $this->xmlFeedCategory;
}
}