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

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\InventorySerialNoRepository")
 * @ORM\Table(name="inventory_serial_no")
 * @ORM\HasLifecycleCallbacks()
 */

class InventorySerialNoEntity extends BaseEntity
{
    const STATUS_1 = 'Available';
    const STATUS_2 = 'Sold';
    const STATUS_3 = 'Used';
	const STATUS_4 = 'In Transit';
	const STATUS_5 = 'Transferred';

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

    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\InventoryEntity", inversedBy="inventorySerialNos")
     * @ORM\JoinColumn(name="inventory_id", referencedColumnName="id")
     */
    protected $inventory;

    /**
    * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\PatientBillingInventoryEntity", inversedBy="inventorySerialNos")
    * @ORM\JoinColumn(name="patient_billing_inventory_id", referencedColumnName="id")
    */
    protected $patientBillingInventory;

    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\PurchaseOrderBreakdownItemDeliverySerialNoEntity", inversedBy="inventorySerialNos")
     * @ORM\JoinColumn(name="pobid_serial_no_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $purchaseOrderBreakdownItemDeliverySerialNo;

    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\TransferInventoryItemDeliveryEntity", inversedBy="inventorySerialNos")
     * @ORM\JoinColumn(name="transfer_inventory_item_delivery_entity_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $transferInventoryItemDelivery;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\PatientBillingBreakdownEntity", mappedBy="inventorySerialNo", cascade={"persist","remove"})
     */
    protected $patientBillingBreakdowns;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\PatientBillingInventoryEntity", mappedBy="inventorySerialNo", cascade={"remove"})
     */
    protected $patientBillingInventories;

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

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

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\ConvertInventoryItemEntity", mappedBy="inventorySerialNo", cascade={"remove"})
    */
    protected $convertInventoryItems;

    /**
     * @ORM\OneToMany(targetEntity="ConvertInventoryItemInventorySerialNoEntity", mappedBy="inventorySerialNo", cascade={"remove"})
     */
    protected $convertInventoryItemInventorySerialNos;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\TransferInventoryItemInventorySerialNoEntity", mappedBy="inventorySerialNo", cascade={"remove"})
     */
    protected $transferInventoryItemInventorySerialNos;

	/**
	 * @ORM\OneToMany(targetEntity="TransferInventoryItemDeliveryInventorySerialNoEntity", mappedBy="inventorySerialNo", cascade={"remove"})
	 */
	protected $transferInventoryItemDeliveryInventorySerialNos;

	/**
	 * @ORM\OneToMany(targetEntity="InventoryMovementEntity", mappedBy="inventorySerialNo", cascade={"remove"})
	 */
	protected $inventoryMovements;


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

    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
        $this->status = self::STATUS_1;
    }

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

        return $this;
    }

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

    /**
     * Set inventory
     *
     * @param \RxConnexionBundle\Entity\InventoryEntity $inventory
     *
     * @return InventorySerialNoEntity
     */
    public function setInventory(\RxConnexionBundle\Entity\InventoryEntity $inventory = null)
    {
        $this->inventory = $inventory;

        return $this;
    }

    /**
     * Get inventory
     *
     * @return \RxConnexionBundle\Entity\InventoryEntity
     */
    public function getInventory()
    {
        return $this->inventory;
    }

    /**
     * Set purchaseOrderBreakdownItemDeliverySerialNo
     *
     * @param \RxConnexionBundle\Entity\PurchaseOrderBreakdownItemDeliverySerialNoEntity $purchaseOrderBreakdownItemDeliverySerialNo
     *
     * @return InventorySerialNoEntity
     */
    public function setPurchaseOrderBreakdownItemDeliverySerialNo(\RxConnexionBundle\Entity\PurchaseOrderBreakdownItemDeliverySerialNoEntity $purchaseOrderBreakdownItemDeliverySerialNo = null)
    {
        $this->purchaseOrderBreakdownItemDeliverySerialNo = $purchaseOrderBreakdownItemDeliverySerialNo;

        return $this;
    }

    /**
     * Get purchaseOrderBreakdownItemDeliverySerialNo
     *
     * @return \RxConnexionBundle\Entity\PurchaseOrderBreakdownItemDeliverySerialNoEntity
     */
    public function getPurchaseOrderBreakdownItemDeliverySerialNo()
    {
        return $this->purchaseOrderBreakdownItemDeliverySerialNo;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->patientBillingBreakdowns = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add patientBillingBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientBillingBreakdownEntity $patientBillingBreakdown
     *
     * @return InventorySerialNoEntity
     */
    public function addPatientBillingBreakdown(\RxConnexionBundle\Entity\PatientBillingBreakdownEntity $patientBillingBreakdown)
    {
        $this->patientBillingBreakdowns[] = $patientBillingBreakdown;

        return $this;
    }

    /**
     * Remove patientBillingBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientBillingBreakdownEntity $patientBillingBreakdown
     */
    public function removePatientBillingBreakdown(\RxConnexionBundle\Entity\PatientBillingBreakdownEntity $patientBillingBreakdown)
    {
        $this->patientBillingBreakdowns->removeElement($patientBillingBreakdown);
    }

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

    /**
     * Add patientBillingInventory
     *
     * @param \RxConnexionBundle\Entity\PatientBillingInventoryEntity $patientBillingInventory
     *
     * @return InventorySerialNoEntity
     */
    public function addPatientBillingInventory(\RxConnexionBundle\Entity\PatientBillingInventoryEntity $patientBillingInventory)
    {
        $this->patientBillingInventories[] = $patientBillingInventory;

        return $this;
    }

    /**
     * Remove patientBillingInventory
     *
     * @param \RxConnexionBundle\Entity\PatientBillingInventoryEntity $patientBillingInventory
     */
    public function removePatientBillingInventory(\RxConnexionBundle\Entity\PatientBillingInventoryEntity $patientBillingInventory)
    {
        $this->patientBillingInventories->removeElement($patientBillingInventory);
    }

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

    /**
     * Set serialNo
     *
     * @param string $serialNo
     *
     * @return InventorySerialNoEntity
     */
    public function setSerialNo($serialNo)
    {
        $this->serialNo = $serialNo;

        return $this;
    }

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

    /**
     * Set patientBillingInventory
     *
     * @param \RxConnexionBundle\Entity\PatientBillingInventoryEntity $patientBillingInventory
     *
     * @return InventorySerialNoEntity
     */
    public function setPatientBillingInventory(\RxConnexionBundle\Entity\PatientBillingInventoryEntity $patientBillingInventory = null)
    {
        $this->patientBillingInventory = $patientBillingInventory;

        return $this;
    }

    /**
     * Get patientBillingInventory
     *
     * @return \RxConnexionBundle\Entity\PatientBillingInventoryEntity
     */
    public function getPatientBillingInventory()
    {
        return $this->patientBillingInventory;
    }

    /**
     * Add convertInventoryItem
     *
     * @param \RxConnexionBundle\Entity\ConvertInventoryItemEntity $convertInventoryItem
     *
     * @return InventorySerialNoEntity
     */
    public function addConvertInventoryItem(\RxConnexionBundle\Entity\ConvertInventoryItemEntity $convertInventoryItem)
    {
        $this->convertInventoryItems[] = $convertInventoryItem;

        return $this;
    }

    /**
     * Remove convertInventoryItem
     *
     * @param \RxConnexionBundle\Entity\ConvertInventoryItemEntity $convertInventoryItem
     */
    public function removeConvertInventoryItem(\RxConnexionBundle\Entity\ConvertInventoryItemEntity $convertInventoryItem)
    {
        $this->convertInventoryItems->removeElement($convertInventoryItem);
    }

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

    /**
     * Add convertInventoryItemInventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\ConvertInventoryItemInventorySerialNoEntity $convertInventoryItemInventorySerialNo
     *
     * @return InventorySerialNoEntity
     */
    public function addConvertInventoryItemInventorySerialNo(\RxConnexionBundle\Entity\ConvertInventoryItemInventorySerialNoEntity $convertInventoryItemInventorySerialNo)
    {
        $this->convertInventoryItemInventorySerialNos[] = $convertInventoryItemInventorySerialNo;

        return $this;
    }

    /**
     * Remove convertInventoryItemInventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\ConvertInventoryItemInventorySerialNoEntity $convertInventoryItemInventorySerialNo
     */
    public function removeConvertInventoryItemInventorySerialNo(\RxConnexionBundle\Entity\ConvertInventoryItemInventorySerialNoEntity $convertInventoryItemInventorySerialNo)
    {
        $this->convertInventoryItemInventorySerialNos->removeElement($convertInventoryItemInventorySerialNo);
    }

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

    /**
     * Add transferInventoryItemInventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryItemInventorySerialNoEntity $transferInventoryItemInventorySerialNo
     *
     * @return InventorySerialNoEntity
     */
    public function addTransferInventoryItemInventorySerialNo(\RxConnexionBundle\Entity\TransferInventoryItemInventorySerialNoEntity $transferInventoryItemInventorySerialNo)
    {
        $this->transferInventoryItemInventorySerialNos[] = $transferInventoryItemInventorySerialNo;

        return $this;
    }

    /**
     * Remove transferInventoryItemInventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryItemInventorySerialNoEntity $transferInventoryItemInventorySerialNo
     */
    public function removeTransferInventoryItemInventorySerialNo(\RxConnexionBundle\Entity\TransferInventoryItemInventorySerialNoEntity $transferInventoryItemInventorySerialNo)
    {
        $this->transferInventoryItemInventorySerialNos->removeElement($transferInventoryItemInventorySerialNo);
    }

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

    /**
     * Add transferInventoryItemDeliveryInventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryItemDeliveryInventorySerialNoEntity $transferInventoryItemDeliveryInventorySerialNo
     *
     * @return InventorySerialNoEntity
     */
    public function addTransferInventoryItemDeliveryInventorySerialNo(\RxConnexionBundle\Entity\TransferInventoryItemDeliveryInventorySerialNoEntity $transferInventoryItemDeliveryInventorySerialNo)
    {
        $this->transferInventoryItemDeliveryInventorySerialNos[] = $transferInventoryItemDeliveryInventorySerialNo;

        return $this;
    }

    /**
     * Remove transferInventoryItemDeliveryInventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryItemDeliveryInventorySerialNoEntity $transferInventoryItemDeliveryInventorySerialNo
     */
    public function removeTransferInventoryItemDeliveryInventorySerialNo(\RxConnexionBundle\Entity\TransferInventoryItemDeliveryInventorySerialNoEntity $transferInventoryItemDeliveryInventorySerialNo)
    {
        $this->transferInventoryItemDeliveryInventorySerialNos->removeElement($transferInventoryItemDeliveryInventorySerialNo);
    }

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

    /**
     * Set transferInventoryItemDelivery
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryItemDeliveryEntity $transferInventoryItemDelivery
     *
     * @return InventorySerialNoEntity
     */
    public function setTransferInventoryItemDelivery(\RxConnexionBundle\Entity\TransferInventoryItemDeliveryEntity $transferInventoryItemDelivery = null)
    {
        $this->transferInventoryItemDelivery = $transferInventoryItemDelivery;

        return $this;
    }

    /**
     * Get transferInventoryItemDelivery
     *
     * @return \RxConnexionBundle\Entity\TransferInventoryItemDeliveryEntity
     */
    public function getTransferInventoryItemDelivery()
    {
        return $this->transferInventoryItemDelivery;
    }

    /**
     * Set price
     *
     * @param string $cost
     *
     * @return InventorySerialNoEntity
     */
    public function setCost($cost)
    {
        $this->cost = str_replace(',', '', $cost
        );

        return $this;
    }

    /**
     * Get price
     *
     * @return string
     */
    public function getCost()
    {
        return $this->cost;
    }

    /**
     * Add inventoryMovement
     *
     * @param \RxConnexionBundle\Entity\InventoryMovementEntity $inventoryMovement
     *
     * @return InventorySerialNoEntity
     */
    public function addInventoryMovement(\RxConnexionBundle\Entity\InventoryMovementEntity $inventoryMovement)
    {
        $this->inventoryMovements[] = $inventoryMovement;

        return $this;
    }

    /**
     * Remove inventoryMovement
     *
     * @param \RxConnexionBundle\Entity\InventoryMovementEntity $inventoryMovement
     */
    public function removeInventoryMovement(\RxConnexionBundle\Entity\InventoryMovementEntity $inventoryMovement)
    {
        $this->inventoryMovements->removeElement($inventoryMovement);
    }

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