<?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;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\MaxDepth;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\MarketingStaffWorkScheduleRepository")
 * @ORM\Table(name="marketing_staff_work_schedule")
 */

class MarketingStaffWorkScheduleEntity extends BaseEntity
{
    CONST TYPE_REGULAR = 'Regular';
    CONST TYPE_IRREGULAR = 'Irregular';
    CONST TYPE_OUT = 'Out';

    CONST DAYNAME_MONDAY = 'Monday';
    CONST DAYNAME_TUESDAY = 'Tuesday';
    CONST DAYNAME_WEDNESDAY = 'Wednesday';
    CONST DAYNAME_THURSDAY = 'Thursday';
    CONST DAYNAME_FRIDAY = 'Friday';
    CONST DAYNAME_SATURDAY = 'Saturday';

    CONST FROMAM_AM = 'AM';
    CONST FROMAM_PM = 'PM';

    CONST TOAM_AM = 'AM';
    CONST TOPM_PM = 'PM';


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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="MarketingStaffEntity", inversedBy="marketingStaffWorkSchedules")
     * @ORM\JoinColumn(name="marketing_staff_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $marketingStaff;

    /**
     * @ORM\ManyToOne(targetEntity="HealthFacilityEntity", inversedBy="marketingStaffWorkSchedules")
     * @ORM\JoinColumn(name="health_facility_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $healthFacility;

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


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

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

    /**
     * Get toDateAsString
     *
     * @return string
     */
    public function getToDateAsString() {

        $dttst = new DateTimeToStringTransformer();
        return !empty($this->toDate) ? date('m/d/Y', strtotime($dttst->transform($this->toDate))) : '';
    }
    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/


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

        return $this;
    }

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

    /**
     * Set dayName
     *
     * @param string $dayName
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setDayName($dayName)
    {
        $this->dayName = $dayName;

        return $this;
    }

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

    /**
     * Set fromDate
     *
     * @param \DateTime $fromDate
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setFromDate($fromDate)
    {
        $this->fromDate = empty($fromDate) ? NULL : new \DateTime($fromDate);
        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set toHr
     *
     * @param string $toHr
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setToHr($toHr)
    {
        $this->toHr = $toHr;

        return $this;
    }

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

    /**
     * Set toMin
     *
     * @param string $toMin
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setToMin($toMin)
    {
        $this->toMin = $toMin;

        return $this;
    }

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

    /**
     * Set toAm
     *
     * @param string $toAm
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setToAm($toAm)
    {
        $this->toAm = $toAm;

        return $this;
    }

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

    /**
     * Set fromHr
     *
     * @param string $fromHr
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setFromHr($fromHr)
    {
        $this->fromHr = $fromHr;

        return $this;
    }

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

    /**
     * Set fromMin
     *
     * @param string $fromMin
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setFromMin($fromMin)
    {
        $this->fromMin = $fromMin;

        return $this;
    }

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

    /**
     * Set fromAm
     *
     * @param string $fromAm
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setFromAm($fromAm)
    {
        $this->fromAm = $fromAm;

        return $this;
    }

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

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

        return $this;
    }

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

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

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

        return $this;
    }

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

    /**
     * Set marketingStaff
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffEntity $marketingStaff
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setMarketingStaff(\RxConnexionBundle\Entity\MarketingStaffEntity $marketingStaff = null)
    {
        $this->marketingStaff = $marketingStaff;

        return $this;
    }

    /**
     * Get marketingStaff
     *
     * @return \RxConnexionBundle\Entity\MarketingStaffEntity
     */
    public function getMarketingStaff()
    {
        return $this->marketingStaff;
    }

    /**
     * Set healthFacility
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    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 isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return MarketingStaffWorkScheduleEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

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