<?php

namespace RxConnexionBundle\Entity;

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

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\ReferringHealthFacilityNoteRepository")
 * @ORM\Table(name="referring_health_facility_note", indexes={
 *     @ORM\Index(name="IDX_AAA000", columns={"created_at"})
 *     })
 */

class ReferringHealthFacilityNoteEntity extends BaseEntity
{
    const TYPE_CLINICAL = 'Clinical';
    const TYPE_BILLING = 'Billing';
    const TYPE_APPOINTMENT = 'Appointment';
    const TYPE_SPECIALIST = 'Specialist';
    const TYPE_LETTER = 'Letter';
    const TYPE_ENCOUNTER = 'Encounter';

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="ReferringHealthFacilityEntity", inversedBy="referringHealthFacilityNotes")
     * @ORM\JoinColumn(name="referring_health_facility_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $referringHealthFacility;

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

    /*--------------------------------------------------------------------------------------------------------*/
    /*					Use Defined Setters and Getters														  */
    /*--------------------------------------------------------------------------------------------------------*/
    /**
     * Get createdAtAsString
     *
     * @return string
     */
    public function getCreatedAtAsString() {

        $dttst = new DateTimeToStringTransformer();
        return date('m/d/Y H:i:s A', strtotime($dttst->transform(new \DateTime())));
    }
    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/


    /**
     * Set note
     *
     * @param string $note
     *
     * @return ReferringHealthFacilityNoteEntity
     */
    public function setNote($note)
    {
        $this->note = $note;

        return $this;
    }

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

    /**
     * Set type
     *
     * @param string $type
     *
     * @return ReferringHealthFacilityNoteEntity
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set referringHealthFacility
     *
     * @param \RxConnexionBundle\Entity\ReferringHealthFacilityEntity $referringHealthFacility
     *
     * @return ReferringHealthFacilityNoteEntity
     */
    public function setReferringHealthFacility(\RxConnexionBundle\Entity\ReferringHealthFacilityEntity $referringHealthFacility = null)
    {
        $this->referringHealthFacility = $referringHealthFacility;

        return $this;
    }

    /**
     * Get referringHealthFacility
     *
     * @return \RxConnexionBundle\Entity\ReferringHealthFacilityEntity
     */
    public function getReferringHealthFacility()
    {
        return $this->referringHealthFacility;
    }
}
