src/Entity/Website/Telegram/AgentPublicBot/Bot.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Website\Telegram\AgentPublicBot;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Generic\Customer\Customer;
  5. use App\Entity\Website\SubTransactions\ArzDigital;
  6. use App\Entity\Website\VPN\Service\Service;
  7. use App\Entity\Website\Website\Website;
  8. use App\Repository\Website\Telegram\AgentPublicBot\BotRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  14. #[ORM\Entity(repositoryClassBotRepository::class)]
  15. class Bot extends BaseEntity
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\Column(type'guid'uniquetrue)]
  19.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  20.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  21.     private ?string $id null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $title null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $token null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $ownerUserId null;
  28.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  29.     private ?string $description null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $cardNumber null;
  32.     #[ORM\Column]
  33.     private ?bool $forceJoinChannel null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $channelUserNAme null;
  36.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotPlan::class)]
  37.     private Collection $botPlans;
  38.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotUser::class)]
  39.     private Collection $botUsers;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $supportUsername null;
  42.     #[ORM\Column(length255nullabletrue)]
  43.     private ?string $logo null;
  44.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotTransaction::class)]
  45.     private Collection $botTransactions;
  46.     #[ORM\Column(nullabletrue)]
  47.     private ?int $channelMembers null;
  48.     #[ORM\Column(nullabletrue)]
  49.     private ?int $botServices null;
  50.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  51.     private ?string $welcomeMessage null;
  52.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  53.     private ?string $thanksMessage null;
  54.     #[ORM\Column]
  55.     private ?bool $allowTest null;
  56.     #[ORM\Column(nullabletrue)]
  57.     private ?int $offPercent null;
  58.     #[ORM\Column(length255nullabletrue)]
  59.     private ?string $walletAddress null;
  60.     #[ORM\Column(typeTypes::BIGINTnullabletrue)]
  61.     private ?string $minimumCardToCard null;
  62.     #[ORM\OneToMany(mappedBy'creatorBot'targetEntityService::class)]
  63.     private Collection $services;
  64.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotCampaign::class)]
  65.     private Collection $botCampaigns;
  66.     #[ORM\Column]
  67.     private ?bool $isBotForWebsite null;
  68.     #[ORM\OneToMany(mappedBy'bot'targetEntityArzDigital::class)]
  69.     private Collection $arzDigitals;
  70.     #[ORM\Column]
  71.     private ?bool $sentAutoMessages null;
  72.     #[ORM\Column(nullabletrue)]
  73.     private ?int $usersCount null;
  74.     #[ORM\Column(nullabletrue)]
  75.     private ?int $servicesCount null;
  76.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotNotification::class)]
  77.     private Collection $botNotifications;
  78.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  79.     private ?string $adsNotTestedMessage null;
  80.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  81.     private ?string $adsNotBoughtMessage null;
  82.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotAnalytics::class)]
  83.     private Collection $botAnalytics;
  84.     #[ORM\ManyToOne(inversedBy'bots')]
  85.     #[ORM\JoinColumn(nullablefalse)]
  86.     private ?Customer $owner null;
  87.     #[ORM\ManyToOne(inversedBy'bots')]
  88.     #[ORM\JoinColumn(nullablefalse)]
  89.     private ?Website $website null;
  90.     public function __toString():string
  91.     {
  92.         return  $this->getTitle();
  93.     }
  94.     public function __construct()
  95.     {
  96.         $this->setIsBotForWebsite(0);
  97.         parent::__construct();
  98.         $this->setForceJoinChannel(0);
  99.         $this->botPlans = new ArrayCollection();
  100.         $this->botUsers = new ArrayCollection();
  101.         $this->botTransactions = new ArrayCollection();
  102.         $this->setAllowTest(0);
  103.         $this->services = new ArrayCollection();
  104.         $this->botCampaigns = new ArrayCollection();
  105.         $this->arzDigitals = new ArrayCollection();
  106.         $this->setSentAutoMessages(0);
  107.         $this->botNotifications = new ArrayCollection();
  108.         $this->botAnalytics = new ArrayCollection();
  109.     }
  110.     public function usersCount():int
  111.     {
  112.         return count($this->getBotUsers());
  113.     }
  114.     public function getId(): ?string
  115.     {
  116.         return $this->id;
  117.     }
  118.     public function getTitle(): ?string
  119.     {
  120.         return $this->title;
  121.     }
  122.     public function setTitle(string $title): static
  123.     {
  124.         $this->title $title;
  125.         return $this;
  126.     }
  127.     public function getToken(): ?string
  128.     {
  129.         return $this->token;
  130.     }
  131.     public function setToken(string $token): static
  132.     {
  133.         $this->token $token;
  134.         return $this;
  135.     }
  136.     public function getOwnerUserId(): ?string
  137.     {
  138.         return $this->ownerUserId;
  139.     }
  140.     public function setOwnerUserId(?string $ownerUserId): static
  141.     {
  142.         $this->ownerUserId $ownerUserId;
  143.         return $this;
  144.     }
  145.     public function getDescription(): ?string
  146.     {
  147.         return $this->description;
  148.     }
  149.     public function setDescription(?string $description): static
  150.     {
  151.         $this->description $description;
  152.         return $this;
  153.     }
  154.     public function getCardNumber(): ?string
  155.     {
  156.         return $this->cardNumber;
  157.     }
  158.     public function setCardNumber(?string $cardNumber): static
  159.     {
  160.         $this->cardNumber $cardNumber;
  161.         return $this;
  162.     }
  163.     public function isForceJoinChannel(): ?bool
  164.     {
  165.         return $this->forceJoinChannel;
  166.     }
  167.     public function setForceJoinChannel(bool $forceJoinChannel): static
  168.     {
  169.         $this->forceJoinChannel $forceJoinChannel;
  170.         return $this;
  171.     }
  172.     public function getChannelUserNAme(): ?string
  173.     {
  174.         return $this->channelUserNAme;
  175.     }
  176.     public function setChannelUserNAme(?string $channelUserNAme): static
  177.     {
  178.         $this->channelUserNAme $channelUserNAme;
  179.         return $this;
  180.     }
  181.     /**
  182.      * @return Collection<int, BotPlan>
  183.      */
  184.     public function getBotPlans(): Collection
  185.     {
  186.         return $this->botPlans;
  187.     }
  188.     public function addBotPlan(BotPlan $botPlan): static
  189.     {
  190.         if (!$this->botPlans->contains($botPlan)) {
  191.             $this->botPlans->add($botPlan);
  192.             $botPlan->setBot($this);
  193.         }
  194.         return $this;
  195.     }
  196.     public function removeBotPlan(BotPlan $botPlan): static
  197.     {
  198.         if ($this->botPlans->removeElement($botPlan)) {
  199.             // set the owning side to null (unless already changed)
  200.             if ($botPlan->getBot() === $this) {
  201.                 $botPlan->setBot(null);
  202.             }
  203.         }
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return Collection<int, BotUser>
  208.      */
  209.     public function getBotUsers(): Collection
  210.     {
  211.         return $this->botUsers;
  212.     }
  213.     public function addBotUser(BotUser $botUser): static
  214.     {
  215.         if (!$this->botUsers->contains($botUser)) {
  216.             $this->botUsers->add($botUser);
  217.             $botUser->setBot($this);
  218.         }
  219.         return $this;
  220.     }
  221.     public function removeBotUser(BotUser $botUser): static
  222.     {
  223.         if ($this->botUsers->removeElement($botUser)) {
  224.             // set the owning side to null (unless already changed)
  225.             if ($botUser->getBot() === $this) {
  226.                 $botUser->setBot(null);
  227.             }
  228.         }
  229.         return $this;
  230.     }
  231.     public function getSupportUsername(): ?string
  232.     {
  233.         return $this->supportUsername;
  234.     }
  235.     public function setSupportUsername(?string $supportUsername): static
  236.     {
  237.         $this->supportUsername $supportUsername;
  238.         return $this;
  239.     }
  240.     public function getDomain(): ?Domain
  241.     {
  242.         return $this->domain;
  243.     }
  244.     public function setDomain(?Domain $domain): static
  245.     {
  246.         $this->domain $domain;
  247.         return $this;
  248.     }
  249.     public function getLogo(): ?string
  250.     {
  251.         return $this->logo;
  252.     }
  253.     public function setLogo(string $logo): static
  254.     {
  255.         $this->logo $logo;
  256.         return $this;
  257.     }
  258.     /**
  259.      * @return Collection<int, BotTransaction>
  260.      */
  261.     public function getBotTransactions(): Collection
  262.     {
  263.         return $this->botTransactions;
  264.     }
  265.     public function addBotTransaction(BotTransaction $botTransaction): static
  266.     {
  267.         if (!$this->botTransactions->contains($botTransaction)) {
  268.             $this->botTransactions->add($botTransaction);
  269.             $botTransaction->setBot($this);
  270.         }
  271.         return $this;
  272.     }
  273.     public function removeBotTransaction(BotTransaction $botTransaction): static
  274.     {
  275.         if ($this->botTransactions->removeElement($botTransaction)) {
  276.             // set the owning side to null (unless already changed)
  277.             if ($botTransaction->getBot() === $this) {
  278.                 $botTransaction->setBot(null);
  279.             }
  280.         }
  281.         return $this;
  282.     }
  283.     public function getChannelMembers(): ?int
  284.     {
  285.         return $this->channelMembers;
  286.     }
  287.     public function setChannelMembers(?int $channelMembers): static
  288.     {
  289.         $this->channelMembers $channelMembers;
  290.         return $this;
  291.     }
  292.     public function getBotServices(): ?int
  293.     {
  294.         return $this->botServices;
  295.     }
  296.     public function setBotServices(?int $botServices): static
  297.     {
  298.         $this->botServices $botServices;
  299.         return $this;
  300.     }
  301.     public function getWelcomeMessage(): ?string
  302.     {
  303.         if (!$this->welcomeMessage){
  304.             return  'به فروشگاه ما خوش اومدی ❤️
  305. 🛜 سازگار با تمام اپراتورهای اینترنت
  306. 📲 مناسب تمام گوشی‌ها و سیستم‌ها
  307. 👨‍💻 پشتیبانی ۲۴ ساعته تا آخرین روز
  308. ⭐️ کیفیت خیلی بالا و قیمت‌های پایین'.PHP_EOL;
  309.         }
  310.         return $this->welcomeMessage;
  311.     }
  312.     public function setWelcomeMessage(?string $welcomeMessage): static
  313.     {
  314.         $this->welcomeMessage $welcomeMessage;
  315.         return $this;
  316.     }
  317.     public function getThanksMessage(): ?string
  318.     {
  319.         return $this->thanksMessage;
  320.     }
  321.     public function setThanksMessage(?string $thanksMessage): static
  322.     {
  323.         $this->thanksMessage $thanksMessage;
  324.         return $this;
  325.     }
  326.     public function isAllowTest(): ?bool
  327.     {
  328.         return $this->allowTest;
  329.     }
  330.     public function setAllowTest(bool $allowTest): static
  331.     {
  332.         $this->allowTest $allowTest;
  333.         return $this;
  334.     }
  335.     public function getOffPercent(): ?int
  336.     {
  337.         return $this->offPercent;
  338.     }
  339.     public function setOffPercent(?int $offPercent): static
  340.     {
  341.         $this->offPercent $offPercent;
  342.         return $this;
  343.     }
  344.     public function getWalletAddress(): ?string
  345.     {
  346.         return $this->walletAddress;
  347.     }
  348.     public function setWalletAddress(?string $walletAddress): static
  349.     {
  350.         $this->walletAddress $walletAddress;
  351.         return $this;
  352.     }
  353. //
  354. //    /**
  355. //     * @return Collection<int, BotChargeTransactions>
  356. //     */
  357. //    public function getBotChargeTransactions(): Collection
  358. //    {
  359. //        return $this->botChargeTransactions;
  360. //    }
  361. //
  362. //    public function addBotChargeTransaction(BotChargeTransactions $botChargeTransaction): static
  363. //    {
  364. //        if (!$this->botChargeTransactions->contains($botChargeTransaction)) {
  365. //            $this->botChargeTransactions->add($botChargeTransaction);
  366. //            $botChargeTransaction->setBot($this);
  367. //        }
  368. //
  369. //        return $this;
  370. //    }
  371. //
  372. //    public function removeBotChargeTransaction(BotChargeTransactions $botChargeTransaction): static
  373. //    {
  374. //        if ($this->botChargeTransactions->removeElement($botChargeTransaction)) {
  375. //            // set the owning side to null (unless already changed)
  376. //            if ($botChargeTransaction->getBot() === $this) {
  377. //                $botChargeTransaction->setBot(null);
  378. //            }
  379. //        }
  380. //
  381. //        return $this;
  382. //    }
  383.     public function getMinimumCardToCard(): ?string
  384.     {
  385.         return $this->minimumCardToCard;
  386.     }
  387.     public function setMinimumCardToCard(?string $minimumCardToCard): static
  388.     {
  389.         $this->minimumCardToCard $minimumCardToCard;
  390.         return $this;
  391.     }
  392.     /**
  393.      * @return Collection<int, Service>
  394.      */
  395.     public function getServices(): Collection
  396.     {
  397.         return $this->services;
  398.     }
  399.     public function addService(Service $service): static
  400.     {
  401.         if (!$this->services->contains($service)) {
  402.             $this->services->add($service);
  403.             $service->setCreatorBot($this);
  404.         }
  405.         return $this;
  406.     }
  407.     public function removeService(Service $service): static
  408.     {
  409.         if ($this->services->removeElement($service)) {
  410.             // set the owning side to null (unless already changed)
  411.             if ($service->getCreatorBot() === $this) {
  412.                 $service->setCreatorBot(null);
  413.             }
  414.         }
  415.         return $this;
  416.     }
  417.     /**
  418.      * @return Collection<int, BotCampaign>
  419.      */
  420.     public function getBotCampaigns(): Collection
  421.     {
  422.         return $this->botCampaigns;
  423.     }
  424.     public function addBotCampaign(BotCampaign $botCampaign): static
  425.     {
  426.         if (!$this->botCampaigns->contains($botCampaign)) {
  427.             $this->botCampaigns->add($botCampaign);
  428.             $botCampaign->setBot($this);
  429.         }
  430.         return $this;
  431.     }
  432.     public function removeBotCampaign(BotCampaign $botCampaign): static
  433.     {
  434.         if ($this->botCampaigns->removeElement($botCampaign)) {
  435.             // set the owning side to null (unless already changed)
  436.             if ($botCampaign->getBot() === $this) {
  437.                 $botCampaign->setBot(null);
  438.             }
  439.         }
  440.         return $this;
  441.     }
  442.     public function isIsBotForWebsite(): ?bool
  443.     {
  444.         return $this->isBotForWebsite;
  445.     }
  446.     public function setIsBotForWebsite(bool $isBotForWebsite): static
  447.     {
  448.         $this->isBotForWebsite $isBotForWebsite;
  449.         return $this;
  450.     }
  451.     /**
  452.      * @return Collection<int, ArzDigital>
  453.      */
  454.     public function getArzDigitals(): Collection
  455.     {
  456.         return $this->arzDigitals;
  457.     }
  458.     public function addArzDigital(ArzDigital $arzDigital): static
  459.     {
  460.         if (!$this->arzDigitals->contains($arzDigital)) {
  461.             $this->arzDigitals->add($arzDigital);
  462.             $arzDigital->setBot($this);
  463.         }
  464.         return $this;
  465.     }
  466.     public function removeArzDigital(ArzDigital $arzDigital): static
  467.     {
  468.         if ($this->arzDigitals->removeElement($arzDigital)) {
  469.             // set the owning side to null (unless already changed)
  470.             if ($arzDigital->getBot() === $this) {
  471.                 $arzDigital->setBot(null);
  472.             }
  473.         }
  474.         return $this;
  475.     }
  476.     public function isSentAutoMessages(): ?bool
  477.     {
  478.         return $this->sentAutoMessages;
  479.     }
  480.     public function setSentAutoMessages(bool $sentAutoMessages): static
  481.     {
  482.         $this->sentAutoMessages $sentAutoMessages;
  483.         return $this;
  484.     }
  485.     public function getUsersCount(): ?int
  486.     {
  487.         return $this->usersCount;
  488.     }
  489.     public function setUsersCount(?int $usersCount): static
  490.     {
  491.         $this->usersCount $usersCount;
  492.         return $this;
  493.     }
  494.     public function getServicesCount(): ?int
  495.     {
  496.         return $this->servicesCount;
  497.     }
  498.     public function setServicesCount(?int $servicesCount): static
  499.     {
  500.         $this->servicesCount $servicesCount;
  501.         return $this;
  502.     }
  503.     /**
  504.      * @return Collection<int, BotNotification>
  505.      */
  506.     public function getBotNotifications(): Collection
  507.     {
  508.         return $this->botNotifications;
  509.     }
  510.     public function addBotNotification(BotNotification $botNotification): static
  511.     {
  512.         if (!$this->botNotifications->contains($botNotification)) {
  513.             $this->botNotifications->add($botNotification);
  514.             $botNotification->setBot($this);
  515.         }
  516.         return $this;
  517.     }
  518.     public function removeBotNotification(BotNotification $botNotification): static
  519.     {
  520.         if ($this->botNotifications->removeElement($botNotification)) {
  521.             // set the owning side to null (unless already changed)
  522.             if ($botNotification->getBot() === $this) {
  523.                 $botNotification->setBot(null);
  524.             }
  525.         }
  526.         return $this;
  527.     }
  528.     public function getAdsNotTestedMessage(): ?string
  529.     {
  530.         return $this->adsNotTestedMessage;
  531.     }
  532.     public function setAdsNotTestedMessage(?string $adsNotTestedMessage): static
  533.     {
  534.         $this->adsNotTestedMessage $adsNotTestedMessage;
  535.         return $this;
  536.     }
  537.     public function getAdsNotBoughtMessage(): ?string
  538.     {
  539.         return $this->adsNotBoughtMessage;
  540.     }
  541.     public function setAdsNotBoughtMessage(?string $adsNotBoughtMessage): static
  542.     {
  543.         $this->adsNotBoughtMessage $adsNotBoughtMessage;
  544.         return $this;
  545.     }
  546.     /**
  547.      * @return Collection<int, BotAnalytics>
  548.      */
  549.     public function getBotAnalytics(): Collection
  550.     {
  551.         return $this->botAnalytics;
  552.     }
  553.     public function addBotAnalytic(BotAnalytics $botAnalytic): static
  554.     {
  555.         if (!$this->botAnalytics->contains($botAnalytic)) {
  556.             $this->botAnalytics->add($botAnalytic);
  557.             $botAnalytic->setBot($this);
  558.         }
  559.         return $this;
  560.     }
  561.     public function removeBotAnalytic(BotAnalytics $botAnalytic): static
  562.     {
  563.         if ($this->botAnalytics->removeElement($botAnalytic)) {
  564.             // set the owning side to null (unless already changed)
  565.             if ($botAnalytic->getBot() === $this) {
  566.                 $botAnalytic->setBot(null);
  567.             }
  568.         }
  569.         return $this;
  570.     }
  571.     public function getOwner(): ?Customer
  572.     {
  573.         return $this->owner;
  574.     }
  575.     public function setOwner(?Customer $owner): static
  576.     {
  577.         $this->owner $owner;
  578.         return $this;
  579.     }
  580.     public function getWebsite(): ?Website
  581.     {
  582.         return $this->website;
  583.     }
  584.     public function setWebsite(?Website $website): static
  585.     {
  586.         $this->website $website;
  587.         return $this;
  588.     }
  589. }