src/Entity/Widget.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WidgetRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Nelmio\ApiDocBundle\Annotation\Model;
  8. use Ramsey\Uuid\Uuid;
  9. use Ramsey\Uuid\UuidInterface;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use OpenApi\Annotations as OA;
  13. /**
  14. * @ORM\Entity(repositoryClass=WidgetRepository::class)
  15. */
  16. class Widget
  17. {
  18. public const FONT_VARIANTS = [
  19. 'Inter' => 'Inter',
  20. 'Lato' => 'Lato',
  21. 'Avenir Next' => 'Avenir Next',
  22. 'Roboto' => 'Roboto',
  23. 'Gotham' => 'Gotham',
  24. 'Museo Sans Cyrl' => 'Museo Sans Cyrl',
  25. 'Helvetica Neue' => 'Helvetica Neue',
  26. 'Arial' => 'Arial',
  27. ];
  28. public const DELIVERY_VARIANTS = [
  29. 'Email' => 'Email',
  30. 'SMS' => 'SMS',
  31. 'Благотворительность' => 'Charity',
  32. ];
  33. /**
  34. * @Groups("widget")
  35. * @ORM\Id
  36. * @ORM\Column(type="uuid", unique=true)
  37. * @ORM\GeneratedValue(strategy="NONE")
  38. * @OA\Property(
  39. * type="string",
  40. * )
  41. * @Assert\NotBlank()
  42. */
  43. private $id;
  44. /**
  45. * @Groups({"widget"})
  46. * @ORM\Column(type="string", length=255)
  47. * @Assert\NotBlank()
  48. */
  49. private $name;
  50. /**
  51. * @Groups({"widget"})
  52. * @ORM\Column(type="string", length=255)
  53. * @Assert\NotBlank()
  54. */
  55. private $domain;
  56. /**
  57. * @Groups({"widget"})
  58. * @ORM\ManyToOne(targetEntity=WidgetUser::class, inversedBy="widgets", cascade={"persist"})
  59. * @ORM\JoinColumn(nullable=false)
  60. * @Assert\NotBlank()
  61. * @OA\Property(
  62. * type="object",
  63. * ref=@Model(type=WidgetUser::class)
  64. * )
  65. */
  66. private $Client;
  67. /**
  68. * @Groups({"widget"})
  69. * @ORM\Column(type="string", name="ykassa_dsn", length=255, nullable=true)
  70. */
  71. private $ykassaDsn;
  72. /**
  73. * @Groups({"widget"})
  74. * @ORM\ManyToOne(targetEntity=MailTemplate::class, inversedBy="widgets", fetch="EAGER", cascade={"persist"})
  75. * @ORM\JoinColumn(nullable=false)
  76. * @OA\Property(
  77. * type="object",
  78. * ref=@Model(type=MailTemplate::class, groups={"widget","template"})
  79. * )
  80. */
  81. private $mailTemplate;
  82. /**
  83. * @Groups("widget")
  84. * @ORM\Column(type="string", length=255)
  85. */
  86. private $primaryBackgroundColor;
  87. /**
  88. * @Groups("widget")
  89. * @ORM\Column(type="string", length=255)
  90. */
  91. private $primaryColor;
  92. /**
  93. * @Groups("widget")
  94. * @ORM\Column(type="string", length=255)
  95. */
  96. private $iconsColor;
  97. /**
  98. * @Groups("widget")
  99. * @ORM\Column(type="string", length=255)
  100. */
  101. private $circlesColor;
  102. /**
  103. * @Groups("widget")
  104. * @ORM\Column(type="string", length=255)
  105. */
  106. private $starsColor;
  107. /**
  108. * @Groups("widget")
  109. * @ORM\Column(type="string", length=255)
  110. */
  111. private $ribbonColor;
  112. /**
  113. * @Groups("widget")
  114. * @ORM\Column(type="string", length=255)
  115. */
  116. private $logotypeImage;
  117. /**
  118. * @Groups("widget")
  119. * @ORM\Column(type="string", length=255, nullable=true)
  120. */
  121. private $logotypeLink;
  122. /**
  123. * @Groups("widget")
  124. * @ORM\Column(type="string", length=255)
  125. */
  126. private $faviconImage;
  127. /**
  128. * @Groups("widget")
  129. * @ORM\Column(type="string", length=255)
  130. */
  131. private $metaTitle;
  132. /**
  133. * @Groups("widget")
  134. * @ORM\Column(type="string", length=255)
  135. */
  136. private $font;
  137. /**
  138. * @Groups("widget")
  139. * @ORM\Column(type="string", length=255, nullable=true)
  140. */
  141. private $externalCssFile;
  142. /**
  143. * @Groups("widget")
  144. * @ORM\Column(type="string", length=255)
  145. */
  146. private $supportTelNumber;
  147. /**
  148. * @Groups("widget")
  149. * @ORM\Column(type="string", length=255)
  150. */
  151. private $supportEmail;
  152. /**
  153. * @Groups("widget")
  154. * @ORM\Column(type="array")
  155. */
  156. private $deliveryVariants = [];
  157. /**
  158. * @Groups("widget")
  159. * @ORM\Column(type="boolean", nullable=true)
  160. */
  161. private $sendToFriend;
  162. /**
  163. * @Groups("widget")
  164. * @ORM\Column(type="string", length=255)
  165. */
  166. private $orderService;
  167. /**
  168. * @Groups("widget")
  169. * @ORM\Column(type="text")
  170. */
  171. private $offer;
  172. /**
  173. * @var array
  174. * @Groups("widget")
  175. * @ORM\Column(type="array", nullable=true)
  176. */
  177. private $faq = [];
  178. /**
  179. * @Groups("widget")
  180. * @ORM\Column(type="string", length=255)
  181. */
  182. private $hiwCreateTitle;
  183. /**
  184. * @Groups("widget")
  185. * @ORM\Column(type="string", length=255)
  186. */
  187. private $hiwCreateText;
  188. /**
  189. * @Groups("widget")
  190. * @ORM\Column(type="string", length=255)
  191. */
  192. private $hiwReceiveTitle;
  193. /**
  194. * @Groups("widget")
  195. * @ORM\Column(type="string", length=255)
  196. */
  197. private $hiwReceiveText;
  198. /**
  199. * @Groups("widget")
  200. * @ORM\Column(type="string", length=255)
  201. */
  202. private $hiwGladTitle;
  203. /**
  204. * @Groups("widget")
  205. * @ORM\Column(type="string", length=255)
  206. */
  207. private $hiwGladText;
  208. /**
  209. * @Groups("widget")
  210. * @ORM\Column(type="text")
  211. */
  212. private $rulesText;
  213. /**
  214. * @Groups("widget")
  215. * @ORM\Column(type="string", length=255)
  216. */
  217. private $products;
  218. /**
  219. * @ORM\OneToMany(targetEntity=Order::class, mappedBy="widget")
  220. */
  221. private $orders;
  222. /**
  223. * @ORM\OneToMany(targetEntity=UserFile::class, mappedBy="widget")
  224. */
  225. private $userFiles;
  226. /**
  227. * @Groups("cover")
  228. * @ORM\Column(type="array", nullable=true)
  229. */
  230. private $covers = [];
  231. /**
  232. * @ORM\Column(type="string", length=255, nullable=true)
  233. */
  234. private $order_service_dsn_login;
  235. /**
  236. * @ORM\Column(type="string", length=255, nullable=true)
  237. */
  238. private $order_service_dsn_password;
  239. /**
  240. * @ORM\Column(type="string", length=255, nullable=true)
  241. */
  242. private $order_service_dsn_url;
  243. /**
  244. * @ORM\Column(type="string", length=255, nullable=true)
  245. */
  246. private $order_service_dsn_port;
  247. /**
  248. * @ORM\Column(type="string", length=255, nullable=true)
  249. */
  250. private $id_metric_google;
  251. /**
  252. * @ORM\Column(type="string", length=255, nullable=true)
  253. */
  254. private $id_metric_yandex;
  255. /**
  256. * @ORM\ManyToMany(targetEntity=WidgetUser::class, inversedBy="widgets")
  257. */
  258. private $widgetUsers;
  259. /**
  260. * @Groups("widget")
  261. * @ORM\Column(type="boolean", nullable=true)
  262. */
  263. private $customDesign;
  264. /**
  265. * @ORM\Column(type="json", nullable=true)
  266. */
  267. private $usageRules = [];
  268. /**
  269. * @Groups("widget")
  270. * @ORM\Column(type="string", length=255)
  271. */
  272. private $backgroundImage;
  273. /**
  274. * @ORM\Column(type="json", nullable=true)
  275. */
  276. private $saleProductIds = [];
  277. /**
  278. * @Groups("widget")
  279. * @ORM\Column(type="string", length=255, nullable=true)
  280. */
  281. private $saleImage;
  282. /**
  283. * @Groups("widget")
  284. * @ORM\Column(type="string", length=255, nullable=true)
  285. */
  286. private $saleColor;
  287. /**
  288. * @Groups("widget")
  289. * @ORM\Column(type="boolean")
  290. */
  291. private $canWholesale = false;
  292. /**
  293. * @Groups("widget")
  294. * @ORM\Column(type="text", nullable=true)
  295. */
  296. private $bxCorporateScript;
  297. /**
  298. * @Groups("widget")
  299. * @ORM\Column(type="boolean")
  300. */
  301. private $enableBxCorporateScript;
  302. /**
  303. * @Groups("widget")
  304. * @ORM\Column(type="boolean")
  305. */
  306. private $productDefaultRemains;
  307. /**
  308. * Разрешать использовать ИИ для генерации текста
  309. *
  310. * @Groups("widget")
  311. * @ORM\Column(type="boolean")
  312. */
  313. private bool $aiTextEnable;
  314. /**
  315. * Разрешать использовать ИИ для генерации изображений
  316. *
  317. * @Groups("widget")
  318. * @ORM\Column(type="boolean")
  319. */
  320. private bool $aiImageEnable;
  321. /**
  322. * Отправлять PIN по sms
  323. *
  324. * @Groups("widget")
  325. * @ORM\Column(type="boolean")
  326. */
  327. private $sendSmsPin;
  328. /**
  329. * ID поставщика в ПЦ
  330. *
  331. * @Groups("widget")
  332. * @ORM\Column(type="text")
  333. */
  334. private $supplierId;
  335. public function __construct()
  336. {
  337. $this->orders = new ArrayCollection();
  338. $this->id = Uuid::uuid4();
  339. $this->widgetUsers = new ArrayCollection();
  340. $this->userFiles = new ArrayCollection();
  341. }
  342. public function __toString()
  343. {
  344. return $this->getName();
  345. }
  346. public function setId(string $id): self
  347. {
  348. $this->id = $id;
  349. return $this;
  350. }
  351. public function getId(): ?UuidInterface
  352. {
  353. return $this->id;
  354. }
  355. public function getName(): ?string
  356. {
  357. return $this->name;
  358. }
  359. public function setName(string $name): self
  360. {
  361. $this->name = $name;
  362. return $this;
  363. }
  364. public function getDomain(): ?string
  365. {
  366. return $this->domain;
  367. }
  368. public function setDomain(string $domain): self
  369. {
  370. $this->domain = $domain;
  371. return $this;
  372. }
  373. public function getClient(): ?WidgetUser
  374. {
  375. return $this->Client;
  376. }
  377. public function setClient(?WidgetUser $Client): self
  378. {
  379. $this->Client = $Client;
  380. return $this;
  381. }
  382. public function getYkassaDsn(): ?string
  383. {
  384. return $this->ykassaDsn;
  385. }
  386. public function setYkassaDsn(?string $ykassaDsn): self
  387. {
  388. $this->ykassaDsn = $ykassaDsn;
  389. return $this;
  390. }
  391. public function getMailTemplate(): ?MailTemplate
  392. {
  393. return $this->mailTemplate;
  394. }
  395. public function setMailTemplate(?MailTemplate $mailTemplate): self
  396. {
  397. $this->mailTemplate = $mailTemplate;
  398. return $this;
  399. }
  400. public function getPrimaryBackgroundColor(): ?string
  401. {
  402. return $this->primaryBackgroundColor;
  403. }
  404. public function setPrimaryBackgroundColor(string $primaryBackgroundColor): self
  405. {
  406. $this->primaryBackgroundColor = $primaryBackgroundColor;
  407. return $this;
  408. }
  409. public function getPrimaryColor(): ?string
  410. {
  411. return $this->primaryColor;
  412. }
  413. public function setPrimaryColor(string $primaryColor): self
  414. {
  415. $this->primaryColor = $primaryColor;
  416. return $this;
  417. }
  418. public function getIconsColor(): ?string
  419. {
  420. return $this->iconsColor;
  421. }
  422. public function setIconsColor(string $iconsColor): self
  423. {
  424. $this->iconsColor = $iconsColor;
  425. return $this;
  426. }
  427. public function getCirclesColor(): ?string
  428. {
  429. return $this->circlesColor;
  430. }
  431. public function setCirclesColor(string $circlesColor): self
  432. {
  433. $this->circlesColor = $circlesColor;
  434. return $this;
  435. }
  436. public function getStarsColor(): ?string
  437. {
  438. return $this->starsColor;
  439. }
  440. public function setStarsColor(string $starsColor): self
  441. {
  442. $this->starsColor = $starsColor;
  443. return $this;
  444. }
  445. public function getRibbonColor(): ?string
  446. {
  447. return $this->ribbonColor;
  448. }
  449. public function setRibbonColor(string $ribbonColor): self
  450. {
  451. $this->ribbonColor = $ribbonColor;
  452. return $this;
  453. }
  454. public function getLogotypeImage(): ?string
  455. {
  456. return $this->logotypeImage;
  457. }
  458. public function setLogotypeImage(string $logotypeImage): self
  459. {
  460. $this->logotypeImage = $logotypeImage;
  461. return $this;
  462. }
  463. public function getLogotypeLink(): ?string
  464. {
  465. return $this->logotypeLink;
  466. }
  467. public function setLogotypeLink(?string $logotypeLink): self
  468. {
  469. $this->logotypeLink = $logotypeLink;
  470. return $this;
  471. }
  472. public function getFaviconImage(): ?string
  473. {
  474. return $this->faviconImage;
  475. }
  476. public function setFaviconImage(string $faviconImage): self
  477. {
  478. $this->faviconImage = $faviconImage;
  479. return $this;
  480. }
  481. public function getMetaTitle(): ?string
  482. {
  483. return $this->metaTitle;
  484. }
  485. public function setMetaTitle(string $metaTitle): self
  486. {
  487. $this->metaTitle = $metaTitle;
  488. return $this;
  489. }
  490. public function getFont(): ?string
  491. {
  492. return $this->font;
  493. }
  494. public function setFont(string $font): self
  495. {
  496. $this->font = $font;
  497. return $this;
  498. }
  499. public function getExternalCssFile(): ?string
  500. {
  501. return $this->externalCssFile;
  502. }
  503. public function setExternalCssFile(?string $externalCssFile): self
  504. {
  505. $this->externalCssFile = $externalCssFile;
  506. return $this;
  507. }
  508. public function getSupportTelNumber(): ?string
  509. {
  510. return $this->supportTelNumber;
  511. }
  512. public function setSupportTelNumber(string $supportTelNumber): self
  513. {
  514. $this->supportTelNumber = $supportTelNumber;
  515. return $this;
  516. }
  517. public function getSupportEmail(): ?string
  518. {
  519. return $this->supportEmail;
  520. }
  521. public function setSupportEmail(string $supportEmail): self
  522. {
  523. $this->supportEmail = $supportEmail;
  524. return $this;
  525. }
  526. /**
  527. * @return string[]|null
  528. * @OA\Property(
  529. * type="string[]"
  530. * )
  531. */
  532. public function getDeliveryVariants(): ?array
  533. {
  534. return $this->deliveryVariants;
  535. }
  536. public function setDeliveryVariants(array $deliveryVariants): self
  537. {
  538. $this->deliveryVariants = $deliveryVariants;
  539. return $this;
  540. }
  541. public function getSendToFriend(): ?bool
  542. {
  543. return $this->sendToFriend;
  544. }
  545. public function setSendToFriend(?bool $sendToFriend): self
  546. {
  547. $this->sendToFriend = $sendToFriend;
  548. return $this;
  549. }
  550. public function getOrderService(): ?string
  551. {
  552. return $this->orderService;
  553. }
  554. public function setOrderService(string $orderService): self
  555. {
  556. $this->orderService = $orderService;
  557. return $this;
  558. }
  559. public function getOrderServiceDsn(): ?string
  560. {
  561. return
  562. parse_url($this->order_service_dsn_url, PHP_URL_SCHEME) . '://' .
  563. $this->order_service_dsn_login . ':' .
  564. $this->order_service_dsn_password . '@' .
  565. parse_url($this->order_service_dsn_url, PHP_URL_HOST) .
  566. parse_url($this->order_service_dsn_url, PHP_URL_PATH);
  567. }
  568. public function getOffer(): ?string
  569. {
  570. return $this->offer;
  571. }
  572. public function setOffer(string $offer): self
  573. {
  574. $this->offer = $offer;
  575. return $this;
  576. }
  577. /**
  578. * @return string[]|null
  579. * @OA\Property(
  580. * type="string[]"
  581. * )
  582. */
  583. public function getFaq(): ?array
  584. {
  585. return $this->faq??null;
  586. }
  587. public function setFaq(?array $faq): self
  588. {
  589. $this->faq = $faq;
  590. return $this;
  591. }
  592. public function getHiwCreateTitle(): ?string
  593. {
  594. return $this->hiwCreateTitle;
  595. }
  596. public function setHiwCreateTitle(string $hiwCreateTitle): self
  597. {
  598. $this->hiwCreateTitle = $hiwCreateTitle;
  599. return $this;
  600. }
  601. public function getHiwCreateText(): ?string
  602. {
  603. return $this->hiwCreateText;
  604. }
  605. public function setHiwCreateText(string $hiwCreateText): self
  606. {
  607. $this->hiwCreateText = $hiwCreateText;
  608. return $this;
  609. }
  610. public function getHiwReceiveTitle(): ?string
  611. {
  612. return $this->hiwReceiveTitle;
  613. }
  614. public function setHiwReceiveTitle(string $hiwReceiveTitle): self
  615. {
  616. $this->hiwReceiveTitle = $hiwReceiveTitle;
  617. return $this;
  618. }
  619. public function getHiwReceiveText(): ?string
  620. {
  621. return $this->hiwReceiveText;
  622. }
  623. public function setHiwReceiveText(string $hiwReceiveText): self
  624. {
  625. $this->hiwReceiveText = $hiwReceiveText;
  626. return $this;
  627. }
  628. public function getHiwGladTitle(): ?string
  629. {
  630. return $this->hiwGladTitle;
  631. }
  632. public function setHiwGladTitle(string $hiwGladTitle): self
  633. {
  634. $this->hiwGladTitle = $hiwGladTitle;
  635. return $this;
  636. }
  637. public function getHiwGladText(): ?string
  638. {
  639. return $this->hiwGladText;
  640. }
  641. public function setHiwGladText(string $hiwGladText): self
  642. {
  643. $this->hiwGladText = $hiwGladText;
  644. return $this;
  645. }
  646. public function getRulesText(): ?string
  647. {
  648. return $this->rulesText;
  649. }
  650. public function setRulesText(string $rulesText): self
  651. {
  652. $this->rulesText = $rulesText;
  653. return $this;
  654. }
  655. public function getProducts(): ?string
  656. {
  657. return $this->products;
  658. }
  659. public function setProducts(string $products): self
  660. {
  661. $this->products = $products;
  662. return $this;
  663. }
  664. /**
  665. * @return Collection|Order[]
  666. */
  667. public function getOrders(): Collection
  668. {
  669. return $this->orders;
  670. }
  671. public function addOrder(Order $order): self
  672. {
  673. if (!$this->orders->contains($order)) {
  674. $this->orders[] = $order;
  675. $order->setWidget($this);
  676. }
  677. return $this;
  678. }
  679. public function removeOrder(Order $order): self
  680. {
  681. if ($this->orders->removeElement($order)) {
  682. // set the owning side to null (unless already changed)
  683. if ($order->getWidget() === $this) {
  684. $order->setWidget(null);
  685. }
  686. }
  687. return $this;
  688. }
  689. /**
  690. * @return Collection|UserFile[]
  691. */
  692. public function getUserFiles(): Collection
  693. {
  694. return $this->userFiles;
  695. }
  696. public function addUserFile(UserFile $userFile): self
  697. {
  698. if (!$this->userFiles->contains($userFile)) {
  699. $this->userFiles[] = $userFile;
  700. $userFile->setWidget($this);
  701. }
  702. return $this;
  703. }
  704. public function removeUserFile(UserFile $userFile): self
  705. {
  706. if ($this->userFiles->removeElement($userFile)) {
  707. // set the owning side to null (unless already changed)
  708. if ($userFile->getWidget() === $this) {
  709. $userFile->setWidget(null);
  710. }
  711. }
  712. return $this;
  713. }
  714. /**
  715. * @return string[]|null
  716. * @OA\Property(
  717. * type="string[]"
  718. * )
  719. */
  720. public function getCovers(): ?array
  721. {
  722. if(null !== $this->covers) {
  723. uasort($this->covers, function ($a,$b) { return $a['sortOrder'] >= $b['sortOrder'] ? 1 : -1; } );
  724. }
  725. return $this->covers??[];
  726. }
  727. public function setCovers(?array $covers): self
  728. {
  729. usort($covers, function ($a, $b) {
  730. return $b['sortOrder'] < $a['sortOrder'] ? 1 : -1;
  731. });
  732. $this->covers = $covers;
  733. return $this;
  734. }
  735. public function getOrderServiceDsnLogin(): ?string
  736. {
  737. return $this->order_service_dsn_login;
  738. }
  739. public function setOrderServiceDsnLogin(?string $order_service_dsn_login): self
  740. {
  741. $this->order_service_dsn_login = $order_service_dsn_login;
  742. return $this;
  743. }
  744. public function getOrderServiceDsnPassword(): ?string
  745. {
  746. return $this->order_service_dsn_password;
  747. }
  748. public function setOrderServiceDsnPassword(?string $order_service_dsn_password): self
  749. {
  750. $this->order_service_dsn_password = $order_service_dsn_password;
  751. return $this;
  752. }
  753. public function getOrderServiceDsnUrl(): ?string
  754. {
  755. return $this->order_service_dsn_url;
  756. }
  757. public function setOrderServiceDsnUrl(?string $order_service_dsn_url): self
  758. {
  759. $this->order_service_dsn_url = $order_service_dsn_url;
  760. return $this;
  761. }
  762. public function getOrderServiceDsnPort(): ?string
  763. {
  764. return $this->order_service_dsn_port;
  765. }
  766. public function setOrderServiceDsnPort(?string $order_service_dsn_port): self
  767. {
  768. $this->order_service_dsn_port = $order_service_dsn_port;
  769. return $this;
  770. }
  771. public function getIdMetricGoogle(): ?string
  772. {
  773. return $this->id_metric_google;
  774. }
  775. public function setIdMetricGoogle(?string $id_metric_google): self
  776. {
  777. $this->id_metric_google = $id_metric_google;
  778. return $this;
  779. }
  780. public function getIdMetricYandex(): ?string
  781. {
  782. return $this->id_metric_yandex;
  783. }
  784. public function setIdMetricYandex(?string $id_metric_yandex): self
  785. {
  786. $this->id_metric_yandex = $id_metric_yandex;
  787. return $this;
  788. }
  789. /**
  790. * @return Collection<int, WidgetUser>
  791. */
  792. public function getWidgetUsers(): Collection
  793. {
  794. return $this->widgetUsers;
  795. }
  796. public function addWidgetUser(WidgetUser $widgetUser): self
  797. {
  798. if (!$this->widgetUsers->contains($widgetUser)) {
  799. $this->widgetUsers[] = $widgetUser;
  800. $widgetUser->addWiget($this);
  801. }
  802. return $this;
  803. }
  804. public function removeWidgetUser(WidgetUser $widgetUser): self
  805. {
  806. if ($this->widgetUsers->removeElement($widgetUser)) {
  807. $widgetUser->removeWiget($this);
  808. }
  809. return $this;
  810. }
  811. public function getCustomDesign(): ?bool
  812. {
  813. return $this->customDesign;
  814. }
  815. public function setCustomDesign(?bool $customDesign): self
  816. {
  817. $this->customDesign = $customDesign;
  818. return $this;
  819. }
  820. /**
  821. * @return string[]|null
  822. */
  823. public function getUsageRules(): ?array
  824. {
  825. return $this->usageRules;
  826. }
  827. public function setUsageRules(?array $usageRules): self
  828. {
  829. $this->usageRules = $usageRules;
  830. return $this;
  831. }
  832. public function getBackgroundImage(): ?string
  833. {
  834. return $this->backgroundImage;
  835. }
  836. public function setBackgroundImage(?string $backgroundImage): self
  837. {
  838. $this->backgroundImage = $backgroundImage;
  839. return $this;
  840. }
  841. /**
  842. * @return array
  843. */
  844. public function getProductsAsArray(): array
  845. {
  846. return explode(',', $this->products);
  847. }
  848. /**
  849. * @return array|null
  850. */
  851. public function getSaleProductIds(): ?array
  852. {
  853. return $this->saleProductIds;
  854. }
  855. /**
  856. * @param array|null $saleProductIds
  857. * @return Widget
  858. */
  859. public function setSaleProductIds(?array $saleProductIds): self
  860. {
  861. $this->saleProductIds = $saleProductIds;
  862. return $this;
  863. }
  864. /**
  865. * @return string|null
  866. */
  867. public function getSaleImage(): ?string
  868. {
  869. return $this->saleImage;
  870. }
  871. /**
  872. * @param string|null $saleImage
  873. * @return Widget
  874. */
  875. public function setSaleImage(?string $saleImage): self
  876. {
  877. $this->saleImage = $saleImage;
  878. return $this;
  879. }
  880. /**
  881. * @return string|null
  882. */
  883. public function getSaleColor(): ?string
  884. {
  885. return $this->saleColor;
  886. }
  887. /**
  888. * @param string|null $saleColor
  889. * @return Widget
  890. */
  891. public function setSaleColor(?string $saleColor): self
  892. {
  893. $this->saleColor = $saleColor;
  894. return $this;
  895. }
  896. /**
  897. * @return bool
  898. */
  899. public function getCanWholesale(): bool
  900. {
  901. return $this->canWholesale;
  902. }
  903. /**
  904. * @param bool $canWholesale
  905. * @return Widget
  906. */
  907. public function setCanWholesale(bool $canWholesale): self
  908. {
  909. $this->canWholesale = $canWholesale;
  910. return $this;
  911. }
  912. /**
  913. * @return string|null
  914. */
  915. public function getBxCorporateScript(): ?string
  916. {
  917. return $this->bxCorporateScript;
  918. }
  919. /**
  920. * @param string $bxCorporateScript
  921. * @return Widget
  922. */
  923. public function setBxCorporateScript(string $bxCorporateScript): self
  924. {
  925. $this->bxCorporateScript = $bxCorporateScript;
  926. return $this;
  927. }
  928. /**
  929. * @return bool
  930. */
  931. public function getEnableBxCorporateScript(): bool
  932. {
  933. return $this->enableBxCorporateScript;
  934. }
  935. /**
  936. * @param bool $enableBxCorporateScript
  937. * @return $this
  938. */
  939. public function setEnableBxCorporateScript(bool $enableBxCorporateScript): self
  940. {
  941. $this->enableBxCorporateScript = $enableBxCorporateScript;
  942. return $this;
  943. }
  944. /**
  945. * @return string
  946. */
  947. public function getHashedId(): string
  948. {
  949. return hash('sha256', $this->getId());
  950. }
  951. /**
  952. * @return bool
  953. */
  954. public function getProductDefaultRemains(): bool
  955. {
  956. return $this->productDefaultRemains;
  957. }
  958. /**
  959. * @param mixed $productDefaultRemains
  960. */
  961. public function setProductDefaultRemains(bool $productDefaultRemains): self
  962. {
  963. $this->productDefaultRemains = $productDefaultRemains;
  964. return $this;
  965. }
  966. /**
  967. * @return bool
  968. */
  969. public function isAiTextEnable(): bool
  970. {
  971. return $this->aiTextEnable;
  972. }
  973. /**
  974. * @param bool $aiTextEnable
  975. * @return $this
  976. */
  977. public function setAiTextEnable(bool $aiTextEnable): self
  978. {
  979. $this->aiTextEnable = $aiTextEnable;
  980. return $this;
  981. }
  982. /**
  983. * @return bool
  984. */
  985. public function isAiImageEnable(): bool
  986. {
  987. return $this->aiImageEnable;
  988. }
  989. /**
  990. * @param bool $aiImageEnable
  991. * @return $this
  992. */
  993. public function setAiImageEnable(bool $aiImageEnable): self
  994. {
  995. $this->aiImageEnable = $aiImageEnable;
  996. return $this;
  997. }
  998. /**
  999. * @return bool
  1000. */
  1001. public function isSendSmsPin(): bool
  1002. {
  1003. return $this->sendSmsPin;
  1004. }
  1005. /**
  1006. * @param bool $sendSmsPin
  1007. * @return $this
  1008. */
  1009. public function setSendSmsPin(bool $sendSmsPin): self
  1010. {
  1011. $this->sendSmsPin = $sendSmsPin;
  1012. return $this;
  1013. }
  1014. /**
  1015. * @return string
  1016. */
  1017. public function isSupplierId(): string
  1018. {
  1019. return $this->supplierId;
  1020. }
  1021. /**
  1022. * @param string $supplierId
  1023. * @return $this
  1024. */
  1025. public function setSupplierId(string $supplierId): self
  1026. {
  1027. $this->supplierId = $supplierId;
  1028. return $this;
  1029. }
  1030. }