<?php

namespace RxConnexionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use RxConnexionBundle\Entity\Base\BaseEntity;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\MaxDepth;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\ItemItemRepository")
 * @ORM\Table(name="item_item")
 */

class ItemItemEntity extends BaseEntity
{
    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\ItemEntity", inversedBy="itemItems")
     * @ORM\JoinColumn(name="item_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $item;

    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\ItemEntity", inversedBy="mainItemItems")
     * @ORM\JoinColumn(name="main_item_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $mainItem;

    /**
     * @ORM\Column(name="is_deleted", type="boolean")
     */
    protected $isDeleted;

    /**
     * Set createdAt
     *
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
        $this->isDeleted = 0;
    }

    /*--------------------------------------------------------------------------------------------------------*/
    /*					User Defined Setters and Getters													  */
    /*--------------------------------------------------------------------------------------------------------*/

    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/


    /**
     * Set isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return ItemItemEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return boolean
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Set item
     *
     * @param \RxConnexionBundle\Entity\ItemEntity $item
     *
     * @return ItemItemEntity
     */
    public function setItem(\RxConnexionBundle\Entity\ItemEntity $item = null)
    {
        $this->item = $item;

        return $this;
    }

    /**
     * Get item
     *
     * @return \RxConnexionBundle\Entity\ItemEntity
     */
    public function getItem()
    {
        return $this->item;
    }

    /**
     * Set mainItem
     *
     * @param \RxConnexionBundle\Entity\ItemEntity $mainItem
     *
     * @return ItemItemEntity
     */
    public function setMainItem(\RxConnexionBundle\Entity\ItemEntity $mainItem = null)
    {
        $this->mainItem = $mainItem;

        return $this;
    }

    /**
     * Get mainItem
     *
     * @return \RxConnexionBundle\Entity\ItemEntity
     */
    public function getMainItem()
    {
        return $this->mainItem;
    }
}
