<?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;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\ScheduleRequestRepository")
 * @ORM\Table(name="schedule_request")
 */

class ScheduleRequestEntity extends BaseEntity
{

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

    /**
     * @ORM\Column(name="start_time_hour", type="integer", nullable=true)
     */
    protected $startTimeHour;

    /**
     * @ORM\Column(name="start_time_minute", type="integer", nullable=true)
     */
    protected $startTimeMinute;

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

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

    /**
     * @ORM\Column(name="end_time_hour", type="integer", nullable=true)
     */
    protected $endTimeHour;

    /**
     * @ORM\Column(name="end_time_minute", type="integer", nullable=true)
     */
    protected $endTimeMinute;

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

    /**
     * @ORM\Column(name="schedule_date", type="datetime")
     */
    protected $scheduleDate;

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

    /**
     * @ORM\Column(name="deny_notes", type="text", nullable=true)
     */
    protected $denyNotes;

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

    /**
     * @ORM\Column(name="queue_no", type="integer", nullable=true)
     */
    protected $queueNo;

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

    /**
     * @ORM\ManyToOne(targetEntity="GeneralUserEntity", inversedBy="scheduleRequests")
     * @ORM\JoinColumn(name="general_user_id", referencedColumnName="id")
     */
    protected $generalUser;

    /**
     * @ORM\ManyToOne(targetEntity="HealthFacilityEntity", inversedBy="scheduleRequests")
     * @ORM\JoinColumn(name="health_facility_id", referencedColumnName="id")
     */
    protected $healthFacility;

    /**
     * @ORM\ManyToOne(targetEntity="ProviderEntity", inversedBy="scheduleRequests")
     * @ORM\JoinColumn(name="provider_id", referencedColumnName="id")
     */
    protected $provider;

    /**
     * @ORM\ManyToOne(targetEntity="ChartTypeEntity", inversedBy="scheduleRequests")
     * @ORM\JoinColumn(name="chart_type_id", referencedColumnName="id")
     */
    protected $chartType;

    /**
     * @ORM\OneToOne(targetEntity="ScheduleEntity", mappedBy="scheduleRequest")
     */
    protected $schedule;

    /**
     * @ORM\OneToOne(targetEntity="ScheduleQueuedEntity", mappedBy="scheduleRequest")
     */
    protected $scheduleQueued;


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

    }

    /**
     * Set updatedAt
     *
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        parent::setUpdatedAtValue();
        $this->updateStartEndTime();
    }

    /**
     * Concatenate start and end time
     */
    public function updateStartEndTime() {

        $this->startTime = sprintf('%002d', $this->startTimeHour) . ':' . sprintf('%002d', $this->startTimeMinute) . ' ' . $this->startTimePeriod;
        $this->endTime = sprintf('%002d', $this->endTimeHour) . ':' . sprintf('%002d', $this->endTimeMinute) . ' ' . $this->endTimePeriod;

        return $this;
    }

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

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

    /**
     * Set startTime
     *
     * @param string $startTime
     *
     * @return ScheduleRequestEntity
     */
    public function setStartTime($startTime)
    {
        $this->startTime = $startTime;

        return $this;
    }

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

    /**
     * Set startTimeHour
     *
     * @param integer $startTimeHour
     *
     * @return ScheduleRequestEntity
     */
    public function setStartTimeHour($startTimeHour)
    {
        $this->startTimeHour = $startTimeHour;

        return $this;
    }

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

    /**
     * Set startTimeMinute
     *
     * @param integer $startTimeMinute
     *
     * @return ScheduleRequestEntity
     */
    public function setStartTimeMinute($startTimeMinute)
    {
        $this->startTimeMinute = $startTimeMinute;

        return $this;
    }

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

    /**
     * Set startTimePeriod
     *
     * @param string $startTimePeriod
     *
     * @return ScheduleRequestEntity
     */
    public function setStartTimePeriod($startTimePeriod)
    {
        $this->startTimePeriod = $startTimePeriod;

        return $this;
    }

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

    /**
     * Set endTime
     *
     * @param string $endTime
     *
     * @return ScheduleRequestEntity
     */
    public function setEndTime($endTime)
    {
        $this->endTime = $endTime;

        return $this;
    }

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

    /**
     * Set endTimeHour
     *
     * @param integer $endTimeHour
     *
     * @return ScheduleRequestEntity
     */
    public function setEndTimeHour($endTimeHour)
    {
        $this->endTimeHour = $endTimeHour;

        return $this;
    }

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

    /**
     * Set endTimeMinute
     *
     * @param integer $endTimeMinute
     *
     * @return ScheduleRequestEntity
     */
    public function setEndTimeMinute($endTimeMinute)
    {
        $this->endTimeMinute = $endTimeMinute;

        return $this;
    }

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

    /**
     * Set endTimePeriod
     *
     * @param string $endTimePeriod
     *
     * @return ScheduleRequestEntity
     */
    public function setEndTimePeriod($endTimePeriod)
    {
        $this->endTimePeriod = $endTimePeriod;

        return $this;
    }

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

    /**
     * Set scheduleDate
     *
     * @param \DateTime $scheduleDate
     *
     * @return ScheduleRequestEntity
     */
    public function setScheduleDate($scheduleDate)
    {
        $this->scheduleDate = $scheduleDate;

        return $this;
    }

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

    /**
     * Set notes
     *
     * @param string $notes
     *
     * @return ScheduleRequestEntity
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;

        return $this;
    }

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

    /**
     * Set denyNotes
     *
     * @param string $denyNotes
     *
     * @return ScheduleRequestEntity
     */
    public function setDenyNotes($denyNotes)
    {
        $this->denyNotes = $denyNotes;

        return $this;
    }

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

    /**
     * Set status
     *
     * @param string $status
     *
     * @return ScheduleRequestEntity
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

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

    /**
     * Set queueNo
     *
     * @param integer $queueNo
     *
     * @return ScheduleRequestEntity
     */
    public function setQueueNo($queueNo)
    {
        $this->queueNo = $queueNo;

        return $this;
    }

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

    /**
     * Set generalUser
     *
     * @param \RxConnexionBundle\Entity\GeneralUserEntity $generalUser
     *
     * @return ScheduleRequestEntity
     */
    public function setGeneralUser(\RxConnexionBundle\Entity\GeneralUserEntity $generalUser = null)
    {
        $this->generalUser = $generalUser;

        return $this;
    }

    /**
     * Get generalUser
     *
     * @return \RxConnexionBundle\Entity\GeneralUserEntity
     */
    public function getGeneralUser()
    {
        return $this->generalUser;
    }

    /**
     * Set healthFacility
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility
     *
     * @return ScheduleRequestEntity
     */
    public function setHealthFacility(\RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility = null)
    {
        $this->healthFacility = $healthFacility;

        return $this;
    }

    /**
     * Get healthFacility
     *
     * @return \RxConnexionBundle\Entity\HealthFacilityEntity
     */
    public function getHealthFacility()
    {
        return $this->healthFacility;
    }

    /**
     * Set provider
     *
     * @param \RxConnexionBundle\Entity\ProviderEntity $provider
     *
     * @return ScheduleRequestEntity
     */
    public function setProvider(\RxConnexionBundle\Entity\ProviderEntity $provider = null)
    {
        $this->provider = $provider;

        return $this;
    }

    /**
     * Get provider
     *
     * @return \RxConnexionBundle\Entity\ProviderEntity
     */
    public function getProvider()
    {
        return $this->provider;
    }

    /**
     * Set chartType
     *
     * @param \RxConnexionBundle\Entity\ChartTypeEntity $chartType
     *
     * @return ScheduleRequestEntity
     */
    public function setChartType(\RxConnexionBundle\Entity\ChartTypeEntity $chartType = null)
    {
        $this->chartType = $chartType;

        return $this;
    }

    /**
     * Get chartType
     *
     * @return \RxConnexionBundle\Entity\ChartTypeEntity
     */
    public function getChartType()
    {
        return $this->chartType;
    }

    /**
     * Set schedule
     *
     * @param \RxConnexionBundle\Entity\ScheduleEntity $schedule
     *
     * @return ScheduleRequestEntity
     */
    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;
    }

    /**
     * Set scheduleQueued
     *
     * @param \RxConnexionBundle\Entity\ScheduleQueuedEntity $scheduleQueued
     *
     * @return ScheduleRequestEntity
     */
    public function setScheduleQueued(\RxConnexionBundle\Entity\ScheduleQueuedEntity $scheduleQueued = null)
    {
        $this->scheduleQueued = $scheduleQueued;

        return $this;
    }

    /**
     * Get scheduleQueued
     *
     * @return \RxConnexionBundle\Entity\ScheduleQueuedEntity
     */
    public function getScheduleQueued()
    {
        return $this->scheduleQueued;
    }

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

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return ScheduleRequestEntity
     */
    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 ScheduleRequestEntity
     */
    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 ScheduleRequestEntity
     */
    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 ScheduleRequestEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

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

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

        return $this;
    }

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