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

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

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

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientLetterEntity", inversedBy="patientLetterPrescriptions")
     * @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 patientStatementDateAsString
     *
     * @return string
     */
    public function getPatientStatementDateAsString()
    {
        $dttst = new DateTimeToStringTransformer();
        return !empty($this->patientStatementDate) ? date('m/d/Y', strtotime($dttst->transform($this->patientStatementDate))) : '';
    }

    /**
     * get witnessInfoDateAsString
     *
     * @return string
     */
    public function getWitnessInfoDateAsString()
    {
        $dttst = new DateTimeToStringTransformer();
        return !empty($this->witnessInfoDate) ? date('m/d/Y', strtotime($dttst->transform($this->witnessInfoDate))) : '';
    }

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



    /**
     * Set name
     *
     * @param string $name
     *
     * @return PatientLetterRefusalCareEntity
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

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

    /**
     * Set patientStatement
     *
     * @param string $patientStatement
     *
     * @return PatientLetterRefusalCareEntity
     */
    public function setPatientStatement($patientStatement)
    {
        $this->patientStatement = $patientStatement;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set witnessInfoName
     *
     * @param string $witnessInfoName
     *
     * @return PatientLetterRefusalCareEntity
     */
    public function setWitnessInfoName($witnessInfoName)
    {
        $this->witnessInfoName = $witnessInfoName;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set patientLetter
     *
     * @param \RxConnexionBundle\Entity\PatientLetterEntity $patientLetter
     *
     * @return PatientLetterRefusalCareEntity
     */
    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;
    }
}
