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

class TreatmentPlanEntity 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="PatientTreatmentPlanEntity", mappedBy="treatmentPlan", cascade={"remove"})
     */
    protected $patientTreatmentPlans;


    public function __construct()
    {
        $this->patientTreatmentPlans = 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 TreatmentPlanEntity
     */
    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 TreatmentPlanEntity
     */
    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 TreatmentPlanEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

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

    /**
     * Add patientTreatmentPlan
     *
     * @param \RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentPlan
     *
     * @return TreatmentPlanEntity
     */
    public function addPatientTreatmentPlan(\RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentPlan)
    {
        $this->patientTreatmentPlans[] = $patientTreatmentPlan;

        return $this;
    }

    /**
     * Remove patientTreatmentPlan
     *
     * @param \RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentPlan
     */
    public function removePatientTreatmentPlan(\RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentPlan)
    {
        $this->patientTreatmentPlans->removeElement($patientTreatmentPlan);
    }

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