<?php
// @deprecated
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiProperty;
use App\Trait\TimestampableEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
/**
* The most generic type of item.
*
* @see https://schema.org/Thing
*
* @author Jordi Fernandes Alves <jfadev@gmail.com>
*/
#[ORM\Entity]
#[ApiResource(
iri: 'OperationSchedule',
itemOperations: [
'get' => ['normalization_context' => ['groups' => 'operation_schedule:item:get']],
'put' => [
'normalization_context' => ['groups' => 'operation_schedule:item:put'],
'denormalization_context' => ['groups' => 'operation_schedule:item:put'],
],
'delete' => [],
],
collectionOperations: [
'get' => [
'normalization_context' => ['groups' => 'operation_schedule:collection:get'],
],
'post' => [
'normalization_context' => ['groups' => 'operation_schedule:collection:post'],
'denormalization_context' => ['groups' => 'operation_schedule:collection:post'],
],
]
)]
class OperationSchedule
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'NONE')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ApiProperty(iri: 'https://schema.org/identifier')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:collection:get'])]
private ?UuidInterface $id = null;
#[ORM\Column(type: 'datetime', nullable: false)]
#[Assert\NotNull]
#[ApiProperty(iri: 'https://schema.org/loadingDate')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:item:put', 'operation_schedule:collection:get', 'operation_schedule:collection:post'])]
private ?\DateTime $loadingDate = null;
#[ORM\Column(type: 'datetime', nullable: false)]
#[Assert\NotNull]
#[ApiProperty(iri: 'https://schema.org/departureDate')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:item:put', 'operation_schedule:collection:get', 'operation_schedule:collection:post'])]
private ?\DateTime $departureDate = null;
#[ORM\Column(type: 'datetime', nullable: false)]
#[Assert\NotNull]
#[ApiProperty(iri: 'https://schema.org/arrivalDate')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:item:put', 'operation_schedule:collection:get', 'operation_schedule:collection:post'])]
private ?\DateTime $arrivalDate = null;
#[ORM\Column(type: 'datetime', nullable: false)]
#[Assert\NotNull]
#[ApiProperty(iri: 'https://schema.org/dischargeDate')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:item:put', 'operation_schedule:collection:get', 'operation_schedule:collection:post'])]
private ?\DateTime $dischargeDate = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Assert\Type('integer')]
#[ApiProperty(iri: 'https://schema.org/demurragePeriod')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:item:put', 'operation_schedule:collection:get', 'operation_schedule:collection:post'])]
private ?int $demurragePeriod = null;
#[ORM\ManyToMany(targetEntity: 'App\Entity\Payment')]
#[ORM\InverseJoinColumn(unique: true)]
#[ApiProperty(iri: 'https://schema.org/paymentSchedule')]
#[Groups(['operation_schedule:item:get', 'operation_schedule:item:put', 'operation_schedule:collection:get', 'operation_schedule:collection:post'])]
private ?Collection $paymentSchedule;
public function __construct()
{
$this->id = Uuid::uuid4();
}
public function getId(): ?UuidInterface
{
return $this->id;
}
public function setLoadingDate(?\DateTime $loadingDate): void
{
$this->loadingDate = $loadingDate;
}
public function getLoadingDate(): ?\DateTime
{
return $this->loadingDate;
}
public function setDepartureDate(?\DateTime $departureDate): void
{
$this->departureDate = $departureDate;
}
public function getDepartureDate(): ?\DateTime
{
return $this->departureDate;
}
public function setArrivalDate(?\DateTime $arrivalDate): void
{
$this->arrivalDate = $arrivalDate;
}
public function getArrivalDate(): ?\DateTime
{
return $this->arrivalDate;
}
public function setDischargeDate(?\DateTime $dischargeDate): void
{
$this->dischargeDate = $dischargeDate;
}
public function getDischargeDate(): ?\DateTime
{
return $this->dischargeDate;
}
public function setDemurragePeriod(?int $demurragePeriod): void
{
$this->demurragePeriod = $demurragePeriod;
}
public function getDemurragePeriod(): ?int
{
return $this->demurragePeriod;
}
public function addPaymentSchedule(Payment $paymentSchedule): void
{
$this->paymentSchedule[] = $paymentSchedule;
}
public function removePaymentSchedule(Payment $paymentSchedule): void
{
$this->paymentSchedule->removeElement($paymentSchedule);
}
public function getPaymentSchedule(): Collection
{
return $this->paymentSchedule;
}
}