<?php
namespace App\Entity\Telegram\AgentPublicBot;
use App\Entity\BaseEntity;
use App\Entity\Domains\Domain;
use App\Entity\Generic\User;
use App\Entity\SubTransactions\ArzDigital;
use App\Entity\VPN\Service\Service;
use App\Repository\Telegram\AgentPublicBot\BotRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
#[ORM\Entity(repositoryClass: BotRepository::class)]
class Bot 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 $title = null;
#[ORM\Column(length: 255)]
private ?string $token = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ownerUserId = null;
#[ORM\ManyToOne(inversedBy: 'bots')]
#[ORM\JoinColumn(nullable: false)]
private ?User $owner = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $cardNumber = null;
#[ORM\Column]
private ?bool $forceJoinChannel = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $channelUserNAme = null;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: BotPlan::class)]
private Collection $botPlans;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: BotUser::class)]
private Collection $botUsers;
#[ORM\Column(length: 255, nullable: true)]
private ?string $supportUsername = null;
#[ORM\ManyToOne(inversedBy: 'bots')]
private ?Domain $domain = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logo = null;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: BotTransaction::class)]
private Collection $botTransactions;
#[ORM\Column(nullable: true)]
private ?int $channelMembers = null;
#[ORM\Column(nullable: true)]
private ?int $botServices = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $welcomeMessage = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $thanksMessage = null;
#[ORM\Column]
private ?bool $allowTest = null;
#[ORM\Column(nullable: true)]
private ?int $offPercent = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $walletAddress = null;
#[ORM\Column(type: Types::BIGINT, nullable: true)]
private ?string $minimumCardToCard = null;
#[ORM\OneToMany(mappedBy: 'creatorBot', targetEntity: Service::class)]
private Collection $services;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: BotCampaign::class)]
private Collection $botCampaigns;
#[ORM\Column]
private ?bool $isBotForWebsite = null;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: ArzDigital::class)]
private Collection $arzDigitals;
#[ORM\Column]
private ?bool $sentAutoMessages = null;
#[ORM\Column(nullable: true)]
private ?int $usersCount = null;
#[ORM\Column(nullable: true)]
private ?int $servicesCount = null;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: BotNotification::class)]
private Collection $botNotifications;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $adsNotTestedMessage = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $adsNotBoughtMessage = null;
#[ORM\OneToMany(mappedBy: 'bot', targetEntity: BotAnalytics::class)]
private Collection $botAnalytics;
public function __toString():string
{
return $this->getTitle();
}
public function __construct()
{
$this->setIsBotForWebsite(0);
parent::__construct();
$this->setForceJoinChannel(0);
$this->botPlans = new ArrayCollection();
$this->botUsers = new ArrayCollection();
$this->botTransactions = new ArrayCollection();
$this->setAllowTest(0);
$this->services = new ArrayCollection();
$this->botCampaigns = new ArrayCollection();
$this->arzDigitals = new ArrayCollection();
$this->setSentAutoMessages(0);
$this->botNotifications = new ArrayCollection();
$this->botAnalytics = new ArrayCollection();
}
public function usersCount():int
{
return count($this->getBotUsers());
}
public function getId(): ?string
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(string $token): static
{
$this->token = $token;
return $this;
}
public function getOwnerUserId(): ?string
{
return $this->ownerUserId;
}
public function setOwnerUserId(?string $ownerUserId): static
{
$this->ownerUserId = $ownerUserId;
return $this;
}
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): static
{
$this->owner = $owner;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getCardNumber(): ?string
{
return $this->cardNumber;
}
public function setCardNumber(?string $cardNumber): static
{
$this->cardNumber = $cardNumber;
return $this;
}
public function isForceJoinChannel(): ?bool
{
return $this->forceJoinChannel;
}
public function setForceJoinChannel(bool $forceJoinChannel): static
{
$this->forceJoinChannel = $forceJoinChannel;
return $this;
}
public function getChannelUserNAme(): ?string
{
return $this->channelUserNAme;
}
public function setChannelUserNAme(?string $channelUserNAme): static
{
$this->channelUserNAme = $channelUserNAme;
return $this;
}
/**
* @return Collection<int, BotPlan>
*/
public function getBotPlans(): Collection
{
return $this->botPlans;
}
public function addBotPlan(BotPlan $botPlan): static
{
if (!$this->botPlans->contains($botPlan)) {
$this->botPlans->add($botPlan);
$botPlan->setBot($this);
}
return $this;
}
public function removeBotPlan(BotPlan $botPlan): static
{
if ($this->botPlans->removeElement($botPlan)) {
// set the owning side to null (unless already changed)
if ($botPlan->getBot() === $this) {
$botPlan->setBot(null);
}
}
return $this;
}
/**
* @return Collection<int, BotUser>
*/
public function getBotUsers(): Collection
{
return $this->botUsers;
}
public function addBotUser(BotUser $botUser): static
{
if (!$this->botUsers->contains($botUser)) {
$this->botUsers->add($botUser);
$botUser->setBot($this);
}
return $this;
}
public function removeBotUser(BotUser $botUser): static
{
if ($this->botUsers->removeElement($botUser)) {
// set the owning side to null (unless already changed)
if ($botUser->getBot() === $this) {
$botUser->setBot(null);
}
}
return $this;
}
public function getSupportUsername(): ?string
{
return $this->supportUsername;
}
public function setSupportUsername(?string $supportUsername): static
{
$this->supportUsername = $supportUsername;
return $this;
}
public function getDomain(): ?Domain
{
return $this->domain;
}
public function setDomain(?Domain $domain): static
{
$this->domain = $domain;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(string $logo): static
{
$this->logo = $logo;
return $this;
}
/**
* @return Collection<int, BotTransaction>
*/
public function getBotTransactions(): Collection
{
return $this->botTransactions;
}
public function addBotTransaction(BotTransaction $botTransaction): static
{
if (!$this->botTransactions->contains($botTransaction)) {
$this->botTransactions->add($botTransaction);
$botTransaction->setBot($this);
}
return $this;
}
public function removeBotTransaction(BotTransaction $botTransaction): static
{
if ($this->botTransactions->removeElement($botTransaction)) {
// set the owning side to null (unless already changed)
if ($botTransaction->getBot() === $this) {
$botTransaction->setBot(null);
}
}
return $this;
}
public function getChannelMembers(): ?int
{
return $this->channelMembers;
}
public function setChannelMembers(?int $channelMembers): static
{
$this->channelMembers = $channelMembers;
return $this;
}
public function getBotServices(): ?int
{
return $this->botServices;
}
public function setBotServices(?int $botServices): static
{
$this->botServices = $botServices;
return $this;
}
public function getWelcomeMessage(): ?string
{
if (!$this->welcomeMessage){
return 'به فروشگاه ما خوش اومدی ❤️
🛜 سازگار با تمام اپراتورهای اینترنت
📲 مناسب تمام گوشیها و سیستمها
👨💻 پشتیبانی ۲۴ ساعته تا آخرین روز
⭐️ کیفیت خیلی بالا و قیمتهای پایین'.PHP_EOL;
}
return $this->welcomeMessage;
}
public function setWelcomeMessage(?string $welcomeMessage): static
{
$this->welcomeMessage = $welcomeMessage;
return $this;
}
public function getThanksMessage(): ?string
{
return $this->thanksMessage;
}
public function setThanksMessage(?string $thanksMessage): static
{
$this->thanksMessage = $thanksMessage;
return $this;
}
public function isAllowTest(): ?bool
{
return $this->allowTest;
}
public function setAllowTest(bool $allowTest): static
{
$this->allowTest = $allowTest;
return $this;
}
public function getOffPercent(): ?int
{
return $this->offPercent;
}
public function setOffPercent(?int $offPercent): static
{
$this->offPercent = $offPercent;
return $this;
}
public function getWalletAddress(): ?string
{
return $this->walletAddress;
}
public function setWalletAddress(?string $walletAddress): static
{
$this->walletAddress = $walletAddress;
return $this;
}
//
// /**
// * @return Collection<int, BotChargeTransactions>
// */
// public function getBotChargeTransactions(): Collection
// {
// return $this->botChargeTransactions;
// }
//
// public function addBotChargeTransaction(BotChargeTransactions $botChargeTransaction): static
// {
// if (!$this->botChargeTransactions->contains($botChargeTransaction)) {
// $this->botChargeTransactions->add($botChargeTransaction);
// $botChargeTransaction->setBot($this);
// }
//
// return $this;
// }
//
// public function removeBotChargeTransaction(BotChargeTransactions $botChargeTransaction): static
// {
// if ($this->botChargeTransactions->removeElement($botChargeTransaction)) {
// // set the owning side to null (unless already changed)
// if ($botChargeTransaction->getBot() === $this) {
// $botChargeTransaction->setBot(null);
// }
// }
//
// return $this;
// }
public function getMinimumCardToCard(): ?string
{
return $this->minimumCardToCard;
}
public function setMinimumCardToCard(?string $minimumCardToCard): static
{
$this->minimumCardToCard = $minimumCardToCard;
return $this;
}
/**
* @return Collection<int, Service>
*/
public function getServices(): Collection
{
return $this->services;
}
public function addService(Service $service): static
{
if (!$this->services->contains($service)) {
$this->services->add($service);
$service->setCreatorBot($this);
}
return $this;
}
public function removeService(Service $service): static
{
if ($this->services->removeElement($service)) {
// set the owning side to null (unless already changed)
if ($service->getCreatorBot() === $this) {
$service->setCreatorBot(null);
}
}
return $this;
}
/**
* @return Collection<int, BotCampaign>
*/
public function getBotCampaigns(): Collection
{
return $this->botCampaigns;
}
public function addBotCampaign(BotCampaign $botCampaign): static
{
if (!$this->botCampaigns->contains($botCampaign)) {
$this->botCampaigns->add($botCampaign);
$botCampaign->setBot($this);
}
return $this;
}
public function removeBotCampaign(BotCampaign $botCampaign): static
{
if ($this->botCampaigns->removeElement($botCampaign)) {
// set the owning side to null (unless already changed)
if ($botCampaign->getBot() === $this) {
$botCampaign->setBot(null);
}
}
return $this;
}
public function isIsBotForWebsite(): ?bool
{
return $this->isBotForWebsite;
}
public function setIsBotForWebsite(bool $isBotForWebsite): static
{
$this->isBotForWebsite = $isBotForWebsite;
return $this;
}
/**
* @return Collection<int, ArzDigital>
*/
public function getArzDigitals(): Collection
{
return $this->arzDigitals;
}
public function addArzDigital(ArzDigital $arzDigital): static
{
if (!$this->arzDigitals->contains($arzDigital)) {
$this->arzDigitals->add($arzDigital);
$arzDigital->setBot($this);
}
return $this;
}
public function removeArzDigital(ArzDigital $arzDigital): static
{
if ($this->arzDigitals->removeElement($arzDigital)) {
// set the owning side to null (unless already changed)
if ($arzDigital->getBot() === $this) {
$arzDigital->setBot(null);
}
}
return $this;
}
public function isSentAutoMessages(): ?bool
{
return $this->sentAutoMessages;
}
public function setSentAutoMessages(bool $sentAutoMessages): static
{
$this->sentAutoMessages = $sentAutoMessages;
return $this;
}
public function getUsersCount(): ?int
{
return $this->usersCount;
}
public function setUsersCount(?int $usersCount): static
{
$this->usersCount = $usersCount;
return $this;
}
public function getServicesCount(): ?int
{
return $this->servicesCount;
}
public function setServicesCount(?int $servicesCount): static
{
$this->servicesCount = $servicesCount;
return $this;
}
/**
* @return Collection<int, BotNotification>
*/
public function getBotNotifications(): Collection
{
return $this->botNotifications;
}
public function addBotNotification(BotNotification $botNotification): static
{
if (!$this->botNotifications->contains($botNotification)) {
$this->botNotifications->add($botNotification);
$botNotification->setBot($this);
}
return $this;
}
public function removeBotNotification(BotNotification $botNotification): static
{
if ($this->botNotifications->removeElement($botNotification)) {
// set the owning side to null (unless already changed)
if ($botNotification->getBot() === $this) {
$botNotification->setBot(null);
}
}
return $this;
}
public function getAdsNotTestedMessage(): ?string
{
return $this->adsNotTestedMessage;
}
public function setAdsNotTestedMessage(?string $adsNotTestedMessage): static
{
$this->adsNotTestedMessage = $adsNotTestedMessage;
return $this;
}
public function getAdsNotBoughtMessage(): ?string
{
return $this->adsNotBoughtMessage;
}
public function setAdsNotBoughtMessage(?string $adsNotBoughtMessage): static
{
$this->adsNotBoughtMessage = $adsNotBoughtMessage;
return $this;
}
/**
* @return Collection<int, BotAnalytics>
*/
public function getBotAnalytics(): Collection
{
return $this->botAnalytics;
}
public function addBotAnalytic(BotAnalytics $botAnalytic): static
{
if (!$this->botAnalytics->contains($botAnalytic)) {
$this->botAnalytics->add($botAnalytic);
$botAnalytic->setBot($this);
}
return $this;
}
public function removeBotAnalytic(BotAnalytics $botAnalytic): static
{
if ($this->botAnalytics->removeElement($botAnalytic)) {
// set the owning side to null (unless already changed)
if ($botAnalytic->getBot() === $this) {
$botAnalytic->setBot(null);
}
}
return $this;
}
}