<?php

namespace RxConnexionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
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\PatientPaymentBreakdownRepository")
 * @ORM\Table(name="patient_payment_breakdown")
 * @ORM\HasLifecycleCallbacks()
 */

class PatientPaymentBreakdownEntity extends BaseEntity
{

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

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientBillingBreakdownEntity", inversedBy="patientPaymentBreakdowns")
     * @ORM\JoinColumn(name="patient_billing_breakdown_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientBillingBreakdown;

    /**
     * @ORM\ManyToOne(targetEntity="PatientPaymentEntity", inversedBy="patientPaymentBreakdowns")
     * @ORM\JoinColumn(name="patient_payment_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientPayment;

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

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

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


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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set status
     *
     * @param string $status
     *
     * @return PatientPaymentBreakdownEntity
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

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

    /**
     * Set patientBillingBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientBillingBreakdownEntity $patientBillingBreakdown
     *
     * @return PatientPaymentBreakdownEntity
     */
    public function setPatientBillingBreakdown(\RxConnexionBundle\Entity\PatientBillingBreakdownEntity $patientBillingBreakdown = null)
    {
        $this->patientBillingBreakdown = $patientBillingBreakdown;

        return $this;
    }

    /**
     * Get patientBillingBreakdown
     *
     * @return \RxConnexionBundle\Entity\PatientBillingBreakdownEntity
     */
    public function getPatientBillingBreakdown()
    {
        return $this->patientBillingBreakdown;
    }

    /**
     * Set patientPayment
     *
     * @param \RxConnexionBundle\Entity\PatientPaymentEntity $patientPayment
     *
     * @return PatientPaymentBreakdownEntity
     */
    public function setPatientPayment(\RxConnexionBundle\Entity\PatientPaymentEntity $patientPayment = null)
    {
        $this->patientPayment = $patientPayment;

        return $this;
    }

    /**
     * Get patientPayment
     *
     * @return \RxConnexionBundle\Entity\PatientPaymentEntity
     */
    public function getPatientPayment()
    {
        return $this->patientPayment;
    }

    /**
     * Set isRefunded
     *
     * @param boolean $isRefunded
     *
     * @return PatientPaymentBreakdownEntity
     */
    public function setIsRefunded($isRefunded)
    {
        $this->isRefunded = $isRefunded;

        return $this;
    }

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