<?php
namespace App\Entity;
use App\Repository\VisitReportRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VisitReportRepository::class)]
class VisitReport
{
use IdentifiableTrait;
#[ORM\ManyToOne(inversedBy: 'visitReports')]
#[ORM\JoinColumn(nullable: false)]
private ?Commercial $visitedBy = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $meetingReport = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $assistantAction = null;
#[ORM\OneToOne(inversedBy: 'visitReport', cascade: ['persist', 'remove'])]
private ?BookingVisitReport $booking = null;
#[ORM\ManyToOne(inversedBy: 'visitReports')]
#[ORM\JoinColumn(nullable: false)]
private ?Prescriber $prescriber = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?Booking $nextBooking = null;
#[ORM\Column(nullable: true)]
private ?bool $isApproved = null;
#[ORM\Column(nullable: true)]
private ?bool $sendBook = null;
#[ORM\OneToMany(mappedBy: 'visitReport', targetEntity: VisitReportComment::class, orphanRemoval: true)]
private Collection $comments;
#[ORM\OneToMany(mappedBy: 'visitReport', targetEntity: Task::class)]
private Collection $assistantActionTask;
#[ORM\ManyToMany(targetEntity: Dotation::class, inversedBy: 'visitReportsProductShipmentRequests', cascade: ['persist', 'remove'])]
#[ORM\JoinTable(name: "visit_report_shipment_request")]
private Collection $productShipmentRequests;
#[ORM\ManyToMany(targetEntity: Dotation::class, inversedBy: 'visitReportsAwardedDotations', cascade: ['persist', 'remove'])]
#[ORM\JoinTable(name: "visit_report_awarded_dotations")]
private Collection $awardedDotations;
#[ORM\OneToMany(mappedBy: 'visitReport', targetEntity: PrescriptionPad::class)]
private Collection $prescriptionPads;
#[ORM\Column]
private ?bool $isReadyForValidation = null;
#[ORM\Column(nullable: true)]
private ?int $sendBdcQty = 0;
public function __construct()
{
$this->comments = new ArrayCollection();
$this->assistantActionTask = new ArrayCollection();
$this->productShipmentRequests = new ArrayCollection();
$this->awardedDotations = new ArrayCollection();
$this->prescriptionPads = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getVisitedBy(): ?Commercial
{
return $this->visitedBy;
}
public function setVisitedBy(?Commercial $visitedBy): static
{
$this->visitedBy = $visitedBy;
return $this;
}
public function getMeetingReport(): ?string
{
return $this->meetingReport;
}
public function setMeetingReport(string $meetingReport): static
{
$this->meetingReport = $meetingReport;
return $this;
}
public function getAssistantAction(): ?string
{
return $this->assistantAction;
}
public function setAssistantAction(?string $assistantAction): static
{
$this->assistantAction = $assistantAction;
return $this;
}
public function getBooking(): ?Booking
{
return $this->booking;
}
public function setBooking(?Booking $booking): static
{
$this->booking = $booking;
return $this;
}
public function getPrescriber(): ?Prescriber
{
return $this->prescriber;
}
public function setPrescriber(?Prescriber $prescriber): static
{
$this->prescriber = $prescriber;
return $this;
}
public function getNextBooking(): ?Booking
{
return $this->nextBooking;
}
public function setNextBooking(?Booking $nextBooking): static
{
$this->nextBooking = $nextBooking;
return $this;
}
public function isApproved(): ?bool
{
return $this->isApproved;
}
public function setIsApproved(?bool $isApproved): static
{
$this->isApproved = $isApproved;
return $this;
}
public function isSendBook(): ?bool
{
return $this->sendBook;
}
public function setSendBook(?bool $sendBook): static
{
$this->sendBook = $sendBook;
return $this;
}
/**
* @return Collection<int, VisitReportComment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(VisitReportComment $comment): static
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setVisitReport($this);
}
return $this;
}
public function removeComment(VisitReportComment $comment): static
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getVisitReport() === $this) {
$comment->setVisitReport(null);
}
}
return $this;
}
/**
* @return Collection<int, Task>
*/
public function getAssistantActionTask(): Collection
{
return $this->assistantActionTask;
}
public function addAssistantActionTask(Task $assistantActionTask): static
{
if (!$this->assistantActionTask->contains($assistantActionTask)) {
$this->assistantActionTask->add($assistantActionTask);
$assistantActionTask->setVisitReport($this);
}
return $this;
}
public function removeAssistantActionTask(Task $assistantActionTask): static
{
if ($this->assistantActionTask->removeElement($assistantActionTask)) {
// set the owning side to null (unless already changed)
if ($assistantActionTask->getVisitReport() === $this) {
$assistantActionTask->setVisitReport(null);
}
}
return $this;
}
/**
* @return Collection<int, Dotation>
*/
public function getProductShipmentRequests(): Collection
{
return $this->productShipmentRequests;
}
public function addProductShipmentRequest(Dotation $productShipmentRequest): static
{
if (!$this->productShipmentRequests->contains($productShipmentRequest)) {
$this->productShipmentRequests->add($productShipmentRequest);
}
return $this;
}
public function removeProductShipmentRequest(Dotation $productShipmentRequest): static
{
$this->productShipmentRequests->removeElement($productShipmentRequest);
return $this;
}
/**
* @return Collection<int, Dotation>
*/
public function getAwardedDotations(): Collection
{
return $this->awardedDotations;
}
public function addAwardedDotation(Dotation $awardedDotation): static
{
if (!$this->awardedDotations->contains($awardedDotation)) {
$this->awardedDotations->add($awardedDotation);
}
return $this;
}
public function removeAwardedDotation(Dotation $awardedDotation): static
{
$this->awardedDotations->removeElement($awardedDotation);
return $this;
}
/**
* @return Collection<int, PrescriptionPad>
*/
public function getPrescriptionPads(): Collection
{
return $this->prescriptionPads;
}
public function addPrescriptionPad(PrescriptionPad $prescriptionPad): static
{
if (!$this->prescriptionPads->contains($prescriptionPad)) {
$this->prescriptionPads->add($prescriptionPad);
$prescriptionPad->setVisitReport($this);
}
return $this;
}
public function removePrescriptionPad(PrescriptionPad $prescriptionPad): static
{
if ($this->prescriptionPads->removeElement($prescriptionPad)) {
// set the owning side to null (unless already changed)
if ($prescriptionPad->getVisitReport() === $this) {
$prescriptionPad->setVisitReport(null);
}
}
return $this;
}
public function isIsReadyForValidation(): ?bool
{
return $this->isReadyForValidation;
}
public function setIsReadyForValidation(bool $isReadyForValidation): static
{
$this->isReadyForValidation = $isReadyForValidation;
return $this;
}
public function getSendBdcQty(): ?int
{
return $this->sendBdcQty;
}
public function setSendBdcQty(?int $sendBdcQty): static
{
$this->sendBdcQty = $sendBdcQty;
return $this;
}
}