<?php

namespace VGM\WOBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Equipment
 */
class Equipment
{
    /**
     * @var integer
     */
    private $id;
    /**
     * @var integer
     */
    private $asdb_id;
    /**
     * @var string
     */
    private $code;
    /**
     * @var string
     */
    private $description;
    /**
     * @var \DateTime
     */
    private $createdat;
    /**
     * @var \DateTime
     */
    private $updatedat;
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $workorders;
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $stocks;
    /**
     * @var boolean
     */
    private $multiple_wos = false;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->workorders = new \Doctrine\Common\Collections\ArrayCollection();
    }
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set code
     *
     * @param string $code
     * @return Equipment
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }
    /**
     * Get code
     *
     * @return string 
     */
    public function getCode()
    {
        return $this->code;
    }
    /**
     * Set description
     *
     * @param string $description
     * @return Equipment
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }
    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * Set createdat
     *
     * @param \DateTime $createdat
     * @return Equipment
     */
    public function setCreatedat($createdat)
    {
        $this->createdat = $createdat;

        return $this;
    }
    /**
     * Get createdat
     *
     * @return \DateTime 
     */
    public function getCreatedat()
    {
        return $this->createdat;
    }
    /**
     * Set updatedat
     *
     * @param \DateTime $updatedat
     * @return Equipment
     */
    public function setUpdatedat($updatedat)
    {
        $this->updatedat = $updatedat;

        return $this;
    }
    /**
     * Get updatedat
     *
     * @return \DateTime 
     */
    public function getUpdatedat()
    {
        return $this->updatedat;
    }
    /**
     * Add workorders
     *
     * @param \VGM\WOBundle\Entity\WorkOrder $workorders
     * @return Equipment
     */
    public function addWorkorder(\VGM\WOBundle\Entity\WorkOrder $workorders)
    {
        $this->workorders[] = $workorders;

        return $this;
    }
    /**
     * Remove workorders
     *
     * @param \VGM\WOBundle\Entity\WorkOrder $workorders
     */
    public function removeWorkorder(\VGM\WOBundle\Entity\WorkOrder $workorders)
    {
        $this->workorders->removeElement($workorders);
    }
    /**
     * Get workorders
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getWorkorders()
    {
        return $this->workorders;
    }
    /**
     * Set asdb_id
     *
     * @param integer $asdbId
     * @return Equipment
     */
    public function setAsdbId($asdbId)
    {
        $this->asdb_id = $asdbId;

        return $this;
    }
    /**
     * Get asdb_id
     *
     * @return integer
     */
    public function getAsdbId()
    {
        return $this->asdb_id;
    }
    /**
     * Add stocks
     *
     * @param \VGM\WOBundle\Entity\Stock $stocks
     * @return Equipment
     */
    public function addStock(\VGM\WOBundle\Entity\Stock $stocks)
    {
        $this->stocks[] = $stocks;

        return $this;
    }
    /**
     * Remove stocks
     *
     * @param \VGM\WOBundle\Entity\Stock $stocks
     */
    public function removeStock(\VGM\WOBundle\Entity\Stock $stocks)
    {
        $this->stocks->removeElement($stocks);
    }
    /**
     * Get stocks
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getStocks()
    {
        return $this->stocks;
    }
    /**
     * Set multipleWos
     *
     * @param boolean $multipleWos
     *
     * @return Equipment
     */
    public function setMultipleWos($multipleWos)
    {
        $this->multiple_wos = $multipleWos;

        return $this;
    }
    /**
     * Get multipleWos
     *
     * @return boolean
     */
    public function getMultipleWos()
    {
        return $this->multiple_wos;
    }

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

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

        return $this;
    }

    public function __toString(){
        return $this->getCode().' - '.$this->getDescription();
    }
}
