<?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\FileTypeRepository")
 * @ORM\Table(name="file_type", indexes={@ORM\Index(name="IDX_SEARCH_000", columns={"description"})})
 */

class FileTypeEntity 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="PatientFileEntity", mappedBy="fileType")
     */
    protected $patientFiles;

    /**
     * @ORM\OneToMany(targetEntity="PortalEntity", mappedBy="fileType")
     */
    protected $portals;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\AccountingFileEntity", mappedBy="fileType", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $accountingFiles;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\FaxingOptionConfirmationEntity", mappedBy="fileType", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $faxingOptionConfirmations;

    public function __construct()
    {
        $this->patientFiles = new ArrayCollection();
        $this->portals = new ArrayCollection();
        $this->accountingFiles = new ArrayCollection();
        $this->faxingOptionConfirmations = new ArrayCollection();
    }

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


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

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



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

        return $this;
    }

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

    /**
     * Add patientFile
     *
     * @param \RxConnexionBundle\Entity\PatientFileEntity $patientFile
     *
     * @return FileTypeEntity
     */
    public function addPatientFile(\RxConnexionBundle\Entity\PatientFileEntity $patientFile)
    {
        $this->patientFiles[] = $patientFile;

        return $this;
    }

    /**
     * Remove patientFile
     *
     * @param \RxConnexionBundle\Entity\PatientFileEntity $patientFile
     */
    public function removePatientFile(\RxConnexionBundle\Entity\PatientFileEntity $patientFile)
    {
        $this->patientFiles->removeElement($patientFile);
    }

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

    /**
     * Add portal
     *
     * @param \RxConnexionBundle\Entity\PortalEntity $portal
     *
     * @return FileTypeEntity
     */
    public function addPortal(\RxConnexionBundle\Entity\PortalEntity $portal)
    {
        $this->portals[] = $portal;

        return $this;
    }

    /**
     * Remove portal
     *
     * @param \RxConnexionBundle\Entity\PortalEntity $portal
     */
    public function removePortal(\RxConnexionBundle\Entity\PortalEntity $portal)
    {
        $this->portals->removeElement($portal);
    }

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

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

        return $this;
    }

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

    /**
     * Add accountingFile
     *
     * @param \RxConnexionBundle\Entity\AccountingFileEntity $accountingFile
     *
     * @return FileTypeEntity
     */
    public function addAccountingFile(\RxConnexionBundle\Entity\AccountingFileEntity $accountingFile)
    {
        $this->accountingFiles[] = $accountingFile;

        return $this;
    }

    /**
     * Remove accountingFile
     *
     * @param \RxConnexionBundle\Entity\AccountingFileEntity $accountingFile
     */
    public function removeAccountingFile(\RxConnexionBundle\Entity\AccountingFileEntity $accountingFile)
    {
        $this->accountingFiles->removeElement($accountingFile);
    }

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

    /**
     * Add faxingOptionConfirmation
     *
     * @param \RxConnexionBundle\Entity\FaxingOptionConfirmationEntity $faxingOptionConfirmation
     *
     * @return FileTypeEntity
     */
    public function addFaxingOptionConfirmation(\RxConnexionBundle\Entity\FaxingOptionConfirmationEntity $faxingOptionConfirmation)
    {
        $this->faxingOptionConfirmations[] = $faxingOptionConfirmation;

        return $this;
    }

    /**
     * Remove faxingOptionConfirmation
     *
     * @param \RxConnexionBundle\Entity\FaxingOptionConfirmationEntity $faxingOptionConfirmation
     */
    public function removeFaxingOptionConfirmation(\RxConnexionBundle\Entity\FaxingOptionConfirmationEntity $faxingOptionConfirmation)
    {
        $this->faxingOptionConfirmations->removeElement($faxingOptionConfirmation);
    }

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