package io.github.deltajulio.pantrybank.data;

import android.util.Log;

/**
 * TODO: add a class header comment
 */

public class FoodItem
{
    private final String TAG = "FoodItem";

    public enum QuantityType
    {
        NULL, NUMERICAL, APPROXIMATE
    }
    public enum QuantityApprox
    {
        NULL, NONE_REMAINING, RUNNING_LOW, NORMAL, PLENTY
    }

    private String name;
    private boolean isPinned;
    private String quantityType;
    private String quantity;
    private String foodId;

    @SuppressWarnings("unused")
    public FoodItem() { /*Needed for Firebase ui*/ }

    private FoodItem(String name, boolean isPinned, QuantityType quantityType, String quantity)
    {
        setName(name);
        setIsPinned(isPinned);
        setQuantityType(quantityType);
        setQuantity(quantity);
    }

    public FoodItem(String name, boolean isPinned, long quantityNum)
    {
        this(name, isPinned, QuantityType.NUMERICAL, String.valueOf(quantityNum));
    }

    public FoodItem(String name, boolean isPinned, QuantityApprox quantityApprox)
    {
        this(name, isPinned, QuantityType.APPROXIMATE, quantityApprox.toString());
    }

    public final String getName() { return name; }

    public void setName(String name) { this.name = name; }

    public final boolean getIsPinned() { return isPinned; }

    public void setIsPinned(boolean isPinned) { this.isPinned = isPinned; }

    public final QuantityType getQuantityType() { return QuantityType.valueOf(quantityType); }

    public void setQuantityType(QuantityType quantityType) { this.quantityType = quantityType.toString(); }

    /**
     * For retrieving database value ONLY. Use long or enum return value instead.
     */
    public final String getQuantity() { return quantity; }

    /**
     * For setting database value ONLY. Use long or enum param version instead.
     */
    public void setQuantity(String quantity) { this.quantity = quantity; }

    public final long GetQuantityLong() { return Long.parseLong(quantity);}
    public void SetQuantityLong(long quantity) { this.quantity = String.valueOf(quantity); }

    public final QuantityApprox GetQuantityEnum() { return QuantityApprox.valueOf(quantity); }
    public void SetQuantityEnum(QuantityApprox quantity) { this.quantity = quantity.toString(); }

    public String getFoodId() { return foodId; }

    public void setFoodId(String foodId) { this.foodId = foodId; }
}

@@ -476,16 +476,45 @@
 antity;%0A
+    private String category;%0A
     priv
@@ -713,16 +713,54 @@
 quantity
+,%0A                     String category
 )%0A    %7B%0A
@@ -883,16 +883,47 @@
 ntity);%0A
+        setCategory(category);%0A
     %7D%0A%0A 
@@ -988,16 +988,33 @@
 ntityNum
+, String category
 )%0A    %7B%0A
@@ -1093,16 +1093,26 @@
 tityNum)
+, category
 );%0A    %7D
@@ -1193,16 +1193,33 @@
 tyApprox
+, String category
 )%0A    %7B%0A
@@ -1298,16 +1298,26 @@
 String()
+, category
 );%0A    %7D
@@ -1361,33 +1361,32 @@
  return name; %7D%0A
-%0A
     public void 
@@ -1481,33 +1481,32 @@
 urn isPinned; %7D%0A
-%0A
     public void 
@@ -1657,25 +1657,24 @@
 ityType); %7D%0A
-%0A
     public v
@@ -2460,24 +2460,153 @@
 tring(); %7D%0A%0A
+    public String getCategory() %7B return category; %7D%0A    public void setCategory(String category) %7B this.category = category; %7D%0A%0A
     public S
@@ -2638,25 +2638,24 @@
 n foodId; %7D%0A
-%0A
     public v

add category to FoodItem