<?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\ChecklistRepository")
 * @ORM\Table(name="checklist", indexes={@ORM\Index(name="IDX_SEARCH_000", columns={"description"})})
 */

class ChecklistEntity extends BaseEntity
{
    /**
     * @ORM\Column(type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $code;

    /**
     * @ORM\Column(type="string")
     * @Groups("forAudit")
     */
    protected $description;

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

    /**
     * @ORM\OneToMany(targetEntity="PatientChecklistEntity", mappedBy="checklist", cascade={"remove"})
     */
    protected $patientChecklists;


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

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

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

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


    /**
     * Set code
     *
     * @param string $code
     *
     * @return ChecklistEntity
     */
    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 ChecklistEntity
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Add patientChecklist
     *
     * @param \RxConnexionBundle\Entity\PatientChecklistEntity $patientChecklist
     *
     * @return ChecklistEntity
     */
    public function addPatientChecklist(\RxConnexionBundle\Entity\PatientChecklistEntity $patientChecklist)
    {
        $this->patientChecklists[] = $patientChecklist;

        return $this;
    }

    /**
     * Remove patientChecklist
     *
     * @param \RxConnexionBundle\Entity\PatientChecklistEntity $patientChecklist
     */
    public function removePatientChecklist(\RxConnexionBundle\Entity\PatientChecklistEntity $patientChecklist)
    {
        $this->patientChecklists->removeElement($patientChecklist);
    }

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