<?php
namespace App\Entity\Gos;
use App\Entity\ContactSegmentationableInterface;
use App\Repository\Gos\FastLeadTemplateRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FastLeadTemplateRepository::class)
*/
class FastLeadTemplate implements ContactSegmentationableInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="integer")
*/
private $searchType;
/**
* @ORM\Column(type="boolean")
*/
private $isUserNeedsToBeActive;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $reginfoRule;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $productVariantRule;
/**
* @ORM\ManyToOne(targetEntity=LeadFormResponse::class)
* @ORM\JoinColumn(nullable=true)
*/
private $leadFormResponse;
/**
* @ORM\OneToMany(targetEntity=FastLead::class, mappedBy="fastLeadTemplate", orphanRemoval=true)
*/
private $fastLeads;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fromSource;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $actionNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $regInfo;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $afterSubmitMessage;
/**
* @ORM\ManyToOne(targetEntity=ProductVariant::class, inversedBy="fastLeadTemplates")
*/
private $productVariant;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $daysForFreeAccess;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $subtitle;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $footerText;
/**
* @ORM\ManyToMany(targetEntity=SalesManagoTagGroup::class, mappedBy="fastLeadTemplate")
*/
private $salesManagoTagGroups;
/**
* @ORM\ManyToMany(targetEntity=ContactSegmentation::class)
*/
private $contactSegmentations;
public function __construct()
{
$this->fastLeads = new ArrayCollection();
$this->salesManagoTagGroups = new ArrayCollection();
$this->contactSegmentations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSearchType(): ?int
{
return $this->searchType;
}
public function setSearchType(int $searchType): self
{
$this->searchType = $searchType;
return $this;
}
public function getIsUserNeedsToBeActive(): ?bool
{
return $this->isUserNeedsToBeActive;
}
public function setIsUserNeedsToBeActive(bool $isUserNeedsToBeActive): self
{
$this->isUserNeedsToBeActive = $isUserNeedsToBeActive;
return $this;
}
public function getReginfoRule(): ?string
{
return $this->reginfoRule;
}
public function setReginfoRule(?string $reginfoRule): self
{
$this->reginfoRule = $reginfoRule;
return $this;
}
public function getProductVariantRule(): ?string
{
return $this->productVariantRule;
}
public function setProductVariantRule(?string $productVariantRule): self
{
$this->productVariantRule = $productVariantRule;
return $this;
}
public function getLeadFormResponse(): ?LeadFormResponse
{
return $this->leadFormResponse;
}
public function setLeadFormResponse(?LeadFormResponse $leadFormResponse): self
{
$this->leadFormResponse = $leadFormResponse;
return $this;
}
/**
* @return Collection|FastLead[]
*/
public function getFastLeads(): Collection
{
return $this->fastLeads;
}
public function addFastLead(FastLead $fastLead): self
{
if (!$this->fastLeads->contains($fastLead)) {
$this->fastLeads[] = $fastLead;
$fastLead->setFastLeadTemplate($this);
}
return $this;
}
public function removeFastLead(FastLead $fastLead): self
{
if ($this->fastLeads->contains($fastLead)) {
$this->fastLeads->removeElement($fastLead);
// set the owning side to null (unless already changed)
if ($fastLead->getFastLeadTemplate() === $this) {
$fastLead->setFastLeadTemplate(null);
}
}
return $this;
}
public function getFromSource(): ?string
{
return $this->fromSource;
}
public function setFromSource(?string $fromSource): self
{
$this->fromSource = $fromSource;
return $this;
}
public function getActionNumber(): ?string
{
return $this->actionNumber;
}
public function setActionNumber(?string $actionNumber): self
{
$this->actionNumber = $actionNumber;
return $this;
}
public function getRegInfo(): ?string
{
return $this->regInfo;
}
public function setRegInfo(?string $regInfo): self
{
$this->regInfo = $regInfo;
return $this;
}
public function getAfterSubmitMessage(): ?string
{
return $this->afterSubmitMessage;
}
public function setAfterSubmitMessage(?string $afterSubmitMessage): self
{
$this->afterSubmitMessage = $afterSubmitMessage;
return $this;
}
public function getProductVariant(): ?ProductVariant
{
return $this->productVariant;
}
public function setProductVariant(?ProductVariant $productVariant): self
{
$this->productVariant = $productVariant;
return $this;
}
public function getDaysForFreeAccess(): ?int
{
return $this->daysForFreeAccess;
}
public function setDaysForFreeAccess(?int $daysForFreeAccess): self
{
$this->daysForFreeAccess = $daysForFreeAccess;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getFooterText(): ?string
{
return $this->footerText;
}
public function setFooterText(?string $footerText): self
{
$this->footerText = $footerText;
return $this;
}
/**
* @return Collection|SalesManagoTagGroup[]
*/
public function getSalesManagoTagGroups(): Collection
{
return $this->salesManagoTagGroups;
}
public function addSalesManagoTagGroup(SalesManagoTagGroup $salesManagoTagGroup): self
{
if (!$this->salesManagoTagGroups->contains($salesManagoTagGroup)) {
$this->salesManagoTagGroups[] = $salesManagoTagGroup;
$salesManagoTagGroup->addFastLeadTemplate($this);
}
return $this;
}
public function removeSalesManagoTagGroup(SalesManagoTagGroup $salesManagoTagGroup): self
{
if ($this->salesManagoTagGroups->contains($salesManagoTagGroup)) {
$this->salesManagoTagGroups->removeElement($salesManagoTagGroup);
$salesManagoTagGroup->removeFastLeadTemplate($this);
}
return $this;
}
/**
* @return Collection|ContactSegmentation[]
*/
public function getContactSegmentations(): Collection
{
return $this->contactSegmentations;
}
public function addContactSegmentation(ContactSegmentation $contactSegmentation): self
{
if (!$this->contactSegmentations->contains($contactSegmentation)) {
$this->contactSegmentations[] = $contactSegmentation;
}
return $this;
}
public function removeContactSegmentation(ContactSegmentation $contactSegmentation): self
{
if ($this->contactSegmentations->contains($contactSegmentation)) {
$this->contactSegmentations->removeElement($contactSegmentation);
}
return $this;
}
public function getSalesmanagoTags(): array
{
return array_values(
$this->contactSegmentations
->map(function (ContactSegmentation $seg) {
return $seg->getSalesmanagoTag();
})
->filter(function (?string $tag) {
return $tag !== null && $tag !== '';
})
->toArray()
);
}
public function getSalesManagoSourceTag(): ?string
{
return 'BASIC_FORM';
}
}