<?php

namespace RxConnexionBundle\Entity;

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



/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\ReferredByPatientRepository")
 * @ORM\Table(name="referred_by_patient")
 */

class ReferredByPatientEntity extends BaseEntity
{

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientEntity", inversedBy="referredByPatients")
     * @ORM\JoinColumn(name="patient_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patient;

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

    public function __construct()
    {

    }


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


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

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

        return $this;
    }

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

    /**
     * Set patient
     *
     * @param \RxConnexionBundle\Entity\PatientEntity $patient
     *
     * @return ReferredByPatientEntity
     */
    public function setPatient(\RxConnexionBundle\Entity\PatientEntity $patient = null)
    {
        $this->patient = $patient;

        return $this;
    }

    /**
     * Get patient
     *
     * @return \RxConnexionBundle\Entity\PatientEntity
     */
    public function getPatient()
    {
        return $this->patient;
    }

    /**
     * Set referredBy
     *
     * @param integer $referredBy
     *
     * @return ReferredByPatientEntity
     */
    public function setReferredBy($referredBy)
    {
        $this->referredBy = !empty($referredBy) ? $referredBy : NULL;

        return $this;
    }

    /**
     * Get referredBy
     *
     * @return integer
     */
    public function getReferredBy()
    {
        return $this->referredBy;
    }

    /**
     * Set referredByFullName
     *
     * @param string $referredByFullName
     *
     * @return ReferredByPatientEntity
     */
    public function setReferredByFullName($referredByFullName)
    {
        $this->referredByFullName = $referredByFullName;

        return $this;
    }

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