<?php
namespace App\Entity;
use App\Repository\LeaveEntitlementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LeaveEntitlementRepository::class)]
class LeaveEntitlement
{
#[Groups(['LogService'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[Groups(['LogService'])]
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'leaveEntitlements')]
#[ORM\JoinColumn(nullable: false)]
private $user;
#[Groups(['LogService'])]
#[ORM\Column(type: 'string', length: 4, nullable: true)]
private $year;
#[Groups(['LogService'])]
#[ORM\Column(type: 'datetime', nullable: true)]
private $expiredAt;
#[Groups(['LogService'])]
#[ORM\Column(type: 'decimal', precision: 4, scale: 1, nullable: true)]
private $leaveEntitlements;
#[Groups(['LogService'])]
#[ORM\Column(type: 'decimal', precision: 4, scale: 1, nullable: true)]
private $leaveApproved;
#[Groups(['LogService'])]
#[ORM\Column(type: 'decimal', precision: 4, scale: 1, nullable: true)]
private $leaveLeft;
#[Groups(['LogService'])]
#[ORM\Column(type: 'decimal', precision: 4, scale: 1, nullable: true)]
private $sickEntitlements;
#[Groups(['LogService'])]
#[ORM\Column(type: 'datetime', nullable: true)]
private $createdAt;
#[Groups(['LogService'])]
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
#[Groups(['LogService'])]
#[ORM\Column(type: 'integer', nullable: true)]
private $sickJustified;
#[Groups(['LogService'])]
#[ORM\Column(type: 'integer', nullable: true)]
private $sickLeft;
#[Groups(['LogService'])]
#[ORM\Column(type: 'text', nullable: true)]
private $comment;
#[Groups(['LogService'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private $createdBy;
#[ORM\OneToMany(targetEntity: LeaveAdditional::class, mappedBy: 'leaveEntitlement')]
private $leaveAdditionals;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isIncremental;
#[ORM\Column(type: 'integer', nullable: true)]
private $incrementalStart;
#[ORM\Column(type: 'integer', nullable: true)]
private $incrementalValue;
#[ORM\Column(type: 'integer', nullable: true)]
private $annualDays;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isActive;
#[ORM\ManyToOne(targetEntity: LeaveType::class, inversedBy: 'leaveEntitlements')]
private $leaveType;
#[ORM\Column(type: 'json', nullable: true)]
private $attributes = [];
#[ORM\Column(type: 'text', nullable: true)]
private $notes;
#[ORM\Column(type: 'integer', nullable: true)]
private $parent;
#[ORM\Column(type: 'json', nullable: true)]
private $log = [];
public function __construct()
{
$this->leaveAdditionals = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getYear(): ?string
{
return $this->year;
}
public function setYear(string $year): self
{
$this->year = $year;
return $this;
}
public function getExpiredAt(): ?\DateTime
{
return $this->expiredAt;
}
public function setExpiredAt(\DateTime $expiredAt): self
{
$this->expiredAt = $expiredAt;
return $this;
}
public function getLeaveEntitlements(): ?string
{
return $this->leaveEntitlements;
}
public function setLeaveEntitlements(?string $leaveEntitlements): self
{
$this->leaveEntitlements = $leaveEntitlements;
return $this;
}
public function getLeaveApproved(): ?string
{
return $this->leaveApproved;
}
public function setLeaveApproved(?string $leaveApproved): self
{
$this->leaveApproved = $leaveApproved;
return $this;
}
public function getLeaveLeft(): ?string
{
return $this->leaveLeft;
}
public function setLeaveLeft(?string $leaveLeft): self
{
$this->leaveLeft = $leaveLeft;
return $this;
}
public function getsickEntitlements(): ?int
{
return $this->sickEntitlements;
}
public function setsickEntitlements(?int $sickEntitlements): self
{
$this->sickEntitlements = $sickEntitlements;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTime $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getsickJustified(): ?int
{
return $this->sickJustified;
}
public function setsickJustified(?int $sickJustified): self
{
$this->sickJustified = $sickJustified;
return $this;
}
public function getsickLeft(): ?int
{
return $this->sickLeft;
}
public function setsickLeft(?int $sickLeft): self
{
$this->sickLeft = $sickLeft;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getParent(): ?int
{
return $this->parent;
}
public function setParent(?int $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection<int, LeaveAdditional>
*/
public function getLeaveAdditionals(): Collection
{
return $this->leaveAdditionals;
}
public function addLeaveAdditional(LeaveAdditional $leaveAdditional): self
{
if (!$this->leaveAdditionals->contains($leaveAdditional)) {
$this->leaveAdditionals[] = $leaveAdditional;
$leaveAdditional->setLeaveEntitlement($this);
}
return $this;
}
public function removeLeaveAdditional(LeaveAdditional $leaveAdditional): self
{
if ($this->leaveAdditionals->removeElement($leaveAdditional)) {
// set the owning side to null (unless already changed)
if ($leaveAdditional->getLeaveEntitlement() === $this) {
$leaveAdditional->setLeaveEntitlement(null);
}
}
return $this;
}
public function getIsIncremental(): ?bool
{
return $this->isIncremental;
}
public function setIsIncremental(?bool $isIncremental): self
{
$this->isIncremental = $isIncremental;
return $this;
}
public function getIncrementalStart(): ?int
{
return $this->incrementalStart;
}
public function setIncrementalStart(?int $incrementalStart): self
{
$this->incrementalStart = $incrementalStart;
return $this;
}
public function getIncrementalValue(): ?int
{
return $this->incrementalValue;
}
public function setIncrementalValue(?int $incrementalValue): self
{
$this->incrementalValue = $incrementalValue;
return $this;
}
public function getAnnualDays(): ?int
{
return $this->annualDays;
}
public function setAnnualDays(?int $annualDays): self
{
$this->annualDays = $annualDays;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getLeaveType(): ?LeaveType
{
return $this->leaveType;
}
public function setLeaveType(?LeaveType $leaveType): self
{
$this->leaveType = $leaveType;
return $this;
}
public function getAttributes(): ?array
{
return $this->attributes;
}
public function setAttributes(?array $attributes): self
{
$this->attributes = $attributes;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(?string $notes): self
{
$this->notes = $notes;
return $this;
}
public function getLog(): ?array
{
return $this->log;
}
public function setLog(?array $log): self
{
$this->log = $log;
return $this;
}
}