<?php

namespace VGM\WOBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use VGM\WOBundle\Utils\Utils as Utils;

/**
 * @ORM\Entity
 * @ORM\HasLifecycleCallbacks
 *
 * NDepartment
 */
class NDepartment
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $name;

    /**
     * @var \DateTime
     */
    private $created_at;

    /**
     * @var \DateTime
     */
    private $updated_at;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $workers;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->workers = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return NDepartment
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set created_at
     *
     * @param \DateTime $createdAt
     * @return NDepartment
     */
    public function setCreatedAt($createdAt)
    {
        $this->created_at = $createdAt;

        return $this;
    }

    /**
     * Get created_at
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    /**
     * Set updated_at
     *
     * @param \DateTime $updatedAt
     * @return NDepartment
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updated_at = $updatedAt;

        return $this;
    }

    /**
     * Get updated_at
     *
     * @return \DateTime 
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }

   /**
     * Add workers
     *
     * @param \VGM\WOBundle\Entity\Worker $workers
     * @return NDepartment
     */
    public function addWorker(\VGM\WOBundle\Entity\Worker $workers)
    {
        $this->workers[] = $workers;

        return $this;
    }

    /**
     * Remove workers
     *
     * @param \VGM\WOBundle\Entity\Worker $workers
     */
    public function removeWorker(\VGM\WOBundle\Entity\Worker $workers)
    {
        $this->workers->removeElement($workers);
    }

    /**
     * Get workers
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getWorkers()
    {
        return $this->workers;
    }

    /**
     * @ORM\PrePersist
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        $this->setUpdatedAt(new \DateTime());

        return $this;
    }

    public function slug(){
        return Utils::slugify($this->getName());
    }

    public function __toString(){
        return $this->getName();
    }
    /**
     * @var string
     */
    private $description;


    /**
     * Set description
     *
     * @param string $description
     * @return NDepartment
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        $this->setCreatedAt(new \DateTime());

        return $this;
    }
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $supervisors;


    /**
     * Add supervisor
     *
     * @param \VGM\WOBundle\Entity\Worker $supervisor
     *
     * @return NDepartment
     */
    public function addSupervisor(\VGM\WOBundle\Entity\Worker $supervisor)
    {
        $this->supervisors[] = $supervisor;

        return $this;
    }

    /**
     * Remove supervisor
     *
     * @param \VGM\WOBundle\Entity\Worker $supervisor
     */
    public function removeSupervisor(\VGM\WOBundle\Entity\Worker $supervisor)
    {
        $this->supervisors->removeElement($supervisor);
    }

    /**
     * Get supervisors
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getSupervisors()
    {
        return $this->supervisors;
    }

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $units;


    /**
     * Add unit
     *
     * @param \VGM\WOBundle\Entity\CUnit $unit
     *
     * @return NDepartment
     */
    public function addUnit(\VGM\WOBundle\Entity\CUnit $unit)
    {
        $this->units[] = $unit;

        return $this;
    }

    /**
     * Remove unit
     *
     * @param \VGM\WOBundle\Entity\CUnit $unit
     */
    public function removeUnit(\VGM\WOBundle\Entity\CUnit $unit)
    {
        $this->units->removeElement($unit);
    }

    /**
     * Get units
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getUnits()
    {
        return $this->units;
    }
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $shifts;


    /**
     * Add shift
     *
     * @param \VGM\WOBundle\Entity\LaborLoop $shift
     *
     * @return NDepartment
     */
    public function addShift(\VGM\WOBundle\Entity\LaborLoop $shift)
    {
        $this->shifts[] = $shift;

        return $this;
    }

    /**
     * Remove shift
     *
     * @param \VGM\WOBundle\Entity\LaborLoop $shift
     */
    public function removeShift(\VGM\WOBundle\Entity\LaborLoop $shift)
    {
        $this->shifts->removeElement($shift);
    }

    /**
     * Get shifts
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getShifts()
    {
        return $this->shifts;
    }
}
