<?php
namespace App\Entity;
use App\Repository\BillingCenterRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BillingCenterRepository::class)]
class BillingCenter
{
use IdentifiableTrait;
#[ORM\Column(length: 255)]
private ?string $code = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $slug = null;
#[ORM\Column]
private ?bool $active = null;
#[ORM\OneToMany(mappedBy: 'billingCenter', targetEntity: Invoice::class)]
private Collection $invoices;
#[ORM\OneToMany(mappedBy: 'billingCenter', targetEntity: PrescriberPoint::class)]
private Collection $prescriberPoints;
#[ORM\Column(length: 20, nullable: true)]
private ?string $backgroundColor = null;
#[ORM\OneToMany(mappedBy: 'billingCenter', targetEntity: Prescriber::class)]
private Collection $prescribers;
#[ORM\Column(nullable: true)]
private ?int $codialShopId = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $prestashopUrl = null;
#[ORM\OneToMany(mappedBy: 'mainBillingCenter', targetEntity: Commercial::class)]
private Collection $commercials;
public function __construct()
{
$this->invoices = new ArrayCollection();
$this->prescriberPoints = new ArrayCollection();
$this->prescribers = new ArrayCollection();
$this->commercials = new ArrayCollection();
}
public function __toString(): string
{
return $this->getName();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices->add($invoice);
$invoice->setBillingCenter($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getBillingCenter() === $this) {
$invoice->setBillingCenter(null);
}
}
return $this;
}
/**
* @return Collection<int, PrescriberPoint>
*/
public function getPrescriberPoints(): Collection
{
return $this->prescriberPoints;
}
public function addPrescriberPoint(PrescriberPoint $prescriberPoint): self
{
if (!$this->prescriberPoints->contains($prescriberPoint)) {
$this->prescriberPoints->add($prescriberPoint);
$prescriberPoint->setBillingCenter($this);
}
return $this;
}
public function removePrescriberPoint(PrescriberPoint $prescriberPoint): self
{
if ($this->prescriberPoints->removeElement($prescriberPoint)) {
// set the owning side to null (unless already changed)
if ($prescriberPoint->getBillingCenter() === $this) {
$prescriberPoint->setBillingCenter(null);
}
}
return $this;
}
public function getBackgroundColor(): ?string
{
return $this->backgroundColor;
}
public function setBackgroundColor(?string $backgroundColor): self
{
$this->backgroundColor = $backgroundColor;
return $this;
}
/**
* @return Collection<int, Prescriber>
*/
public function getPrescribers(): Collection
{
return $this->prescribers;
}
public function addPrescriber(Prescriber $prescriber): self
{
if (!$this->prescribers->contains($prescriber)) {
$this->prescribers->add($prescriber);
$prescriber->setBillingCenter($this);
}
return $this;
}
public function removePrescriber(Prescriber $prescriber): self
{
if ($this->prescribers->removeElement($prescriber)) {
// set the owning side to null (unless already changed)
if ($prescriber->getBillingCenter() === $this) {
$prescriber->setBillingCenter(null);
}
}
return $this;
}
public function getCodialShopId(): ?int
{
return $this->codialShopId;
}
public function setCodialShopId(?int $codialShopId): self
{
$this->codialShopId = $codialShopId;
return $this;
}
public function getPrestashopUrl(): ?string
{
return $this->prestashopUrl;
}
public function setPrestashopUrl(?string $prestashopUrl): static
{
$this->prestashopUrl = $prestashopUrl;
return $this;
}
/**
* @return Collection<int, Commercial>
*/
public function getCommercials(): Collection
{
return $this->commercials;
}
public function addCommercial(Commercial $commercial): static
{
if (!$this->commercials->contains($commercial)) {
$this->commercials->add($commercial);
$commercial->setMainBillingCenter($this);
}
return $this;
}
public function removeCommercial(Commercial $commercial): static
{
if ($this->commercials->removeElement($commercial)) {
// set the owning side to null (unless already changed)
if ($commercial->getMainBillingCenter() === $this) {
$commercial->setMainBillingCenter(null);
}
}
return $this;
}
}