<?php
namespace App\Entity;
use App\Constants\ActiveConstants;
use App\Repository\CompanyRepository;
use App\Traits\ActivityTrait;
use App\Traits\SlugTrait;
use App\Traits\TimeTrackTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
#[ORM\Table(name: 'company')]
#[ORM\HasLifecycleCallbacks]
class Company
{
use SlugTrait;
use TimeTrackTrait;
use ActivityTrait;
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
#[ORM\ManyToOne(targetEntity: "App\Entity\SonataMediaMedia", cascade: ['all'])]
#[ORM\JoinColumn(name: 'main_image_id', nullable: true, onDelete: 'SET NULL')]
protected $mainImage;
#[ORM\ManyToOne(targetEntity: "App\Entity\SonataMediaMedia", cascade: ['all'])]
#[ORM\JoinColumn(name: 'favicon_id', nullable: true, onDelete: 'SET NULL')]
protected $favicon;
#[ORM\Column(type: 'text')]
private ?string $fopData = null;
#[ORM\Column(type: 'text')]
private ?string $fop = null;
#[ORM\Column(type: 'text')]
private ?string $offert = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $sirTrevorContent = null;
#[ORM\Column(name: 'tax_active', type: 'boolean', options: ['default' => 1])]
private $taxActive = null;
#[ORM\Column(name: 'checkbox_enabled', type: 'boolean', options: ['default' => 0])]
private $checkboxEnabled = null;
#[ORM\Column(name: 'checkbox_login', type: 'text', nullable: true)]
private $checkboxLogin;
#[ORM\Column(name: 'checkbox_pass', type: 'text', nullable: true)]
private $checkboxPass;
#[ORM\Column(name: 'checkbox_secret', type: 'text', nullable: true)]
private $checkboxSecret;
#[ORM\ManyToMany(targetEntity: "App\Entity\User", inversedBy: 'companies', cascade: ['persist'], orphanRemoval: false)]
#[ORM\JoinTable(name: 'users_companies')]
#[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\InverseJoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
private $users;
#[ORM\ManyToMany(targetEntity: Operator::class, mappedBy: 'companies')]
private Collection $operators;
#[ORM\ManyToMany(targetEntity: Tariff::class, mappedBy: 'companies')]
private Collection $tariffs;
#[ORM\ManyToMany(targetEntity: Page::class, mappedBy: 'companies')]
private Collection $pages;
#[Assert\NotNull]
#[ORM\Column(name: 'title', type: 'string', length: 255)]
private $title;
#[ORM\Column(name: 'mail_description', type: 'text', nullable: true)]
private $mailDescription;
#[ORM\Column(name: 'background_color', type: 'string', length: 191, nullable: true)]
protected $backgroundColor;
#[ORM\Column(name: 'way_for_pay_account', type: 'string', length: 191, nullable: true)]
protected $wayForPayAccount;
#[ORM\Column(name: 'way_for_pay_secret', type: 'string', length: 191, nullable: true)]
protected $wayForPaySecret;
#[ORM\Column(name: 'button_color', type: 'string', length: 191, nullable: true)]
protected $buttonColor;
#[ORM\Column(name: 'button_border', type: 'integer', length: 11, nullable: true)]
protected $buttonBorder;
#[ORM\Column(name: 'text_button_color', type: 'string', length: 191, nullable: true)]
protected $textButtonColor;
//
#[ORM\Column(name: 'fonts', type: 'text', nullable: true)]
protected $fonts;
#[ORM\Column(name: 'font_family', type: 'text', nullable: true)]
protected $fontFamily;
#[ORM\Column(name: 'not_filled_button_color', type: 'string', length: 191, nullable: true)]
protected $notFilledButtonColor;
protected bool $notFilledButtonBackgroundHide = false;
#[ORM\Column(name: 'not_filled_button_border', type: 'string', length: 191, nullable: true)]
protected $notFilledButtonBorder;
#[ORM\Column(name: 'not_filled_button_text_color', type: 'string', length: 191, nullable: true)]
protected $notFilledButtonTextColor;
#[ORM\Column(name: 'link_text_color', type: 'string', length: 191, nullable: true)]
protected $linkTextColor;
#[ORM\Column(name: 'back_button_color', type: 'string', length: 191, nullable: true)]
protected $backButtonColor;
#[ORM\Column(name: 'timer_text_color', type: 'string', length: 191, nullable: true)]
protected $timerTextColor;
#[ORM\Column(name: 'tariff_background_color', type: 'string', length: 191, nullable: true)]
protected $tariffBackgroundColor;
#[ORM\Column(name: 'tariff_text_color', type: 'string', length: 191, nullable: true)]
protected $tariffTextColor;
#[ORM\Column(name: 'tariff_text_align', type: 'string', length: 191, nullable: true)]
protected $tariffTextAlign;
#[ORM\Column(name: 'title_text_color', type: 'string', length: 191, nullable: true)]
protected $titleTextColor;
#[ORM\Column(name: 'title_text_align', type: 'string', length: 191, nullable: true)]
protected $titleTextAlign;
#[ORM\Column(name: 'second_title_text_color', type: 'string', length: 191, nullable: true)]
protected $secondTitleTextColor;
#[ORM\Column(name: 'second_title_text_align', type: 'string', length: 191, nullable: true)]
protected $secondTitleTextAlign;
#[ORM\Column(name: 'description_text_align', type: 'string', length: 191, nullable: true)]
protected $descriptionTextAlign;
#[ORM\Column(name: 'tariff_style_type', type: 'string', length: 191, nullable: true)]
protected $tariffStyleType;
#[ORM\ManyToMany(targetEntity: FaqQuestion::class, mappedBy: 'companies')]
private Collection $faqQuestions;
#[ORM\OneToMany(mappedBy: 'company', targetEntity: Order::class)]
private Collection $orders;
#[ORM\Column(name: 'random_operators', type: 'boolean', options: ['default' => 0])]
private ?bool $randomOperators;
#[ORM\Column(name: 'random_operators_from', type: 'time', nullable: true)]
private $randomOperatorsFrom;
#[ORM\Column(name: 'random_operators_to', type: 'time', nullable: true)]
private $randomOperatorsTo;
#[ORM\Column(name: 'payment_description', type: 'text', nullable: true)]
protected $paymentDescription;
#[ORM\Column(name: 'payment_description_kyivstar', type: 'text', nullable: true)]
protected $paymentDescriptionKyivstar;
#[ORM\Column(name: 'payment_type', type: 'integer', nullable: false, options: ['default' => 1])]
protected $paymentType;
#[ORM\Column(name: 'footer_email', type: 'string', length: 191, nullable: true)]
private $footerEmail = null;
#[ORM\Column(name: 'footer_phone', type: 'string', length: 191, nullable: true)]
private $footerPhone = null;
#[ORM\Column(name: 'display_version', type: 'integer', nullable: false, options: ['default' => 0])]
protected $displayVersion;
#[ORM\Column(name: 'custom_scripts', type: 'text', nullable: true)]
protected $customScripts = null;
private $apiError = null;
#[ORM\Column(name: 'promo_code_visible', type: 'boolean', options: ['default' => 1])]
private $promoCodeVisible = true;
#[ORM\Column(name: 'header_visible', type: 'boolean', options: ['default' => 1])]
private $headerVisible = true;
#[ORM\Column(name: 'footer_visible', type: 'boolean', options: ['default' => 1])]
private $footerVisible = true;
public function __construct()
{
$this->users = new ArrayCollection();
$this->operators = new ArrayCollection();
$this->faqQuestions = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->tariffs = new ArrayCollection();
$this->pages = new ArrayCollection();
}
public function __toString()
{
return is_null($this->getTitle()) ? '' : $this->getTitle();
}
/**
* Set slug.
*
* @param string $slug
*
* @return Company
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug.
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set createdAt.
*
* @param \DateTime|null $createdAt
*
* @return Company
*/
public function setCreatedAt($createdAt = null)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt.
*
* @return \DateTime|null
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt.
*
* @param \DateTime|null $updatedAt
*
* @return Company
*/
public function setUpdatedAt($updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt.
*
* @return \DateTime|null
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set active.
*
* @param int $active
*
* @return Company
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active.
*
* @return int
*/
public function getActive()
{
return $this->active;
}
public function getActiveLabel(): string
{
return $this->active ? ActiveConstants::LABEL_YES : ActiveConstants::LABEL_NO;
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getBackgroundColor(): ?string
{
return $this->backgroundColor;
}
public function setBackgroundColor(?string $backgroundColor): static
{
$this->backgroundColor = $backgroundColor;
return $this;
}
public function getButtonColor(): ?string
{
return $this->buttonColor;
}
public function setButtonColor(?string $buttonColor): static
{
$this->buttonColor = $buttonColor;
return $this;
}
public function getButtonBorder(): ?int
{
return $this->buttonBorder;
}
public function setButtonBorder(?int $buttonBorder): static
{
$this->buttonBorder = $buttonBorder;
return $this;
}
public function getTextButtonColor(): ?string
{
return $this->textButtonColor;
}
public function setTextButtonColor(?string $textButtonColor): static
{
$this->textButtonColor = $textButtonColor;
return $this;
}
public function getMainImage(): ?SonataMediaMedia
{
return $this->mainImage;
}
public function setMainImage(?SonataMediaMedia $mainImage): static
{
$this->mainImage = $mainImage;
return $this;
}
public function getFavicon(): ?SonataMediaMedia
{
return $this->favicon;
}
public function setFavicon(?SonataMediaMedia $favicon): static
{
$this->favicon = $favicon;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): static
{
if (!$this->users->contains($user)) {
$this->users->add($user);
}
return $this;
}
public function removeUser(User $user): static
{
$this->users->removeElement($user);
return $this;
}
/**
* @return Collection<int, Operator>
*/
public function getOperators(): Collection
{
return $this->operators;
}
public function addOperator(Operator $operator): static
{
if (!$this->operators->contains($operator)) {
$this->operators->add($operator);
$operator->addCompany($this);
}
return $this;
}
public function removeOperator(Operator $operator): static
{
if ($this->operators->removeElement($operator)) {
$operator->removeCompany($this);
}
return $this;
}
/**
* @return Collection<int, FaqQuestion>
*/
public function getFaqQuestions(): Collection
{
return $this->faqQuestions;
}
public function addFaqQuestion(FaqQuestion $faqQuestion): static
{
if (!$this->faqQuestions->contains($faqQuestion)) {
$this->faqQuestions->add($faqQuestion);
$faqQuestion->setCompany($this);
}
return $this;
}
public function removeFaqQuestion(FaqQuestion $faqQuestion): static
{
if ($this->faqQuestions->removeElement($faqQuestion)) {
// set the owning side to null (unless already changed)
if ($faqQuestion->getCompany() === $this) {
$faqQuestion->setCompany(null);
}
}
return $this;
}
public function getMailDescription(): ?string
{
return $this->mailDescription;
}
public function setMailDescription(?string $mailDescription): static
{
$this->mailDescription = $mailDescription;
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): static
{
if (!$this->orders->contains($order)) {
$this->orders->add($order);
$order->setCompany($this);
}
return $this;
}
public function removeOrder(Order $order): static
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getCompany() === $this) {
$order->setCompany(null);
}
}
return $this;
}
public function getWayForPayAccount(): ?string
{
return $this->wayForPayAccount;
}
public function setWayForPayAccount(?string $wayForPayAccount): static
{
$this->wayForPayAccount = $wayForPayAccount;
return $this;
}
public function getWayForPaySecret(): ?string
{
return $this->wayForPaySecret;
}
public function setWayForPaySecret(?string $wayForPaySecret): static
{
$this->wayForPaySecret = $wayForPaySecret;
return $this;
}
public function getFopData(): ?string
{
return $this->fopData;
}
public function setFopData(?string $fopData): static
{
$this->fopData = $fopData;
return $this;
}
/**
* @return Collection<int, Tariff>
*/
public function getTariffs(): Collection
{
return $this->tariffs;
}
public function addTariff(Tariff $tariff): static
{
if (!$this->tariffs->contains($tariff)) {
$this->tariffs->add($tariff);
$tariff->addCompany($this);
}
return $this;
}
public function removeTariff(Tariff $tariff): static
{
if ($this->tariffs->removeElement($tariff)) {
$tariff->removeCompany($this);
}
return $this;
}
/**
* @return Collection<int, Page>
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): static
{
if (!$this->pages->contains($page)) {
$this->pages->add($page);
$page->addCompany($this);
}
return $this;
}
public function removePage(Page $page): static
{
if ($this->pages->removeElement($page)) {
$page->removeCompany($this);
}
return $this;
}
public function getRandomOperators(): ?bool
{
return $this->randomOperators;
}
public function setRandomOperators(bool $randomOperators): static
{
$this->randomOperators = $randomOperators;
return $this;
}
public function getRandomOperatorsFrom(): ?\DateTimeInterface
{
return $this->randomOperatorsFrom;
}
public function setRandomOperatorsFrom(?\DateTimeInterface $randomOperatorsFrom): static
{
$this->randomOperatorsFrom = $randomOperatorsFrom;
return $this;
}
public function getRandomOperatorsTo(): ?\DateTimeInterface
{
return $this->randomOperatorsTo;
}
public function setRandomOperatorsTo(?\DateTimeInterface $randomOperatorsTo): static
{
$this->randomOperatorsTo = $randomOperatorsTo;
return $this;
}
public function getFop(): ?string
{
return $this->fop;
}
public function setFop(string $fop): static
{
$this->fop = $fop;
return $this;
}
public function isTaxActive(): ?bool
{
return $this->taxActive;
}
public function setTaxActive(bool $taxActive): static
{
$this->taxActive = $taxActive;
return $this;
}
public function isRandomOperators(): ?bool
{
return $this->randomOperators;
}
public function getTaxPercent(): int
{
return 20;
}
public function getPaymentDescription(): ?string
{
return $this->paymentDescription;
}
public function setPaymentDescription(?string $paymentDescription): static
{
$this->paymentDescription = $paymentDescription;
return $this;
}
public function getPaymentType(): ?int
{
return $this->paymentType;
}
public function setPaymentType(int $paymentType): static
{
$this->paymentType = $paymentType;
return $this;
}
public function getFonts(): ?string
{
return $this->fonts;
}
public function setFonts(?string $fonts): static
{
$this->fonts = $fonts;
return $this;
}
public function getNotFilledButtonColor(): ?string
{
return $this->notFilledButtonColor;
}
public function setNotFilledButtonColor(?string $notFilledButtonColor): static
{
$this->notFilledButtonColor = $notFilledButtonColor;
return $this;
}
public function getNotFilledButtonBorder(): ?string
{
return $this->notFilledButtonBorder;
}
public function setNotFilledButtonBorder(?string $notFilledButtonBorder): static
{
$this->notFilledButtonBorder = $notFilledButtonBorder;
return $this;
}
public function getNotFilledButtonTextColor(): ?string
{
return $this->notFilledButtonTextColor;
}
public function setNotFilledButtonTextColor(?string $notFilledButtonTextColor): static
{
$this->notFilledButtonTextColor = $notFilledButtonTextColor;
return $this;
}
public function getLinkTextColor(): ?string
{
return $this->linkTextColor;
}
public function setLinkTextColor(?string $linkTextColor): static
{
$this->linkTextColor = $linkTextColor;
return $this;
}
public function getBackButtonColor(): ?string
{
return $this->backButtonColor;
}
public function setBackButtonColor(?string $backButtonColor): static
{
$this->backButtonColor = $backButtonColor;
return $this;
}
public function getTimerTextColor(): ?string
{
return $this->timerTextColor;
}
public function setTimerTextColor(?string $timerTextColor): static
{
$this->timerTextColor = $timerTextColor;
return $this;
}
public function getTariffBackgroundColor(): ?string
{
return $this->tariffBackgroundColor;
}
public function setTariffBackgroundColor(?string $tariffBackgroundColor): static
{
$this->tariffBackgroundColor = $tariffBackgroundColor;
return $this;
}
public function getTariffTextColor(): ?string
{
return $this->tariffTextColor;
}
public function setTariffTextColor(?string $tariffTextColor): static
{
$this->tariffTextColor = $tariffTextColor;
return $this;
}
public function getTariffTextAlign(): ?string
{
return $this->tariffTextAlign;
}
public function setTariffTextAlign(?string $tariffTextAlign): static
{
$this->tariffTextAlign = $tariffTextAlign;
return $this;
}
public function getTitleTextColor(): ?string
{
return $this->titleTextColor;
}
public function setTitleTextColor(?string $titleTextColor): static
{
$this->titleTextColor = $titleTextColor;
return $this;
}
public function getTitleTextAlign(): ?string
{
return $this->titleTextAlign;
}
public function setTitleTextAlign(?string $titleTextAlign): static
{
$this->titleTextAlign = $titleTextAlign;
return $this;
}
public function getFontFamily(): ?string
{
return $this->fontFamily;
}
public function isPromoCodeVisible(): ?bool
{
return $this->promoCodeVisible;
}
public function setPromoCodeVisible(bool $promoCodeVisible): static
{
$this->promoCodeVisible = $promoCodeVisible;
return $this;
}
public function setFontFamily(?string $fontFamily): static
{
$this->fontFamily = $fontFamily;
return $this;
}
public function getNotFilledButtonBackgroundHide(): bool
{
return is_null($this->getNotFilledButtonColor());
}
public function setNotFilledButtonBackgroundHide($bool): static
{
if ($bool) {
$this->setNotFilledButtonColor(null);
}
return $this;
}
public function getTariffStyleType(): ?string
{
return $this->tariffStyleType;
}
public function setTariffStyleType(?string $tariffStyleType): static
{
$this->tariffStyleType = $tariffStyleType;
return $this;
}
public function getSecondTitleTextColor(): ?string
{
return $this->secondTitleTextColor;
}
public function setSecondTitleTextColor(?string $secondTitleTextColor): static
{
$this->secondTitleTextColor = $secondTitleTextColor;
return $this;
}
public function getSecondTitleTextAlign(): ?string
{
return $this->secondTitleTextAlign;
}
public function setSecondTitleTextAlign(?string $secondTitleTextAlign): static
{
$this->secondTitleTextAlign = $secondTitleTextAlign;
return $this;
}
public function getDescriptionTextAlign(): ?string
{
return $this->descriptionTextAlign;
}
public function setDescriptionTextAlign(?string $descriptionTextAlign): static
{
$this->descriptionTextAlign = $descriptionTextAlign;
return $this;
}
public function isCheckboxEnabled(): ?bool
{
return $this->checkboxEnabled;
}
public function getCheckboxEnabled(): ?bool
{
return $this->checkboxEnabled;
}
public function setCheckboxEnabled(bool $checkboxEnabled): static
{
$this->checkboxEnabled = $checkboxEnabled;
return $this;
}
public function getCheckboxLogin(): ?string
{
return $this->checkboxLogin;
}
public function setCheckboxLogin(?string $checkboxLogin): static
{
$this->checkboxLogin = $checkboxLogin;
return $this;
}
public function getCheckboxPass(): ?string
{
return $this->checkboxPass;
}
public function setCheckboxPass(?string $checkboxPass): static
{
$this->checkboxPass = $checkboxPass;
return $this;
}
public function getCheckboxSecret(): ?string
{
return $this->checkboxSecret;
}
public function setCheckboxSecret(?string $checkboxSecret): static
{
$this->checkboxSecret = $checkboxSecret;
return $this;
}
public function getOffert(): ?string
{
return $this->offert;
}
public function setOffert(?string $offert): static
{
$this->offert = $offert;
return $this;
}
public function getPaymentDescriptionKyivstar(): ?string
{
return $this->paymentDescriptionKyivstar;
}
public function setPaymentDescriptionKyivstar(?string $paymentDescription): static
{
$this->paymentDescriptionKyivstar = $paymentDescription;
return $this;
}
public function getSirTrevorContent(): ?string
{
return $this->sirTrevorContent;
}
public function setSirTrevorContent(?string $sirTrevorContent): static
{
$this->sirTrevorContent = $sirTrevorContent;
return $this;
}
public function getFooterEmail(): ?string
{
return $this->footerEmail;
}
public function setFooterEmail(?string $footerEmail): static
{
$this->footerEmail = $footerEmail;
return $this;
}
public function getFooterPhone(): ?string
{
return $this->footerPhone;
}
public function setFooterPhone(?string $footerPhone): static
{
$this->footerPhone = $footerPhone;
return $this;
}
public function getDisplayVersion(): ?int
{
return $this->displayVersion;
}
public function setDisplayVersion(int $displayVersion): static
{
$this->displayVersion = $displayVersion;
return $this;
}
public function getCustomScripts(): ?string
{
return $this->customScripts;
}
public function setCustomScripts(?string $customScripts): static
{
$this->customScripts = $customScripts;
return $this;
}
public function isHeaderVisible(): ?bool
{
return $this->headerVisible;
}
public function setHeaderVisible(bool $headerVisible): static
{
$this->headerVisible = $headerVisible;
return $this;
}
public function isFooterVisible(): ?bool
{
return $this->footerVisible;
}
public function setFooterVisible(bool $footerVisible): static
{
$this->footerVisible = $footerVisible;
return $this;
}
public function setApiError(mixed $apiError): static
{
$this->apiError = $apiError;
return $this;
}
public function getApiError()
{
return $this->apiError;
}
}