<?php
namespace App\Entity;
use App\Repository\ServiceRequestRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ServiceRequestRepository::class)
*/
class ServiceRequest
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="serviceRequests")
* @ORM\JoinColumn(nullable=false)
*/
private $customer;
/**
* @var DateTimeImmutable
* @ORM\Column(type="datetimetz_immutable")
*/
private $dateCreated;
/**
* @var DateTimeImmutable|null
* @ORM\Column(type="datetimetz_immutable", nullable=true)
*/
private $realizationDate;
/**
* @ORM\Column(type="boolean")
*/
private $isNewRequest = true;
/**
* @ORM\Column(type="boolean")
*/
private $isInvoiceDeliveryPost;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $invoiceDeliveryEmail;
/**
* @ORM\Column(type="string", length=255)
*/
private $locationName;
/**
* @ORM\Column(type="string", length=255)
*/
private $locationAddress;
/**
* @ORM\Column(type="string", length=255)
*/
private $locationCity;
/**
* @ORM\Column(type="string", length=5)
*/
private $locationPostalCode;
/**
* @var string
* @ORM\Column(type="string")
*/
private $paymentMethod;
/**
* @ORM\Column(type="string", length=255)
*/
private $contactTitle;
/**
* @ORM\Column(type="string", length=255)
*/
private $contactFirstName;
/**
* @ORM\Column(type="string", length=255)
*/
private $contactLastName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactPhone;
/**
* @ORM\Column(type="boolean")
*/
private $voipEnabled;
/**
* @ORM\Column(type="bigint")
*/
private $voipMonthlyFee = 0;
/**
* @ORM\Column(type="bigint")
*/
private $voipConnectionFee = 0;
/**
* @ORM\Column(type="boolean")
*/
private $terminalEquipmentLease;
/**
* @ORM\Column(type="bigint")
*/
private $voipChannels;
/**
* @ORM\Column(type="bigint")
*/
private $fax2mailChannels;
/**
* @ORM\Column(type="string", length=255)
*/
private $phoneNumeration;
/**
* @ORM\Column(type="string", length=255)
*/
private $faxNumeration;
/**
* @ORM\Column(type="boolean")
*/
private $fax2mailEnabled;
/**
* @ORM\Column(type="string", length=255)
*/
private $fax2mailEmail;
/**
* @ORM\Column(type="boolean")
*/
private $phoneNumberTransfer;
/**
* @ORM\Column(type="boolean")
*/
private $internetAccessEnabled;
/**
* @ORM\ManyToMany(targetEntity=InternetOption::class)
*/
private $internetOptions;
/**
* @var int|null
* @ORM\Column(type="bigint", nullable=true)
*/
private $internetOptionsPrice = 0;
/**
* @var int|null
* @ORM\Column(type="bigint", nullable=true)
*/
private $internetConnectionFee = 0;
/**
* @var int
* @ORM\Column(type="bigint")
*/
private $totalPrice = 0;
/**
* @ORM\Column(type="boolean")
*/
private $contractIndefinite = true;
/**
* @ORM\Column(type="string", length=255)
*/
private $contractOfferNo;
/**
* @ORM\Column(type="bigint", length=255)
*/
private $contractDuration;
/**
* @ORM\Column(name="locked", type="boolean")
*/
private $isLocked = false;
/**
* @ORM\ManyToOne(targetEntity=Operator::class)
* @ORM\JoinColumn(nullable=false)
*/
private $operator;
/**
* @var string
* @ORM\Column(type="text", nullable=true)
*/
private $internalNote = '';
/**
* @var string
* @ORM\Column(type="string")
*/
private $requestNumber = '';
public function __construct()
{
$this->internetOptions = new ArrayCollection();
if ($this->dateCreated === null) {
$this->dateCreated = new DateTimeImmutable();
}
if ($this->realizationDate === null) {
$this->realizationDate = new DateTimeImmutable('tomorrow');
}
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return DateTimeImmutable
*/
public function getDateCreated(): DateTimeImmutable
{
return $this->dateCreated;
}
/**
* @param DateTimeImmutable $dateCreated
*
* @return ServiceRequest
*/
public function setDateCreated(DateTimeImmutable $dateCreated): ServiceRequest
{
$this->dateCreated = $dateCreated;
return $this;
}
/**
* @return DateTimeImmutable|null
*/
public function getRealizationDate(): ?DateTimeImmutable
{
return $this->realizationDate;
}
/**
* @param DateTimeImmutable|null $realizationDate
*
* @return ServiceRequest
*/
public function setRealizationDate(?DateTimeImmutable $realizationDate): ServiceRequest
{
$this->realizationDate = $realizationDate;
return $this;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getIsNewRequest(): ?bool
{
return $this->isNewRequest;
}
public function setIsNewRequest(bool $isNewRequest): self
{
$this->isNewRequest = $isNewRequest;
return $this;
}
public function getIsInvoiceDeliveryPost(): ?bool
{
return $this->isInvoiceDeliveryPost;
}
public function setIsInvoiceDeliveryPost(bool $isInvoiceDeliveryPost): self
{
$this->isInvoiceDeliveryPost = $isInvoiceDeliveryPost;
return $this;
}
public function getInvoiceDeliveryEmail(): ?string
{
return $this->invoiceDeliveryEmail;
}
public function setInvoiceDeliveryEmail(?string $invoiceDeliveryEmail): self
{
$this->invoiceDeliveryEmail = $invoiceDeliveryEmail;
return $this;
}
public function getLocationName(): ?string
{
return $this->locationName;
}
public function setLocationName(string $locationName): self
{
$this->locationName = $locationName;
return $this;
}
public function getLocationAddress(): ?string
{
return $this->locationAddress;
}
public function setLocationAddress(string $locationAddress): self
{
$this->locationAddress = $locationAddress;
return $this;
}
public function getLocationCity(): ?string
{
return $this->locationCity;
}
public function setLocationCity(string $locationCity): self
{
$this->locationCity = $locationCity;
return $this;
}
public function getLocationPostalCode(): ?string
{
return $this->locationPostalCode;
}
public function setLocationPostalCode(string $locationPostalCode): self
{
$this->locationPostalCode = $locationPostalCode;
return $this;
}
public function getPaymentMethod(): ?string
{
return $this->paymentMethod;
}
public function setPaymentMethod(string $paymentMethod): self
{
$this->paymentMethod = $paymentMethod;
return $this;
}
public function getContactTitle(): ?string
{
return $this->contactTitle;
}
public function setContactTitle(string $contactTitle): self
{
$this->contactTitle = $contactTitle;
return $this;
}
public function getContactFirstName(): ?string
{
return $this->contactFirstName;
}
public function setContactFirstName(string $contactFirstName): self
{
$this->contactFirstName = $contactFirstName;
return $this;
}
public function getContactLastName(): ?string
{
return $this->contactLastName;
}
public function setContactLastName(string $contactLastName): self
{
$this->contactLastName = $contactLastName;
return $this;
}
public function getContactPhone(): ?string
{
return $this->contactPhone;
}
public function setContactPhone(?string $contactPhone): self
{
$this->contactPhone = $contactPhone;
return $this;
}
public function getVoipEnabled(): ?bool
{
return $this->voipEnabled;
}
public function setVoipEnabled(bool $voipEnabled): self
{
$this->voipEnabled = $voipEnabled;
return $this;
}
public function getVoipMonthlyFee(): ?int
{
return $this->voipMonthlyFee;
}
public function setVoipMonthlyFee(int $voipMonthlyFee): self
{
$this->voipMonthlyFee = $voipMonthlyFee;
return $this;
}
public function getVoipConnectionFee(): ?string
{
return $this->voipConnectionFee;
}
public function setVoipConnectionFee(string $voipConnectionFee): self
{
$this->voipConnectionFee = $voipConnectionFee;
return $this;
}
public function getTerminalEquipmentLease(): ?bool
{
return $this->terminalEquipmentLease;
}
public function setTerminalEquipmentLease(bool $terminalEquipmentLease): self
{
$this->terminalEquipmentLease = $terminalEquipmentLease;
return $this;
}
public function getVoipChannels(): ?string
{
return $this->voipChannels;
}
public function setVoipChannels(string $voipChannels): self
{
$this->voipChannels = $voipChannels;
return $this;
}
public function getFax2mailChannels(): ?string
{
return $this->fax2mailChannels;
}
public function setFax2mailChannels(string $fax2mailChannels): self
{
$this->fax2mailChannels = $fax2mailChannels;
return $this;
}
public function getPhoneNumeration(): ?string
{
return $this->phoneNumeration;
}
public function setPhoneNumeration(string $phoneNumeration): self
{
$this->phoneNumeration = $phoneNumeration;
return $this;
}
public function getFaxNumeration(): ?string
{
return $this->faxNumeration;
}
public function setFaxNumeration(string $faxNumeration): self
{
$this->faxNumeration = $faxNumeration;
return $this;
}
public function getFax2mailEnabled(): ?bool
{
return $this->fax2mailEnabled;
}
public function setFax2mailEnabled(bool $fax2mailEnabled): self
{
$this->fax2mailEnabled = $fax2mailEnabled;
return $this;
}
public function getFax2mailEmail(): ?string
{
return $this->fax2mailEmail;
}
public function setFax2mailEmail(string $fax2mailEmail): self
{
$this->fax2mailEmail = $fax2mailEmail;
return $this;
}
public function getPhoneNumberTransfer(): ?bool
{
return $this->phoneNumberTransfer;
}
public function setPhoneNumberTransfer(bool $phoneNumberTransfer): self
{
$this->phoneNumberTransfer = $phoneNumberTransfer;
return $this;
}
public function getInternetAccessEnabled(): ?bool
{
return $this->internetAccessEnabled;
}
public function setInternetAccessEnabled(bool $internetAccessEnabled): self
{
$this->internetAccessEnabled = $internetAccessEnabled;
return $this;
}
/**
* @return Collection|InternetOption[]
*/
public function getInternetOptions(): Collection
{
return $this->internetOptions;
}
public function addInternetOption(InternetOption $internetOption): self
{
if (!$this->internetOptions->contains($internetOption)) {
$this->internetOptions[] = $internetOption;
}
return $this;
}
public function removeInternetOption(InternetOption $internetOption): self
{
if ($this->internetOptions->contains($internetOption)) {
$this->internetOptions->removeElement($internetOption);
}
return $this;
}
public function getContractIndefinite(): ?bool
{
return $this->contractIndefinite;
}
public function setContractIndefinite(bool $contractIndefinite): self
{
$this->contractIndefinite = $contractIndefinite;
return $this;
}
public function getContractOfferNo(): ?string
{
return $this->contractOfferNo;
}
public function setContractOfferNo(string $contractOfferNo): self
{
$this->contractOfferNo = $contractOfferNo;
return $this;
}
public function getContractDuration(): ?int
{
return $this->contractDuration;
}
public function setContractDuration(int $contractDuration): self
{
$this->contractDuration = $contractDuration;
return $this;
}
public function isLocked(): ?bool
{
return $this->isLocked;
}
public function setLocked(bool $isLocked): self
{
$this->isLocked = $isLocked;
return $this;
}
public function getOperator(): ?Operator
{
return $this->operator;
}
public function setOperator(?Operator $operator): self
{
$this->operator = $operator;
return $this;
}
/**
* @return int|null
*/
public function getInternetOptionsPrice(): ?int
{
if ($this->internetOptionsPrice === null && $this->internetOptions->count() > 0) {
$this->internetOptionsPrice = array_sum(
$this->internetOptions->map(
static function (InternetOption $io) {
return $io->getPrice();
}
)->toArray()
);
}
return $this->internetOptionsPrice;
}
/**
* @param int|null $internetOptionsPrice
*
* @return ServiceRequest
*/
public function setInternetOptionsPrice(?int $internetOptionsPrice): ServiceRequest
{
$this->internetOptionsPrice = $internetOptionsPrice;
return $this;
}
/**
* @return int|null
*/
public function getInternetConnectionFee(): ?int
{
return $this->internetConnectionFee;
}
/**
* @param int|null $internetConnectionFee
*
* @return ServiceRequest
*/
public function setInternetConnectionFee(?int $internetConnectionFee): ServiceRequest
{
$this->internetConnectionFee = $internetConnectionFee;
return $this;
}
/**
* @return int
*/
public function getTotalPrice(): int
{
return $this->totalPrice;
}
/**
* @param int $totalPrice
*
* @return ServiceRequest
*/
public function setTotalPrice(int $totalPrice): ServiceRequest
{
$this->totalPrice = $totalPrice;
return $this;
}
/**
* @return string
*/
public function getInternalNote(): string
{
return $this->internalNote ?? '';
}
/**
* @param string $internalNote
*
* @return ServiceRequest
*/
public function setInternalNote(?string $internalNote = ''): ServiceRequest
{
$this->internalNote = $internalNote;
return $this;
}
/**
* @return string
*/
public function getRequestNumber(): string
{
return $this->requestNumber;
}
/**
* @param string $requestNumber
*
* @return ServiceRequest
*/
public function setRequestNumber(string $requestNumber): ServiceRequest
{
$this->requestNumber = $requestNumber;
return $this;
}
}