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

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