<?php

namespace RxConnexionBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use RxConnexionBundle\Entity\Base\BaseEntity;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\MaxDepth;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\AppointmentNoticeFaxRepository")
 * @ORM\Table(name="appointment_notice_fax")
 */

class AppointmentNoticeFaxEntity extends BaseEntity
{
    const AFFILIATE_TYPE = array(
        'Insurance'     => 'Insurance',
        /*'Referring Affiliate' => 'Referring Affiliate',*/
        'Referring Physician' => 'Referring Physician',
    );

    /**
     * @ORM\Column(type="string", length=50)
     */
    protected $affiliateType;

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

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

    /**
     * @ORM\ManyToOne(targetEntity="ScheduleEntity", inversedBy="appointmentNoticeFaxes")
     * @ORM\JoinColumn(name="schedule_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $schedule;

    /**
     * @ORM\ManyToOne(targetEntity="PatientReferringProviderEntity", inversedBy="appointmentNoticeFaxes")
     * @ORM\JoinColumn(name="patient_referring_provider_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientReferringProvider;

    /**
     * @ORM\ManyToOne(targetEntity="PatientReferringHealthFacilityEntity", inversedBy="appointmentNoticeFaxes")
     * @ORM\JoinColumn(name="patient_referring_health_facility_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientReferringHealthFacility;

    /**
     * @ORM\ManyToOne(targetEntity="PatientInsuranceEntity", inversedBy="appointmentNoticeFaxes")
     * @ORM\JoinColumn(name="patient_insurance_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientInsurance;

    /**
     * @ORM\OneToMany(targetEntity="FaxTranOutboundEntity", mappedBy="appointmentNoticeFax")
     */
    protected $faxTranOutbounds;

    public function __construct()
    {
        $this->faxTranOutbounds = new ArrayCollection();
    }

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

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

//    /**
//     * Get startDateAsString
//     *
//     * @return string
//     */
//    public function getStartDateAsString() {
//
//        $dttst = new DateTimeToStringTransformer();
//        return !empty($this->startDate) ? date('m/d/Y', strtotime($dttst->transform($this->startDate))) : '';
//    }
//
//    /**
//     * Get endDateAsString
//     *
//     * @return string
//     */
//    public function getEndDateAsString() {
//
//        $dttst = new DateTimeToStringTransformer();
//        return !empty($this->endDate) ? date('m/d/Y', strtotime($dttst->transform($this->endDate))) : '';
//    }

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

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

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

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

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

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

    /**
     * Set updatedBy
     *
     * @param string $updatedBy
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setUpdatedBy($updatedBy)
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

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

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

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

    /**
     * Set patient
     *
     * @param \RxConnexionBundle\Entity\PatientEntity $patient
     *
     * @return AppointmentNoticeFaxEntity
     */
    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 patientReferringProvider
     *
     * @param \RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setPatientReferringProvider(\RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider = null)
    {
        $this->patientReferringProvider = $patientReferringProvider;

        return $this;
    }

    /**
     * Get patientReferringProvider
     *
     * @return \RxConnexionBundle\Entity\PatientReferringProviderEntity
     */
    public function getPatientReferringProvider()
    {
        return $this->patientReferringProvider;
    }

    /**
     * Set patientReferringHealthFacility
     *
     * @param \RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setPatientReferringHealthFacility(\RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility = null)
    {
        $this->patientReferringHealthFacility = $patientReferringHealthFacility;

        return $this;
    }

    /**
     * Get patientReferringHealthFacility
     *
     * @return \RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity
     */
    public function getPatientReferringHealthFacility()
    {
        return $this->patientReferringHealthFacility;
    }

    /**
     * Set patientInsurance
     *
     * @param \RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setPatientInsurance(\RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance = null)
    {
        $this->patientInsurance = $patientInsurance;

        return $this;
    }

    /**
     * Get patientInsurance
     *
     * @return \RxConnexionBundle\Entity\PatientInsuranceEntity
     */
    public function getPatientInsurance()
    {
        return $this->patientInsurance;
    }

    /**
     * Set affiliateType
     *
     * @param string $affiliateType
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setAffiliateType($affiliateType)
    {
        $this->affiliateType = $affiliateType;

        return $this;
    }

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

    /**
     * Set schedule
     *
     * @param \RxConnexionBundle\Entity\ScheduleEntity $schedule
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function setSchedule(\RxConnexionBundle\Entity\ScheduleEntity $schedule = null)
    {
        $this->schedule = $schedule;

        return $this;
    }

    /**
     * Get schedule
     *
     * @return \RxConnexionBundle\Entity\ScheduleEntity
     */
    public function getSchedule()
    {
        return $this->schedule;
    }

    /**
     * Add faxTranOutbound
     *
     * @param \RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound
     *
     * @return AppointmentNoticeFaxEntity
     */
    public function addFaxTranOutbound(\RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound)
    {
        $this->faxTranOutbounds[] = $faxTranOutbound;

        return $this;
    }

    /**
     * Remove faxTranOutbound
     *
     * @param \RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound
     */
    public function removeFaxTranOutbound(\RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound)
    {
        $this->faxTranOutbounds->removeElement($faxTranOutbound);
    }

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

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

        return $this;
    }

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