<?php
namespace App\Entity\Domains;
use App\Entity\BaseEntity;
use App\Entity\Generic\User;
use App\Entity\Telegram\AgentPublicBot\Bot;
use App\Repository\Domains\DomainRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
#[ORM\Entity(repositoryClass: DomainRepository::class)]
class Domain extends BaseEntity
{
#[ORM\Id]
#[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: UuidGenerator::class)]
private ?string $id = null;
#[ORM\Column(length: 255)]
private ?string $address = null;
#[ORM\ManyToOne(inversedBy: 'domains')]
#[ORM\JoinColumn(nullable: false)]
private ?User $owner = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tgContact = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tgChannle = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $wallpaper = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $appName = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ns1 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ns2 = null;
#[ORM\OneToMany(mappedBy: 'domain', targetEntity: Bot::class)]
private Collection $bots;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logo = null;
#[ORM\Column]
private ?bool $isConnected = null;
public function __construct()
{
parent::__construct();
$this->setIsConnected(0);
$this->bots = new ArrayCollection();
}
public function getNiceNs()
{
return 'NS1 : '.$this->getNs1().'<br>'.'NS2 : '.$this
->getNs2();
}
public function __toString():string
{
return $this->getAddress();
}
public function getId(): ?string
{
return $this->id;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): static
{
$this->address = $address;
return $this;
}
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): static
{
$this->owner = $owner;
return $this;
}
public function getTgContact(): ?string
{
return $this->tgContact;
}
public function setTgContact(?string $tgContact): static
{
$this->tgContact = $tgContact;
return $this;
}
public function getTgChannle(): ?string
{
return $this->tgChannle;
}
public function setTgChannle(?string $tgChannle): static
{
$this->tgChannle = $tgChannle;
return $this;
}
public function getWallpaper(): ?string
{
return $this->wallpaper;
}
public function setWallpaper(?string $wallpaper): static
{
$this->wallpaper = $wallpaper;
return $this;
}
public function getAppName(): ?string
{
return $this->appName;
}
public function setAppName(?string $appName): static
{
$this->appName = $appName;
return $this;
}
public function getNs1(): ?string
{
return $this->ns1;
}
public function setNs1(?string $ns1): static
{
$this->ns1 = $ns1;
return $this;
}
public function getNs2(): ?string
{
return $this->ns2;
}
public function setNs2(?string $ns2): static
{
$this->ns2 = $ns2;
return $this;
}
/**
* @return Collection<int, Bot>
*/
public function getBots(): Collection
{
return $this->bots;
}
public function addBot(Bot $bot): static
{
if (!$this->bots->contains($bot)) {
$this->bots->add($bot);
$bot->setDomain($this);
}
return $this;
}
public function removeBot(Bot $bot): static
{
if ($this->bots->removeElement($bot)) {
// set the owning side to null (unless already changed)
if ($bot->getDomain() === $this) {
$bot->setDomain(null);
}
}
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): static
{
$this->logo = $logo;
return $this;
}
public function isIsConnected(): ?bool
{
return $this->isConnected;
}
public function setIsConnected(bool $isConnected): static
{
$this->isConnected = $isConnected;
return $this;
}
}