<?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\PatientLetterPatientReferralStatusRepository")
 * @ORM\Table(name="patient_letter_patient_referral_status")
 */

class PatientLetterPatientReferralStatusEntity extends BaseEntity
{
    /**
     * @ORM\Column(name="is_declined", type="boolean", nullable=true)
     * @Groups("forAudit")
     */
    protected $isDeclined;

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientLetterEntity", inversedBy="patientLetterQuotations")
     * @ORM\JoinColumn(name="patient_letter_id", referencedColumnName="id")
     */
    protected $patientLetter;


    /**
     * Set createdAt
     *
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
    }

    public function __construct()
    {

    }

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

    /**
     * get missedAppointmentDateAsString
     *
     * @return string
     */
    public function getMissedAppointmentDateAsString() {

        $dttst = new DateTimeToStringTransformer();

        return !empty($this->missedAppointmentDate) ? date('m/d/Y', strtotime($dttst->transform($this->missedAppointmentDate))) : '';
    }

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


    /**
     * Set isDeclined
     *
     * @param boolean $isDeclined
     *
     * @return PatientLetterPatientReferralStatusEntity
     */
    public function setIsDeclined($isDeclined)
    {
        $this->isDeclined = $isDeclined;

        return $this;
    }

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

    /**
     * Set isUnableToContact
     *
     * @param boolean $isUnableToContact
     *
     * @return PatientLetterPatientReferralStatusEntity
     */
    public function setIsUnableToContact($isUnableToContact)
    {
        $this->isUnableToContact = $isUnableToContact;

        return $this;
    }

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

    /**
     * Set isMissedAppointment
     *
     * @param boolean $isMissedAppointment
     *
     * @return PatientLetterPatientReferralStatusEntity
     */
    public function setIsMissedAppointment($isMissedAppointment)
    {
        $this->isMissedAppointment = $isMissedAppointment;

        return $this;
    }

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

    /**
     * Set patientLetter
     *
     * @param \RxConnexionBundle\Entity\PatientLetterEntity $patientLetter
     *
     * @return PatientLetterPatientReferralStatusEntity
     */
    public function setPatientLetter(\RxConnexionBundle\Entity\PatientLetterEntity $patientLetter = null)
    {
        $this->patientLetter = $patientLetter;

        return $this;
    }

    /**
     * Get patientLetter
     *
     * @return \RxConnexionBundle\Entity\PatientLetterEntity
     */
    public function getPatientLetter()
    {
        return $this->patientLetter;
    }

    /**
     * Set missedAppointmentDate
     *
     * @param \DateTime $missedAppointmentDate
     *
     * @return PatientLetterPatientReferralStatusEntity
     */
    public function setMissedAppointmentDate($missedAppointmentDate)
    {
        $this->missedAppointmentDate = empty($missedAppointmentDate) ? NULL : new \DateTime($missedAppointmentDate);

        return $this;
    }

    /**
     * Get missedAppointmentDate
     *
     * @return \DateTime
     */
    public function getMissedAppointmentDate()
    {
        return $this->missedAppointmentDate;
    }
}
