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

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

class HealthFacilityTypeEntity extends BaseEntity
{

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

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

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

    /**
     * @ORM\OneToMany(targetEntity="HealthFacilityEntity", mappedBy="healthFacilityType")
     */
    protected $healthFacilities;

    /**
     * @ORM\OneToMany(targetEntity="HealthFacilityRegistrationEntity", mappedBy="healthFacilityType")
     */
    protected $healthFacilityRegistrations;

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

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

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

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


    /**
     * Set code
     *
     * @param string $code
     *
     * @return HealthFacilityTypeEntity
     */
    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 HealthFacilityTypeEntity
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

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

    /**
     * Add healthFacility
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility
     *
     * @return HealthFacilityTypeEntity
     */
    public function addHealthFacility(\RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility)
    {
        $this->healthFacilities[] = $healthFacility;

        return $this;
    }

    /**
     * Remove healthFacility
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility
     */
    public function removeHealthFacility(\RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility)
    {
        $this->healthFacilities->removeElement($healthFacility);
    }

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

    /**
     * Add healthFacilityRegistration
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityRegistrationEntity $healthFacilityRegistration
     *
     * @return HealthFacilityTypeEntity
     */
    public function addHealthFacilityRegistration(\RxConnexionBundle\Entity\HealthFacilityRegistrationEntity $healthFacilityRegistration)
    {
        $this->healthFacilityRegistrations[] = $healthFacilityRegistration;

        return $this;
    }

    /**
     * Remove healthFacilityRegistration
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityRegistrationEntity $healthFacilityRegistration
     */
    public function removeHealthFacilityRegistration(\RxConnexionBundle\Entity\HealthFacilityRegistrationEntity $healthFacilityRegistration)
    {
        $this->healthFacilityRegistrations->removeElement($healthFacilityRegistration);
    }

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

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

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

        return $this;
    }

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