<?php
namespace App\Entity;
use App\Repository\DevisRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\TimestampableTrait;
/**
* @ORM\Entity(repositoryClass=DevisRepository::class)
*/
class Devis
{
public const STATUS_PENDING = 'pending';
public const STATUS_VALIDATED = 'validated';
public const STATUS_REJECTED = 'rejected';
use TimestampableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $typeOfTrip;
/**
* @ORM\Column(type="string", length=255)
*/
private $departureAddress;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $arrivalAddress;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $departureDate;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $departureTime;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $returnDate;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $returnTime;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $numberOfPeople;
/**
* @ORM\Column(type="string", length=50)
*/
private $status = self::STATUS_PENDING;
/**
* @ORM\ManyToOne(targetEntity=Service::class, inversedBy="devis")
* @ORM\JoinColumn(nullable=false)
*/
private $service;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $distance;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $startLatitude;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $startLongitude;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $endLatitude;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $endLongitude;
/**
* @ORM\ManyToOne(targetEntity=DevisLuggage::class, inversedBy="devis")
*/
private $devisLuggage;
/**
* @ORM\ManyToOne(targetEntity=DevisTravelReason::class, inversedBy="devis")
* @ORM\JoinColumn(nullable=false)
*/
private $devisTravelReason;
/**
* @ORM\ManyToOne(targetEntity=DevisBudget::class, inversedBy="devis")
* @ORM\JoinColumn(nullable=false)
*/
private $devisBudget;
/**
* @ORM\ManyToMany(targetEntity=DevisEquipment::class, inversedBy="devis")
* @ORM\JoinTable(name="devis_equipment_devis")
*/
private $devisEquipment;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $infos;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $needVehicleOnSite;
/**
* @ORM\OneToMany(targetEntity=DevisVehicleDetails::class, mappedBy="devis", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $vehicleDetails;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $addPdfDocument;
/**
* @ORM\OneToMany(targetEntity=DevisAttachment::class, mappedBy="devis", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $attachments;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="devis")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $user;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $distancePerTrip;
/**
* @ORM\Column(type="boolean")
*/
private $miseEnAvance = false;
/**
* @ORM\Column(type="boolean")
*/
private $remonteEnTeteDeListe = false;
/**
* @ORM\Column(type="boolean")
*/
private $demandeUrgente = false;
public function __construct()
{
$this->devisEquipment = new ArrayCollection();
$this->vehicleDetails = new ArrayCollection();
$this->attachments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTypeOfTrip(): ?string
{
return $this->typeOfTrip;
}
public function setTypeOfTrip(string $typeOfTrip): self
{
$this->typeOfTrip = $typeOfTrip;
return $this;
}
public function getDepartureAddress(): ?string
{
return $this->departureAddress;
}
public function setDepartureAddress(string $departureAddress): self
{
$this->departureAddress = $departureAddress;
return $this;
}
public function getArrivalAddress(): ?string
{
return $this->arrivalAddress;
}
public function setArrivalAddress(?string $arrivalAddress): self
{
$this->arrivalAddress = $arrivalAddress;
return $this;
}
public function getDepartureDate(): ?\DateTimeInterface
{
return $this->departureDate;
}
public function setDepartureDate(?\DateTimeInterface $departureDate): self
{
$this->departureDate = $departureDate;
return $this;
}
public function getDepartureTime(): ?\DateTimeInterface
{
return $this->departureTime;
}
public function setDepartureTime(?\DateTimeInterface $departureTime): self
{
$this->departureTime = $departureTime;
return $this;
}
public function getReturnDate(): ?\DateTimeInterface
{
return $this->returnDate;
}
public function setReturnDate(?\DateTimeInterface $returnDate): self
{
$this->returnDate = $returnDate;
return $this;
}
public function getReturnTime(): ?\DateTimeInterface
{
return $this->returnTime;
}
public function setReturnTime(?\DateTimeInterface $returnTime): self
{
$this->returnTime = $returnTime;
return $this;
}
public function getNumberOfPeople(): ?int
{
return $this->numberOfPeople;
}
public function setNumberOfPeople(?int $numberOfPeople): self
{
$this->numberOfPeople = $numberOfPeople;
return $this;
}
public function isStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getService(): ?Service
{
return $this->service;
}
public function setService(?Service $service): self
{
$this->service = $service;
return $this;
}
public function getDistance(): ?string
{
return $this->distance;
}
public function setDistance(?string $distance): self
{
$this->distance = $distance;
return $this;
}
public function getStartLatitude(): ?float
{
return $this->startLatitude;
}
public function setStartLatitude(?float $startLatitude): self
{
$this->startLatitude = $startLatitude;
return $this;
}
public function getStartLongitude(): ?float
{
return $this->startLongitude;
}
public function setStartLongitude(?float $startLongitude): self
{
$this->startLongitude = $startLongitude;
return $this;
}
public function getEndLatitude(): ?float
{
return $this->endLatitude;
}
public function setEndLatitude(?float $endLatitude): self
{
$this->endLatitude = $endLatitude;
return $this;
}
public function getEndLongitude(): ?float
{
return $this->endLongitude;
}
public function setEndLongitude(?float $endLongitude): self
{
$this->endLongitude = $endLongitude;
return $this;
}
public function getDevisLuggage(): ?DevisLuggage
{
return $this->devisLuggage;
}
public function setDevisLuggage(?DevisLuggage $devisLuggage): self
{
$this->devisLuggage = $devisLuggage;
return $this;
}
public function getDevisTravelReason(): ?DevisTravelReason
{
return $this->devisTravelReason;
}
public function setDevisTravelReason(?DevisTravelReason $devisTravelReason): self
{
$this->devisTravelReason = $devisTravelReason;
return $this;
}
public function getDevisBudget(): ?DevisBudget
{
return $this->devisBudget;
}
public function setDevisBudget(?DevisBudget $devisBudget): self
{
$this->devisBudget = $devisBudget;
return $this;
}
/**
* @return Collection<int, DevisEquipment>
*/
public function getDevisEquipment(): Collection
{
return $this->devisEquipment;
}
public function addDevisEquipment(DevisEquipment $devisEquipment): self
{
if (!$this->devisEquipment->contains($devisEquipment)) {
$this->devisEquipment[] = $devisEquipment;
$devisEquipment->addDevi($this);
}
return $this;
}
public function removeDevisEquipment(DevisEquipment $devisEquipment): self
{
$this->devisEquipment->removeElement($devisEquipment);
return $this;
}
public function setDevisEquipment(array $equipments): self
{
foreach ($this->devisEquipment as $existingEquipment) {
$this->removeDevisEquipment($existingEquipment);
}
foreach ($equipments as $equipment) {
$this->addDevisEquipment($equipment);
}
return $this;
}
public function getInfos(): ?string
{
return $this->infos;
}
public function setInfos(?string $infos): self
{
$this->infos = $infos;
return $this;
}
public function getNeedVehicleOnSite(): ?string
{
return $this->needVehicleOnSite;
}
public function setNeedVehicleOnSite(?string $needVehicleOnSite): self
{
$this->needVehicleOnSite = $needVehicleOnSite;
return $this;
}
/**
* @return Collection<int, DevisVehicleDetails>
*/
public function getVehicleDetails(): Collection
{
return $this->vehicleDetails;
}
public function addVehicleDetail(DevisVehicleDetails $vehicleDetail): self
{
if (!$this->vehicleDetails->contains($vehicleDetail)) {
$this->vehicleDetails[] = $vehicleDetail;
$vehicleDetail->setDevis($this);
}
return $this;
}
public function removeVehicleDetail(DevisVehicleDetails $vehicleDetail): self
{
if ($this->vehicleDetails->removeElement($vehicleDetail)) {
// set the owning side to null (unless already changed)
if ($vehicleDetail->getDevis() === $this) {
$vehicleDetail->setDevis(null);
}
}
return $this;
}
public function getAddPdfDocument(): ?string
{
return $this->addPdfDocument;
}
public function setAddPdfDocument(?string $addPdfDocument): self
{
$this->addPdfDocument = $addPdfDocument;
return $this;
}
/**
* @return Collection<int, DevisAttachment>
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttachment(DevisAttachment $attachment): self
{
if (!$this->attachments->contains($attachment)) {
$this->attachments[] = $attachment;
$attachment->setDevis($this);
}
return $this;
}
public function removeAttachment(DevisAttachment $attachment): self
{
if ($this->attachments->removeElement($attachment)) {
// set the owning side to null (unless already changed)
if ($attachment->getDevis() === $this) {
$attachment->setDevis(null);
}
}
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getDistancePerTrip(): ?string
{
return $this->distancePerTrip;
}
public function setDistancePerTrip(?string $distancePerTrip): self
{
$this->distancePerTrip = $distancePerTrip;
return $this;
}
public function isMiseEnAvance(): ?bool
{
return $this->miseEnAvance;
}
public function setMiseEnAvance(bool $miseEnAvance): self
{
$this->miseEnAvance = $miseEnAvance;
return $this;
}
public function isRemonteEnTeteDeListe(): ?bool
{
return $this->remonteEnTeteDeListe;
}
public function setRemonteEnTeteDeListe(bool $remonteEnTeteDeListe): self
{
$this->remonteEnTeteDeListe = $remonteEnTeteDeListe;
return $this;
}
public function isDemandeUrgente(): ?bool
{
return $this->demandeUrgente;
}
public function setDemandeUrgente(bool $demandeUrgente): self
{
$this->demandeUrgente = $demandeUrgente;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
}