<?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;


/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\TicketStatusRepository")
 * @ORM\Table(name="ticket_status")
 */

class TicketStatusEntity extends BaseEntity
{
    /**
     * @ORM\Column(name="description", type="string")
     * @Groups("forAudit")
     */
    protected $description;

    /**
     * @ORM\Column(name="code", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $code;

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

    /**
     * @ORM\OneToMany(targetEntity="TicketEntity", mappedBy="ticketStatus", cascade={"remove"})
     */
    protected $tickets;

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

    public function __construct()
    {
    }


    /*--------------------------------------------------------------------------------------------------------*/
    /*					Use Defined Setters and Getters														  */
    /*--------------------------------------------------------------------------------------------------------*/

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

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

        return $this;
    }

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

    /**
     * Set code
     *
     * @param string $code
     *
     * @return TicketStatusEntity
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Add ticket
     *
     * @param \RxConnexionBundle\Entity\TicketEntity $ticket
     *
     * @return TicketStatusEntity
     */
    public function addTicket(\RxConnexionBundle\Entity\TicketEntity $ticket)
    {
        $this->tickets[] = $ticket;

        return $this;
    }

    /**
     * Remove ticket
     *
     * @param \RxConnexionBundle\Entity\TicketEntity $ticket
     */
    public function removeTicket(\RxConnexionBundle\Entity\TicketEntity $ticket)
    {
        $this->tickets->removeElement($ticket);
    }

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