<?php
namespace App\Entity;
use App\Repository\DoctorRepository;
use Boab\CmsBundle\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DoctorRepository::class)]
class Doctor extends User implements DoctorInterface
{
use UserTrait;
#[ORM\Column(length: 255, nullable: true)]
private ?string $clinicName = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $clinicAddress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $services = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $ipAddress = null;
#[ORM\OneToMany(mappedBy: 'doctor', targetEntity: Appointment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $appointments;
#[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: TimeSlot::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $timeSlots;
#[ORM\ManyToMany(targetEntity: Specialty::class, inversedBy: 'doctors')]
private Collection $specialties;
#[ORM\Column(length: 30, nullable: true)]
private ?string $pricing = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?PricingPlan $pricingPlan = null;
#[ORM\OneToMany(mappedBy: 'doctor', targetEntity: Review::class, cascade: ['persist'], orphanRemoval: true)]
private Collection $reviews;
public function __construct()
{
parent::__construct();
$this->appointments = new ArrayCollection();
$this->specialties = new ArrayCollection();
$this->timeSlots = new ArrayCollection();
$this->reviews = new ArrayCollection();
}
public function getClinicName(): ?string
{
return $this->clinicName;
}
public function setClinicName(?string $clinicName): self
{
$this->clinicName = $clinicName;
return $this;
}
public function getClinicAddress(): ?string
{
return $this->clinicAddress;
}
public function setClinicAddress(?string $clinicAddress): self
{
$this->clinicAddress = $clinicAddress;
return $this;
}
public function getServices(): ?string
{
return $this->services;
}
public function setServices(?string $services): self
{
$this->services = $services;
return $this;
}
public function getIpAddress(): ?string
{
return $this->ipAddress;
}
public function setIpAddress(?string $ipAddress): self
{
$this->ipAddress = $ipAddress;
return $this;
}
/**
* @return Collection<int, Appointment>
*/
public function getAppointments(): Collection
{
return $this->appointments;
}
public function addAppointment(Appointment $appointment): self
{
if (!$this->appointments->contains($appointment)) {
$this->appointments->add($appointment);
$appointment->setDoctor($this);
}
return $this;
}
public function removeAppointment(Appointment $appointment): self
{
if ($this->appointments->removeElement($appointment)) {
// set the owning side to null (unless already changed)
if ($appointment->getDoctor() === $this) {
$appointment->setDoctor(null);
}
}
return $this;
}
/**
* @return Collection<int, Specialty>
*/
public function getSpecialties(): Collection
{
return $this->specialties;
}
public function addSpecialty(Specialty $specialty): static
{
if (!$this->specialties->contains($specialty)) {
$this->specialties->add($specialty);
}
return $this;
}
public function removeSpecialty(Specialty $specialty): static
{
$this->specialties->removeElement($specialty);
return $this;
}
public function getPricing(): ?string
{
return $this->pricing;
}
public function setPricing(string $pricing): static
{
$this->pricing = $pricing;
return $this;
}
public function getPricingPlan(): ?PricingPlan
{
return $this->pricingPlan;
}
public function setPricingPlan(?PricingPlan $pricingPlan): static
{
$this->pricingPlan = $pricingPlan;
return $this;
}
/**
* @return Collection<int, Scheduler>
*/
public function getTimeSlots(): Collection
{
return $this->timeSlots;
}
public function addTimeSlot(TimeSlot $timeSlot): static
{
if (!$this->timeSlots->contains($timeSlot)) {
$this->timeSlots->add($timeSlot);
$timeSlot->setCreatedBy($this);
}
return $this;
}
public function removeTimeSlot(TimeSlot $timeSlot): static
{
if ($this->timeSlots->removeElement($timeSlot)) {
// set the owning side to null (unless already changed)
if ($timeSlot->getCreatedBy() === $this) {
$timeSlot->setCreatedBy(null);
}
}
return $this;
}
/**
* @return Collection<int, Review>
*/
public function getReviews(): Collection
{
return $this->reviews;
}
public function addReview(Review $review): static
{
if (!$this->reviews->contains($review)) {
$this->reviews->add($review);
$review->setDoctor($this);
}
return $this;
}
public function removeReview(Review $review): static
{
if ($this->reviews->removeElement($review)) {
// set the owning side to null (unless already changed)
if ($review->getDoctor() === $this) {
$review->setDoctor(null);
}
}
return $this;
}
public function getUserType(): string
{
return 'Doctor';
}
}