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

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\ServiceRepository")
 * @ORM\Table(name="service", indexes={@ORM\Index(name="IDX_SEARCH_000", columns={"description"})})
 */

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

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

    /**
     * @ORM\Column(name="is_specialist", type="boolean", nullable=true)
     */
    protected $isSpecialist;

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

    /**
     * @ORM\OneToMany(targetEntity="PatientServiceEntity", mappedBy="service", cascade={"remove"})
     */
    protected $patientServices;

    /**
     * @ORM\OneToMany(targetEntity="ReferralServiceEntity", mappedBy="service", cascade={"remove"})
     */
    protected $referralServices;


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

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

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

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


    /**
     * Set code
     *
     * @param string $code
     *
     * @return ServiceEntity
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

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

    /**
     * Set description
     *
     * @param string $description
     *
     * @return ServiceEntity
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Add patientService
     *
     * @param \RxConnexionBundle\Entity\PatientServiceEntity $patientService
     *
     * @return ServiceEntity
     */
    public function addPatientService(\RxConnexionBundle\Entity\PatientServiceEntity $patientService)
    {
        $this->patientServices[] = $patientService;

        return $this;
    }

    /**
     * Remove patientService
     *
     * @param \RxConnexionBundle\Entity\PatientServiceEntity $patientService
     */
    public function removePatientService(\RxConnexionBundle\Entity\PatientServiceEntity $patientService)
    {
        $this->patientServices->removeElement($patientService);
    }

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

    /**
     * Add referralService
     *
     * @param \RxConnexionBundle\Entity\ReferralServiceEntity $referralService
     *
     * @return ServiceEntity
     */
    public function addReferralService(\RxConnexionBundle\Entity\ReferralServiceEntity $referralService)
    {
        $this->referralServices[] = $referralService;

        return $this;
    }

    /**
     * Remove referralService
     *
     * @param \RxConnexionBundle\Entity\ReferralServiceEntity $referralService
     */
    public function removeReferralService(\RxConnexionBundle\Entity\ReferralServiceEntity $referralService)
    {
        $this->referralServices->removeElement($referralService);
    }

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

    /**
     * Set isSpecialist
     *
     * @param boolean $isSpecialist
     *
     * @return ServiceEntity
     */
    public function setIsSpecialist($isSpecialist)
    {
        $this->isSpecialist = $isSpecialist;

        return $this;
    }

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