<?php
namespace App\Entity;
use App\Repository\PrestationRepository;
use App\Util\Status;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PrestationRepository::class)
*/
class Prestation
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text")
*/
private $nom;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="decimal", precision=12, scale=2)
*/
private $prix;
/**
* @ORM\Column(type="integer")
*/
private $dureeEnMinutes;
/**
* @ORM\Column(type="integer")
*/
private $statut;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $calendlyEventId;
/**
* @ORM\ManyToOne(targetEntity=Categorie::class, inversedBy="prestations")
* @ORM\JoinColumn(nullable=false)
*/
private $categorie;
/**
* @ORM\OneToMany(targetEntity=OptionPrestation::class, mappedBy="prestation")
*/
private $options;
/**
* @ORM\OneToMany(targetEntity=PrestationTypeConsultation::class, mappedBy="prestation")
*/
private $types;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $ordre;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $nbMax = 0;
public function __construct()
{
$this->options = new ArrayCollection();
$this->types = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPrix(): ?string
{
return $this->prix;
}
public function setPrix(string $prix): self
{
$this->prix = $prix;
return $this;
}
public function getDureeEnMinutes(): ?int
{
return $this->dureeEnMinutes;
}
public function setDureeEnMinutes(int $dureeEnMinutes): self
{
$this->dureeEnMinutes = $dureeEnMinutes;
return $this;
}
public function getStatut(): ?int
{
return $this->statut;
}
public function setStatut(int $statut): self
{
$this->statut = $statut;
return $this;
}
public function getCalendlyEventId(): ?string
{
return $this->calendlyEventId;
}
public function setCalendlyEventId(?string $calendlyEventId): self
{
$this->calendlyEventId = $calendlyEventId;
return $this;
}
public function getCategorie(): ?Categorie
{
return $this->categorie;
}
public function setCategorie(?Categorie $categorie): self
{
$this->categorie = $categorie;
return $this;
}
/**
* @return Collection<int, OptionPrestation>
*/
public function getOptions(): Collection
{
return $this->options;
}
public function addOption(OptionPrestation $option): self
{
if (!$this->options->contains($option)) {
$this->options[] = $option;
$option->setPrestation($this);
}
return $this;
}
public function removeOption(OptionPrestation $option): self
{
if ($this->options->removeElement($option)) {
// set the owning side to null (unless already changed)
if ($option->getPrestation() === $this) {
$option->setPrestation(null);
}
}
return $this;
}
/**
* @return Collection<int, PrestationTypeConsultation>
*/
public function getTypes(): Collection
{
return $this->types;
}
public function addType(PrestationTypeConsultation $type): self
{
if (!$this->types->contains($type)) {
$this->types[] = $type;
$type->setPrestation($this);
}
return $this;
}
public function removeType(PrestationTypeConsultation $type): self
{
if ($this->types->removeElement($type)) {
// set the owning side to null (unless already changed)
if ($type->getPrestation() === $this) {
$type->setPrestation(null);
}
}
return $this;
}
public function isValid(): bool{
return $this->getStatut() == Status::VALID;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(?int $ordre): self
{
$this->ordre = $ordre;
return $this;
}
public function getNbMax(): ?int
{
return $this->nbMax;
}
public function setNbMax(?int $nbMax): self
{
$this->nbMax = $nbMax;
return $this;
}
}