/**
 * Created by Djidjelly Siclait on 11/1/2016.
 */
package com.clinichelper.Entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.UUID;

@Entity
@Table(name = "medications")
public class Medication implements Serializable{
    // Attributes
    @Id
    private String medicationId;
    private String medicationName;
    private String supplier;
    @Column(length = 500)
    private String medicationDescription;
    private Integer medicationInStock;
    @ManyToOne
    private Clinic clinic;

    // Constructors
    public Medication(){

    }

    public Medication(Clinic clinic, String medicationName, String supplier, String medicationDescription, Integer medicationInStock){
        this.setMedicationId(clinic.getClinicPrefix() + UUID.randomUUID().toString().split("-")[0].toUpperCase());
        this.setMedicationName(medicationName);
        this.setSupplier(supplier);
        this.setMedicationDescription(medicationDescription);
        this.setMedicationInStock(medicationInStock);
    }

    // Getters and Setters
    public String getMedicationId() {
        return medicationId;
    }

    public void setMedicationId(String medicationId) {
        this.medicationId = medicationId;
    }

    public String getMedicationName() {
        return medicationName;
    }

    public void setMedicationName(String medicationName) {
        this.medicationName = medicationName;
    }

    public String getSupplier() {
        return supplier;
    }

    public void setSupplier(String supplier) {
        this.supplier = supplier;
    }

    public String getMedicationDescription() {
        return medicationDescription;
    }

    public void setMedicationDescription(String medicationDescription) {
        this.medicationDescription = medicationDescription;
    }

    public Integer getMedicationInStock() {
        return medicationInStock;
    }

    public void setMedicationInStock(Integer medicationInStock) {
        this.medicationInStock = medicationInStock;
    }

    public Clinic getClinic() {
        return clinic;
    }

    public void setClinic(Clinic clinic) {
        this.clinic = clinic;
    }
}

@@ -435,24 +435,59 @@
 escription;%0A
+    private Float medicationPrice;%0A
     private 
@@ -509,24 +509,24 @@
 ionInStock;%0A
-
     @ManyToO
@@ -715,16 +715,39 @@
 ription,
+ Float medicationPrice,
  Integer
@@ -966,16 +966,16 @@
 plier);%0A
-
         
@@ -1028,16 +1028,66 @@
 ption);%0A
+        this.setMedicationPrice(medicationPrice);%0A
         
@@ -2270,11 +2270,205 @@
 c;%0A    %7D
+%0A%0A    public Float getMedicationPrice() %7B%0A        return medicationPrice;%0A    %7D%0A%0A    public void setMedicationPrice(Float medicationPrice) %7B%0A        this.medicationPrice = medicationPrice;%0A    %7D
 %0A%7D%0A

Refactor Medication entity with price