<?php
namespace App\Entity;
use App\Dictionary\MailProviderStatus;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
/**
* @ORM\Table("MailProvider")
*
* @ORM\HasLifecycleCallbacks()
*
* @ORM\Entity(repositoryClass="App\Repository\MailProviderRepository")
*/
class MailProvider
{
/**
* @Groups({"adminindex"})
*
* @ORM\Id()
*
* @ORM\GeneratedValue()
*
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Groups({"adminindex"})
*
* @ORM\Column(type="string", length=100, unique=true)
*/
private $name;
/**
* @Groups({"admindetail"})
*
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $contact_phone;
/**
* @Groups({"admindetail"})
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contact_url;
/**
* @Groups({"admindetail"})
*
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $contact_email;
/**
* @Groups({"admindetail"})
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $guideline_url;
/**
* @Groups({"adminindex"})
*
* @ORM\Column(name="bounceStatus", type="smallint")
*/
private $bounceStatus;
/**
* @Groups({"admindetail"})
*
* @ORM\Column(type="text")
*/
private $domains;
/**
* @Groups({"adminindex"})
*
* @ORM\Column(name="createdAt", type="datetime")
*/
private $created_at;
/**
* @Groups({"adminindex"})
*/
private int $bounceCount = -1;
/**
* @Groups({"adminindex"})
* @ORM\Column(name="accountCount", type="integer")
*/
private int $accountCount = 0;
/**
* @Groups({"adminindex"})
*
* @ORM\Column(name="antiSpamLoginDelay", type="integer")
*/
private $antiSpamLoginDelay;
/**
* @ORM\PrePersist()
*/
public function prePersist()
{
$this->setCreatedAt(new \DateTime());
}
public function getId()
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getContactPhone(): ?string
{
return $this->contact_phone;
}
public function setContactPhone(?string $contactPhone): self
{
$this->contact_phone = $contactPhone;
return $this;
}
public function getContactUrl(): ?string
{
return $this->contact_url;
}
public function setContactUrl(?string $contact_url): self
{
$this->contact_url = $contact_url;
return $this;
}
public function getContactEmail(): ?string
{
return $this->contact_email;
}
public function setContactEmail(?string $contact_email): self
{
$this->contact_email = $contact_email;
return $this;
}
public function getGuidelineUrl(): ?string
{
return $this->guideline_url;
}
public function setGuidelineUrl(?string $guideline_url): self
{
$this->guideline_url = $guideline_url;
return $this;
}
public function getBounceStatus(): ?int
{
return $this->bounceStatus;
}
public function setBounceStatus(int $bounceStatus): self
{
$this->bounceStatus = $bounceStatus;
return $this;
}
public function getDomains(): ?string
{
return $this->domains;
}
public function setDomains(string $domains): self
{
$this->domains = $domains;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
/**
* @return int[]
*/
public static function getBounceStates(): array
{
return [
MailProviderStatus::OK,
MailProviderStatus::BLOCKED,
MailProviderStatus::TEMP_ISSUES,
MailProviderStatus::MOGELMAIL,
MailProviderStatus::SPAMTRAP,
MailProviderStatus::TRASHMAIL,
MailProviderStatus::ANTI_SPAM,
];
}
public static function getBounceStateChoices(): array
{
$keys = self::getBounceStates();
return array_combine($keys, [
'OK',
'Blockiert',
'Temporäres Problem',
'Fehler lt. mogelmail.de',
'Spam Trap',
'Trashmail Anbieter',
'Double Opt-In',
]);
}
/**
* @return mixed
*/
public function getAntiSpamLoginDelay(): int {
return (int)$this->antiSpamLoginDelay;
}
/**
* @param mixed $antiSpamLoginDelay
* @return self
*/
public function setAntiSpamLoginDelay(?int $antiSpamLoginDelay): self {
$this->antiSpamLoginDelay = $antiSpamLoginDelay;
return $this;
}
/**
* @return int
*/
public function getBounceCount(): int {
return $this->bounceCount;
}
/**
* @param int $bounceCount
* @return self
*/
public function setBounceCount(int $bounceCount): self {
$this->bounceCount = $bounceCount;
return $this;
}
/**
* @return int
*/
public function getAccountCount(): int {
return $this->accountCount;
}
/**
* @param int $accountCount
* @return self
*/
public function setAccountCount(int $accountCount): self {
$this->accountCount = $accountCount;
return $this;
}
}