<?php
namespace App\Entity;
use App\Repository\AppointmentRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=AppointmentRepository::class)
* @ORM\Table(name="appointments")
*/
class Appointment
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\JoinColumn(nullable=false)
*/
private $patient;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\JoinColumn(nullable=false)
*/
private $provider;
/**
* Relación con Horario
* @ORM\ManyToOne(targetEntity="App\Entity\Horario")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $horario;
/**
* @ORM\Column(type="string", length=30)
* @Assert\Choice(callback={"App\Enum\AppointmentStatus", "choices"})
*/
private $status = 'confirmada';
/**
* @ORM\Column(type="text", nullable=true)
*/
private $notes;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cancelToken;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $reprogramToken;
/**
* @ORM\Column(type="string", length=100)
* @Assert\NotBlank(message="El tipo de estudio es obligatorio.")
*/
private $tipoEstudio;
/**
* @ORM\Column(type="string", length=20)
*/
private $paymentMethod;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $paymentStatus;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $montoImagingPro;
public const PAYMENT_METHOD_IMAGIN_PRO = 'imagin_pro';
public const PAYMENT_METHOD_CLINICA = 'clinica';
public const PAYMENT_STATUS_PENDING = 'pendiente';
public const PAYMENT_STATUS_PAID = 'pagado';
public const PAYMENT_STATUS_CANCELLED = 'cancelado';
public function __construct()
{
$this->createdAt = new \DateTimeImmutable();
$this->status = 'confirmada';
$this->paymentStatus = self::PAYMENT_STATUS_PENDING;
}
public function getId(): ?int
{
return $this->id;
}
public function getPatient()
{
return $this->patient;
}
public function setPatient($patient): self
{
$this->patient = $patient;
return $this;
}
public function getProvider()
{
return $this->provider;
}
public function setProvider($provider): self
{
$this->provider = $provider;
return $this;
}
public function getStatus(): string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(?string $notes): self
{
$this->notes = $notes;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getHorario(): ?Horario
{
return $this->horario;
}
public function setHorario(?Horario $horario): self
{
$this->horario = $horario;
return $this;
}
public function getCancelToken()
{
return $this->cancelToken;
}
public function setCancelToken($cancelToken)
{
$this->cancelToken = $cancelToken;
return $this;
}
public function getReprogramToken()
{
return $this->reprogramToken;
}
public function setReprogramToken($reprogramToken)
{
$this->reprogramToken = $reprogramToken;
return $this;
}
public function getTipoEstudio(): ?string
{
return $this->tipoEstudio;
}
public function setTipoEstudio(string $tipoEstudio): self
{
$this->tipoEstudio = $tipoEstudio;
return $this;
}
public function getPaymentMethod(): ?string
{
return $this->paymentMethod;
}
public function setPaymentMethod(string $paymentMethod): self
{
$this->paymentMethod = $paymentMethod;
return $this;
}
public function getPaymentStatus(): ?string
{
return $this->paymentStatus;
}
public function setPaymentStatus(?string $paymentStatus): self
{
$this->paymentStatus = $paymentStatus;
return $this;
}
public static function getPaymentMethods(): array
{
return [
'Imagin Pro' => self::PAYMENT_METHOD_IMAGIN_PRO,
'Clínica' => self::PAYMENT_METHOD_CLINICA,
];
}
public function getMontoImagingPro(): ?string
{
return $this->montoImagingPro;
}
public function setMontoImagingPro(?string $monto): self
{
$this->montoImagingPro = $monto;
return $this;
}
}