<?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\PatientChartProcedureRepository")
 * @ORM\Table(name="patient_chart_procedure")
 */

class PatientChartProcedureEntity extends BaseEntity
{

    /**
     * @ORM\Column(name="amount", type="decimal", precision=10, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $amount;

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

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientChartEntity", inversedBy="procedures")
     * @ORM\JoinColumn(name="patient_chart_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientChart;

    /**
     * @ORM\ManyToOne(targetEntity="ChartProcedureEntity", inversedBy="patientChartProcedures")
     * @ORM\JoinColumn(name="chart_procedure_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $chartProcedure;

    /**
     * @ORM\OneToMany(targetEntity="PatientChartPaymentProcedureEntity", mappedBy="patientChartProcedure", cascade={"remove"})
     */
    protected $patientChartPaymentProcedures;

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

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

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

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


    /**
     * Set amount
     *
     * @param string $amount
     *
     * @return PatientChartProcedureEntity
     */
    public function setAmount($amount)
    {
        $this->amount = str_replace(',' ,'',$amount);

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set patientChart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $patientChart
     *
     * @return PatientChartProcedureEntity
     */
    public function setPatientChart(\RxConnexionBundle\Entity\PatientChartEntity $patientChart = null)
    {
        $this->patientChart = $patientChart;

        return $this;
    }

    /**
     * Get patientChart
     *
     * @return \RxConnexionBundle\Entity\PatientChartEntity
     */
    public function getPatientChart()
    {
        return $this->patientChart;
    }

    /**
     * Set chartProcedure
     *
     * @param \RxConnexionBundle\Entity\ChartProcedureEntity $chartProcedure
     *
     * @return PatientChartProcedureEntity
     */
    public function setChartProcedure(\RxConnexionBundle\Entity\ChartProcedureEntity $chartProcedure = null)
    {
        $this->chartProcedure = $chartProcedure;

        return $this;
    }

    /**
     * Get chartProcedure
     *
     * @return \RxConnexionBundle\Entity\ChartProcedureEntity
     */
    public function getChartProcedure()
    {
        return $this->chartProcedure;
    }

    /**
     * Add patientChartPaymentProcedure
     *
     * @param \RxConnexionBundle\Entity\PatientChartPaymentProcedureEntity $patientChartPaymentProcedure
     *
     * @return PatientChartProcedureEntity
     */
    public function addPatientChartPaymentProcedure(\RxConnexionBundle\Entity\PatientChartPaymentProcedureEntity $patientChartPaymentProcedure)
    {
        $this->patientChartPaymentProcedures[] = $patientChartPaymentProcedure;

        return $this;
    }

    /**
     * Remove patientChartPaymentProcedure
     *
     * @param \RxConnexionBundle\Entity\PatientChartPaymentProcedureEntity $patientChartPaymentProcedure
     */
    public function removePatientChartPaymentProcedure(\RxConnexionBundle\Entity\PatientChartPaymentProcedureEntity $patientChartPaymentProcedure)
    {
        $this->patientChartPaymentProcedures->removeElement($patientChartPaymentProcedure);
    }

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

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

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

        return $this;
    }

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