<?php
namespace App\Entity;
use App\Repository\TariffRepository;
use App\Traits\ActivityTrait;
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;
#[ORM\Entity(repositoryClass: TariffRepository::class)]
class Tariff
{
use TimeTrackTrait;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[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: 'promo_image_id', nullable: true, onDelete: 'SET NULL')]
protected $promoImage;
#[ORM\ManyToOne(targetEntity: "App\Entity\SonataMediaMedia", cascade: ['all'])]
#[ORM\JoinColumn(name: 'desktop_selection_image_id', nullable: true, onDelete: 'SET NULL')]
protected $desktopSelectionImage;
#[ORM\ManyToOne(targetEntity: "App\Entity\SonataMediaMedia", cascade: ['all'])]
#[ORM\JoinColumn(name: 'mobile_selection_image_id', nullable: true, onDelete: 'SET NULL')]
protected $mobileSelectionImage;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $promoImageUrl = null;
#[ORM\ManyToMany(targetEntity: "App\Entity\Company", cascade: ['persist'], orphanRemoval: false)]
#[ORM\JoinTable(name: 'tariffs_promo_image_companies')]
#[ORM\JoinColumn(name: 'tariff_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\InverseJoinColumn(name: 'company_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
private $promoImageCompanies;
#[ORM\Column(name: 'active', type: 'boolean', options: ['default' => 1])]
private bool $active;
#[ORM\ManyToMany(targetEntity: "App\Entity\Company", inversedBy: 'tariffs', cascade: ['persist'], orphanRemoval: false)]
#[ORM\JoinTable(name: 'tariffs_companies')]
#[ORM\JoinColumn(name: 'tariff_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\InverseJoinColumn(name: 'company_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
private $companies;
#[ORM\Column(length: 191)]
private ?string $name = null;
#[ORM\Column]
private ?float $price = null;
#[ORM\Column(name: 'sale_price', type: 'float', nullable: true)]
private ?float $salePrice = null;
#[ORM\Column(name: 'in_feed', type: 'boolean', options: ['default' => 1])]
private bool $inFeed = true;
#[ORM\Column(name: 'in_stock', type: 'boolean', options: ['default' => 1])]
private bool $inStock = true;
#[ORM\Column(name: "info_code", type: "text", nullable: true)]
private ?string $infoCode = null;
#[ORM\Column(type: 'string', length: 191)]
private ?string $subscription = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $imageLink = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $apiCode = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $bottomDescription = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $shortDescription = null;
#[ORM\Column(name: 'slug', type: 'string', length: 191, unique: true, nullable: true)]
private $slug;
#[ORM\Column(type: 'string', length: 191, nullable: true)]
private ?string $reference = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $shortInfo = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $detailedInfo = null;
#[ORM\Column(type: 'string', length: 191, nullable: true)]
private ?string $detailsButtonText = null;
#[ORM\Column(type: 'string', length: 191, nullable: true)]
private ?string $detailsButtonUrl = null;
#[ORM\ManyToOne(targetEntity: Operator::class, inversedBy: 'tariffs')]
#[ORM\JoinColumn(nullable: false)]
private ?Operator $operator = null;
#[ORM\OneToMany(mappedBy: 'tariff', targetEntity: PhoneNumber::class, orphanRemoval: true)]
private Collection $phoneNumbers;
public function __construct()
{
$this->phoneNumbers = new ArrayCollection();
$this->companies = new ArrayCollection();
$this->promoImageCompanies = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): static
{
$this->price = $price;
return $this;
}
public function getSalePrice(): ?float
{
return $this->salePrice;
}
public function setSalePrice(?float $salePrice): static
{
$this->salePrice = $salePrice;
return $this;
}
public function isInFeed(): bool
{
return $this->inFeed;
}
public function setInFeed(bool $inFeed): static
{
$this->inFeed = $inFeed;
return $this;
}
public function isInStock(): bool
{
return $this->inStock;
}
public function setInStock(bool $inStock): static
{
$this->inStock = $inStock;
return $this;
}
public function getSubscription(): ?string
{
return $this->subscription;
}
public function setSubscription(string $subscription): static
{
$this->subscription = $subscription;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getOperator(): ?Operator
{
return $this->operator;
}
public function setOperator(?Operator $operator): static
{
$this->operator = $operator;
return $this;
}
/**
* @return Collection<int, PhoneNumber>
*/
public function getPhoneNumbers(): Collection
{
return $this->phoneNumbers;
}
public function addPhoneNumber(PhoneNumber $phoneNumber): static
{
if (!$this->phoneNumbers->contains($phoneNumber)) {
$this->phoneNumbers->add($phoneNumber);
$phoneNumber->setTariff($this);
}
return $this;
}
public function removePhoneNumber(PhoneNumber $phoneNumber): static
{
if ($this->phoneNumbers->removeElement($phoneNumber)) {
// set the owning side to null (unless already changed)
if ($phoneNumber->getTariff() === $this) {
$phoneNumber->setTariff(null);
}
}
return $this;
}
/**
* Set createdAt.
*
* @param \DateTime|null $createdAt
*
* @return Tariff
*/
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 Tariff
*/
public function setUpdatedAt($updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt.
*
* @return \DateTime|null
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function getPromoImage(): ?SonataMediaMedia
{
return $this->promoImage;
}
public function setPromoImage(?SonataMediaMedia $promoImage): static
{
$this->promoImage = $promoImage;
return $this;
}
public function getPromoImageUrl(): ?string
{
return $this->promoImageUrl;
}
public function setPromoImageUrl(?string $promoImageUrl): static
{
$this->promoImageUrl = $promoImageUrl;
return $this;
}
public function getPromoImageCompanies(): Collection
{
return $this->promoImageCompanies;
}
public function addPromoImageCompany(Company $company): static
{
if (!$this->promoImageCompanies->contains($company)) {
$this->promoImageCompanies->add($company);
}
return $this;
}
public function removePromoImageCompany(Company $company): static
{
$this->promoImageCompanies->removeElement($company);
return $this;
}
public function __toString()
{
return $this->getName();
}
public function getMainImage(): ?SonataMediaMedia
{
return $this->mainImage;
}
public function setMainImage(?SonataMediaMedia $mainImage): static
{
$this->mainImage = $mainImage;
return $this;
}
public function getDesktopSelectionImage(): ?SonataMediaMedia
{
return $this->desktopSelectionImage;
}
public function setDesktopSelectionImage(?SonataMediaMedia $desktopSelectionImage): static
{
$this->desktopSelectionImage = $desktopSelectionImage;
return $this;
}
public function getMobileSelectionImage(): ?SonataMediaMedia
{
return $this->mobileSelectionImage;
}
public function setMobileSelectionImage(?SonataMediaMedia $mobileSelectionImage): static
{
$this->mobileSelectionImage = $mobileSelectionImage;
return $this;
}
public function getBottomDescription(): ?string
{
return $this->bottomDescription;
}
public function setBottomDescription(?string $bottomDescription): static
{
$this->bottomDescription = $bottomDescription;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(?string $shortDescription): static
{
$this->shortDescription = $shortDescription;
return $this;
}
/**
* @return Collection<int, Company>
*/
public function getCompanies(): Collection
{
return $this->companies;
}
public function addCompany(Company $company): static
{
if (!$this->companies->contains($company)) {
$this->companies->add($company);
}
return $this;
}
public function removeCompany(Company $company): static
{
$this->companies->removeElement($company);
return $this;
}
/**
* Set active.
*
* @param int $active
*
* @return Tariff
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active.
*
* @return int
*/
public function getActive()
{
return $this->active;
}
public function isActive(): ?bool
{
return $this->active;
}
public function getInfoCode(): ?string
{
return $this->infoCode;
}
public function setInfoCode(?string $infoCode): static
{
$this->infoCode = $infoCode;
return $this;
}
public function getImageLink(): ?string
{
return $this->imageLink;
}
public function setImageLink(?string $imageLink): static
{
$this->imageLink = $imageLink;
return $this;
}
public function getApiCode(): ?string
{
return $this->apiCode;
}
public function setApiCode(?string $apiCode): static
{
$this->apiCode = $apiCode;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): static
{
$this->reference = $reference;
return $this;
}
public function getShortInfo(): ?string
{
return $this->shortInfo;
}
public function setShortInfo(?string $shortInfo): static
{
$this->shortInfo = $shortInfo;
return $this;
}
public function getDetailedInfo(): ?string
{
return $this->detailedInfo;
}
public function setDetailedInfo(?string $detailedInfo): static
{
$this->detailedInfo = $detailedInfo;
return $this;
}
public function getDetailsButtonText(): ?string
{
return $this->detailsButtonText;
}
public function setDetailsButtonText(?string $detailsButtonText): static
{
$this->detailsButtonText = $detailsButtonText;
return $this;
}
public function getDetailsButtonUrl(): ?string
{
return $this->detailsButtonUrl;
}
public function setDetailsButtonUrl(?string $detailsButtonUrl): static
{
$this->detailsButtonUrl = $detailsButtonUrl;
return $this;
}
}