<?php
namespace App\Entity;
use App\Repository\PrescriberRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JetBrains\PhpStorm\Pure;
#[ORM\Entity(repositoryClass: PrescriberRepository::class)]
class Prescriber extends User
{
use IdentifiableTrait;
#[ORM\ManyToMany(targetEntity: PrescriberSpeciality::class, inversedBy: 'prescribers')]
private Collection $specialities;
#[ORM\OneToMany(mappedBy: 'prescriber', targetEntity: Invoice::class)]
private Collection $invoices;
// Code Bionops du prescripteur
#[ORM\Column(length: 255, nullable: true, unique: true)]
private ?string $prescriberCode = null;
#[ORM\Column]
private ?float $pointCoefficient = null;
#[ORM\Column(length: 255)]
private ?string $address = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $address2 = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $activityStartDate = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $civility = null;
#[ORM\Column(length: 255)]
private ?string $lastname = null;
#[ORM\Column(length: 255)]
private ?string $firstname = null;
#[ORM\Column(length: 255)]
private ?string $postalCode = null;
#[ORM\Column(length: 255)]
private ?string $city = null;
#[ORM\Column(length: 255)]
private ?string $phone = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $position = null;
#[ORM\ManyToOne(inversedBy: 'prescribers')]
#[ORM\JoinColumn(nullable: true)]
private ?Commercial $commercial = null;
#[ORM\OneToMany(mappedBy: 'prescriber', targetEntity: PrescriptionPadOrder::class)]
private Collection $prescriptionPadOrders;
#[ORM\OneToMany(mappedBy: 'prescriber', targetEntity: PrescriberPoint::class)]
private Collection $points;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $lastPrescriptionDate = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $company = null;
#[ORM\ManyToOne(inversedBy: 'prescribers')]
private ?PrescriberCategory $category = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $prescriberValidationDate = null;
#[ORM\Column]
private ?DateTimeImmutable $created_at = null;
#[ORM\Column(nullable: true)]
private ?DateTimeImmutable $updated_at = null;
// Identifiant interne du prescripteur dans extranet
#[ORM\Column(length: 255)]
private ?string $extranetCode = null;
#[ORM\ManyToOne(inversedBy: 'prescribersByMainSpeciality')]
private ?PrescriberSpeciality $mainSpeciality = null;
#[ORM\ManyToOne(inversedBy: 'prescribers')]
private ?Country $country = null;
// Code Codial du prescripteur (code client)
#[ORM\Column(length: 255, nullable: true)]
private ?string $codialClientCode = null;
#[ORM\Column(nullable: true)]
private ?bool $needToBeExported = null;
#[ORM\ManyToOne(inversedBy: 'prescribers')]
private ?BillingCenter $billingCenter = null;
#[ORM\Column(nullable: true)]
private ?bool $approved = null;
#[ORM\ManyToOne()]
private ?User $createdBy = null;
#[ORM\OneToMany(mappedBy: 'prescriber', targetEntity: VisitReport::class, orphanRemoval: true)]
private Collection $visitReports;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $visitDate = null;
#[ORM\ManyToOne(inversedBy: 'prescribers')]
private ?PrescriberActivityStatus $activityStatus = null;
#[ORM\ManyToMany(targetEntity: BookingEvent::class, mappedBy: 'prescriberSpeakers')]
private Collection $prescriberSpeakersBookingEvents;
#[ORM\Column(length: 255, nullable: true)]
private ?string $title = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $rppsNumber = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $sirenNumber = null;
#[ORM\Column(length: 255, nullable: true, options: ['comment' => 'Comment le prescripteur a connu Bionops'])]
private ?string $sourceDiscovery = null;
#[Pure] public function __construct()
{
$this->specialities = new ArrayCollection();
$this->invoices = new ArrayCollection();
$this->prescriptionPadOrders = new ArrayCollection();
$this->points = new ArrayCollection();
$this->visitReports = new ArrayCollection();
$this->prescriberSpeakersBookingEvents = new ArrayCollection();
}
public function __toString(): string
{
return $this->getFullName();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, PrescriberSpeciality>
*/
public function getSpecialities(): Collection
{
return $this->specialities;
}
public function addSpeciality(PrescriberSpeciality $speciality): self
{
if (!$this->specialities->contains($speciality)) {
$this->specialities->add($speciality);
}
return $this;
}
public function removeSpeciality(PrescriberSpeciality $speciality): self
{
$this->specialities->removeElement($speciality);
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->setPrescriber($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->getPrescriber() === $this) {
$invoice->setPrescriber(null);
}
}
return $this;
}
public function getPrescriberCode(): ?string
{
return $this->prescriberCode;
}
public function setPrescriberCode(string $prescriberCode): self
{
$this->prescriberCode = $prescriberCode;
return $this;
}
public function getPointCoefficient(): ?float
{
return $this->pointCoefficient;
}
public function setPointCoefficient(float $pointCoefficient): self
{
$this->pointCoefficient = $pointCoefficient;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): self
{
$this->address = $address !== null ? strtoupper($address) : null;
return $this;
}
public function getAddress2(): ?string
{
return $this->address2;
}
public function setAddress2(?string $address2): self
{
$this->address2 = $address2 !== null ? strtoupper($address2) : null;
return $this;
}
public function getActivityStartDate(): ?\DateTimeInterface
{
return $this->activityStartDate;
}
public function setActivityStartDate(?\DateTimeInterface $activityStartDate): self
{
$this->activityStartDate = $activityStartDate;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(string $lastname): self
{
$this->lastname = $lastname !== null ? strtoupper($lastname) : null;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function getFullName(): ?string
{
return $this->getLastname() . " " . $this->getFirstname();
}
public function setFirstname(string $firstname): self
{
$this->firstname = $firstname !== null ? strtoupper($firstname) : null;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): self
{
$this->city = $city !== null ? strtoupper($city) : $city;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getPosition(): ?string
{
return $this->position;
}
public function setPosition(string $position): self
{
$this->position = $position;
return $this;
}
public function getCommercial(): ?Commercial
{
return $this->commercial;
}
public function setCommercial(?Commercial $commercial): self
{
$this->commercial = $commercial;
return $this;
}
/**
* @return Collection<int, PrescriptionPadOrder>
*/
public function getPrescriptionPadOrders(): Collection
{
return $this->prescriptionPadOrders;
}
public function addPrescriptionPadOrder(PrescriptionPadOrder $prescriptionPadOrder): self
{
if (!$this->prescriptionPadOrders->contains($prescriptionPadOrder)) {
$this->prescriptionPadOrders->add($prescriptionPadOrder);
$prescriptionPadOrder->setPrescriber($this);
}
return $this;
}
public function removePrescriptionPadOrder(PrescriptionPadOrder $prescriptionPadOrder): self
{
if ($this->prescriptionPadOrders->removeElement($prescriptionPadOrder)) {
// set the owning side to null (unless already changed)
if ($prescriptionPadOrder->getPrescriber() === $this) {
$prescriptionPadOrder->setPrescriber(null);
}
}
return $this;
}
/**
* @return Collection<int, PrescriberPoint>
*/
public function getPoints(): Collection
{
return $this->points;
}
public function addPoint(PrescriberPoint $point): self
{
if (!$this->points->contains($point)) {
$this->points->add($point);
$point->setPrescriber($this);
}
return $this;
}
public function removePoint(PrescriberPoint $point): self
{
if ($this->points->removeElement($point)) {
// set the owning side to null (unless already changed)
if ($point->getPrescriber() === $this) {
$point->setPrescriber(null);
}
}
return $this;
}
public function getLastPrescriptionDate(): ?\DateTimeInterface
{
return $this->lastPrescriptionDate;
}
public function setLastPrescriptionDate(?\DateTimeInterface $lastPrescriptionDate): self
{
$this->lastPrescriptionDate = $lastPrescriptionDate;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(?string $company): self
{
$this->company = $company;
return $this;
}
public function getCategory(): ?PrescriberCategory
{
return $this->category;
}
public function setCategory(?PrescriberCategory $category): self
{
$this->category = $category;
return $this;
}
public function getPrescriberValidationDate(): ?\DateTimeInterface
{
return $this->prescriberValidationDate;
}
public function setPrescriberValidationDate(?\DateTimeInterface $prescriberValidationDate): self
{
$this->prescriberValidationDate = $prescriberValidationDate;
return $this;
}
public function getCreatedAt(): ?DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(?DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getExtranetCode(): ?string
{
return $this->extranetCode;
}
public function setExtranetCode(string $extranetCode): self
{
$this->extranetCode = $extranetCode;
return $this;
}
public function getMainSpeciality(): ?PrescriberSpeciality
{
return $this->mainSpeciality;
}
public function setMainSpeciality(?PrescriberSpeciality $mainSpeciality): self
{
$this->mainSpeciality = $mainSpeciality;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getCodialClientCode(): ?string
{
return $this->codialClientCode;
}
public function setCodialClientCode(?string $codialClientCode): self
{
$this->codialClientCode = $codialClientCode;
return $this;
}
public function isNeedToBeExported(): ?bool
{
return $this->needToBeExported;
}
public function setNeedToBeExported(?bool $needToBeExported): self
{
$this->needToBeExported = $needToBeExported;
return $this;
}
public function getBillingCenter(): ?BillingCenter
{
return $this->billingCenter;
}
public function setBillingCenter(?BillingCenter $billingCenter): self
{
$this->billingCenter = $billingCenter;
return $this;
}
public function isApproved(): ?bool
{
return $this->approved;
}
public function setApproved(?bool $approved): static
{
$this->approved = $approved;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): static
{
$this->createdBy = $createdBy;
return $this;
}
/**
* @return Collection<int, VisitReport>
*/
public function getVisitReports(): Collection
{
return $this->visitReports;
}
public function addVisitReport(VisitReport $visitReport): static
{
if (!$this->visitReports->contains($visitReport)) {
$this->visitReports->add($visitReport);
$visitReport->setPrescriber($this);
}
return $this;
}
public function removeVisitReport(VisitReport $visitReport): static
{
if ($this->visitReports->removeElement($visitReport)) {
// set the owning side to null (unless already changed)
if ($visitReport->getPrescriber() === $this) {
$visitReport->setPrescriber(null);
}
}
return $this;
}
public function getVisitDate(): ?\DateTimeImmutable
{
return $this->visitDate;
}
public function setVisitDate(?\DateTimeImmutable $visitDate): static
{
$this->visitDate = $visitDate;
return $this;
}
public function getActivityStatus(): ?PrescriberActivityStatus
{
return $this->activityStatus;
}
public function setActivityStatus(?PrescriberActivityStatus $activityStatus): static
{
$this->activityStatus = $activityStatus;
return $this;
}
/**
* @return Collection<int, BookingEvent>
*/
public function getPrescriberSpeakersBookingEvents(): Collection
{
return $this->prescriberSpeakersBookingEvents;
}
public function addBookingEvent(BookingEvent $bookingEvent): static
{
if (!$this->prescriberSpeakersBookingEvents->contains($bookingEvent)) {
$this->prescriberSpeakersBookingEvents->add($bookingEvent);
$bookingEvent->addPrescriber($this);
}
return $this;
}
public function removeBookingEvent(BookingEvent $bookingEvent): static
{
if ($this->prescriberSpeakersBookingEvents->removeElement($bookingEvent)) {
$bookingEvent->removePrescriber($this);
}
return $this;
}
public function getCivility(): ?string
{
return $this->civility;
}
public function setCivility(?string $civility): self
{
$this->civility = $civility;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getRppsNumber(): ?string
{
return $this->rppsNumber;
}
public function setRppsNumber(?string $rppsNumber): self
{
$this->rppsNumber = $rppsNumber;
return $this;
}
public function getSirenNumber(): ?string
{
return $this->sirenNumber;
}
public function setSirenNumber(?string $sirenNumber): static
{
$this->sirenNumber = $sirenNumber;
return $this;
}
public function getSourceDiscovery(): ?string
{
return $this->sourceDiscovery;
}
public function setSourceDiscovery(?string $sourceDiscovery): static
{
$this->sourceDiscovery = $sourceDiscovery;
return $this;
}
}