<?php

namespace App\Entity;

use App\Repository\LeavenameRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

/**
 * @ORM\Entity(repositoryClass=LeavenameRepository::class)
 */
class Leavename
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $name;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $days;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $remarks;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $status;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $type;

    /**
     * @ORM\OneToMany(targetEntity=LeaveApplication::class, mappedBy="leavename")
     */
    private $leaveApplications;

    public function __construct()
    {
        $this->leaveApplications = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getDays(): ?int
    {
        return $this->days;
    }

    public function setDays(?int $days): self
    {
        $this->days = $days;

        return $this;
    }

    public function getRemarks(): ?string
    {
        return $this->remarks;
    }

    public function setRemarks(?string $remarks): self
    {
        $this->remarks = $remarks;

        return $this;
    }

    public function getStatus(): ?int
    {
        return $this->status;
    }

    public function setStatus(?int $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getType(): ?int
    {
        return $this->type;
    }

    public function setType(?int $type): self
    {
        $this->type = $type;

        return $this;
    }

    /**
     * @return Collection|LeaveApplication[]
     */
    public function getLeaveApplications(): Collection
    {
        return $this->leaveApplications;
    }

    public function addLeaveApplication(LeaveApplication $leaveApplication): self
    {
        if (!$this->leaveApplications->contains($leaveApplication)) {
            $this->leaveApplications[] = $leaveApplication;
            $leaveApplication->setLeave($this);
        }

        return $this;
    }

    public function removeLeaveApplication(LeaveApplication $leaveApplication): self
    {
        if ($this->leaveApplications->removeElement($leaveApplication)) {
            // set the owning side to null (unless already changed)
            if ($leaveApplication->getLeave() === $this) {
                $leaveApplication->setLeave(null);
            }
        }

        return $this;
    }
}
