<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\AppointmentRepository;
use Doctrine\ORM\Mapping as ORM;
use Ksante\CoreBundle\Entity\Channel;
use Ksante\CoreBundle\Entity\Traits\TimestampableTrait;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=AppointmentRepository::class)
*
* @ORM\Table(name="ksante_appointment")
*
* @ORM\HasLifecycleCallbacks()
*
* @ApiResource()
*/
class Appointment implements TimetableInterface
{
use TimestampableTrait;
public const STATUS_PRE_BOOK = 'pre_book';
public const STATUS_INCOMING = 'incoming';
public const STATUS_CALL = 'call';
public const STATUS_ABSENT = 'absent';
public const STATUS_NOT_TAKEN = 'not_taken';
public const STATUS_LOCKED = 'locked';
public const STATUS_CANCELED = 'canceled';
public const EMAIL_REMINDER_NOT_SENT = 'no_email_sent';
public const EMAIL_REMINDER_48_HOURS_BEFORE = '48_hours_before';
public const EMAIL_REMINDER_24_HOURS_BEFORE = '24_hours_before';
public const EMAIL_REMINDER_POST_APPOINTMENT = 'post_appointment';
public const EMAIL_REMINDER_CANCELED = 'canceled';
public const REMINDER_STATUS = [
0 => Appointment::EMAIL_REMINDER_24_HOURS_BEFORE,
1 => Appointment::EMAIL_REMINDER_48_HOURS_BEFORE,
];
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"CustomerGroup", "read"})
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Channel::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "write", "create"})
*/
private ?Channel $channel;
/**
* @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="appointments")
*
* @Groups({"read", "write", "create"})
*/
private Customer $customer;
/**
* @ORM\ManyToOne(targetEntity=Diet::class, inversedBy="appointments")
*
* @Groups({"read", "write", "create"})
*/
private Diet $diet;
/**
* @ORM\Column(type="datetime")
*
* @Groups({"CustomerGroup", "read", "write", "create"})
*/
private \DateTime $date;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"CustomerGroup", "write", "create"})
*/
private int $type;
/**
* @ORM\Column(type="string")
*
* @Groups({"CustomerGroup", "write", "create"})
*/
private string $status;
/**
* @ORM\Column(type="string")
*
* @Groups({"CustomerGroup", "write", "create"})
*/
private string $reminderStatus = self::EMAIL_REMINDER_NOT_SENT;
public function getId(): ?int
{
return $this->id;
}
public function getChannel()
{
return $this->channel;
}
public function setChannel(?Channel $channel): self
{
$this->channel = $channel;
return $this;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getDiet(): ?Diet
{
return $this->diet;
}
public function setDiet(?Diet $diet): self
{
$this->diet = $diet;
return $this;
}
public function getDate(): \DateTime
{
return $this->date;
}
public function setDate(\DateTime $date): self
{
$this->date = $date;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getReminderStatus(): ?string
{
return $this->reminderStatus;
}
public function setReminderStatus(string $reminderStatus): self
{
$this->reminderStatus = $reminderStatus;
return $this;
}
}