<?php
namespace App\Entity;
use App\Validator\Constraints\TelegramUsernameNotValid;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Embeddable]
final class Messengers
{
#[ORM\Column(name: 'messengers_telegram', type: 'boolean', nullable: true)]
protected ?bool $telegram;
#[ORM\Column(name: 'messengers_whatsapp', type: 'integer', nullable: true)]
protected ?bool $whatsApp;
#[ORM\Column(name: 'messengers_max', type: 'boolean', nullable: true)]
protected ?bool $max;
#[ORM\Column(name: 'messengers_telegram_username', type: 'string', length: 32, nullable: true)]
#[TelegramUsernameNotValid]
#[Groups(['preview', 'listing'])]
protected ?string $telegramUsername = null;
#[ORM\Column(name: 'messengers_max_url', type: 'string', length: 255, nullable: true)]
#[Groups(['preview', 'listing'])]
protected ?string $maxUrl = null;
public function __construct(
?bool $telegram,
?bool $whatsApp,
?string $telegramUsername,
?bool $max = null,
?string $maxUrl = null
)
{
$this->telegram = $telegram;
$this->whatsApp = $whatsApp;
$this->telegramUsername = $telegramUsername;
$this->max = $max;
$this->maxUrl = $maxUrl;
}
#[Groups(['preview', 'listing'])]
public function hasTelegram(): ?bool
{
return $this->telegram;
}
#[Groups(['preview', 'listing'])]
public function hasWhatsApp(): ?bool
{
return $this->whatsApp;
}
#[Groups(['preview', 'listing'])]
public function hasMax(): ?bool
{
return $this->max;
}
public function getTelegramUsername(): ?string
{
return $this->telegramUsername;
}
public function getMaxUrl(): ?string
{
return $this->maxUrl;
}
}