package ca.ualberta.cs.oneclick_cookbook;

import java.util.List;

//import android.provider.MediaStore.Images;

public class Recipe {

	private String name = "";
	private Pantry ingredients = null;
	private String steps = "";
    // private List<Images> pictures = null;
	private int promotions = 0;
	private int demotions = 0;
	
	//for online IDing
	private String id;

	public Recipe() {
		
	}
	public Recipe(String name, Pantry ingredients, String steps) {
		this.name = name;
		this.ingredients = ingredients;
		this.steps = steps;
		this.promotions = 0;
		this.demotions = 0;
		
		//Auto-Generate ID tag. . . somehow.
		this.id = "5202";
	}
	
	/*
	 * 
	 */
	public String getID() {
		return this.id;
	}

	public void changeName(String newName) {
		this.name = newName;
		return;
	}

	public String getName() {
		return this.name;
	}

	public void changeSteps(String newSteps) {
		this.steps = newSteps;
		return;
	}

	public String getSteps() {
		return this.steps;
	}

	public void modifyIngredients(Pantry newIngredients) {
		this.ingredients = newIngredients;
		return;
	}

	public Pantry getIngredients() {
		return this.ingredients;
	}

	public void promote() {
		this.promotions += 1;
		return;
	}

	public void demote() {
		this.demotions += 1;
		return;
	}

	public int getRating() {
		int rating = this.promotions - this.demotions;
		return rating;
	}

	// Turns the recipe into a string
	public String toString() {
		String localName = this.name;
		String localIngredients = this.ingredients.toString();
		
		if (localIngredients.length() > 20) {
			localIngredients = localIngredients.substring(0, 20) + "...";
		}
		
		if (localName.length() > 20) {
			localName = localName.substring(0, 20) + "...";
		}
		
		return "Title: " + localName + "\nIngredients: " + localIngredients;
	}

	// Checks the recipe for valid info
	public int isValidInfo() {

		if (name == null || steps == null  || ingredients == null ) {
			return Constants.NULL_VALUE;
		}

		else if (name.equals("") || steps.equals("") || ingredients.isEmpty()) {
			return Constants.ZERO_VALUE;
		}

		else {
			return ingredients.isValidInfo();
		}
	}
	
	/**
	 * Posts 'this' recipe to elasticsearch
	 */
	public void postToES() {
		
	}
}

@@ -1,8 +1,257 @@
+/**%0A * @author%09Chris Serafin, Peter Maidens, Ken %22Mike%22 Armstrong, Kimberly Kramer%0A * %0A * This class is the class that is used to store the recipes that are submitted%0A * by users. It contains all the infromation that is needed for the recipes.%0A */%0A%0A
 package 
@@ -639,16 +639,254 @@
 %7B%0A%09%09%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Constructor%0A%09 * @param name Name of the recipe%0A%09 * @param ingredients Actually a Pantry Class Object that is used as the list of ingredients%0A%09 * @param steps A string that outlines the steps requried in cooking the recipe%0A%09 */%0A
 %09public 
@@ -1133,22 +1133,8 @@
 %7D%0A%09%0A
-%09/*%0A%09 * %0A%09 */%0A
 %09pub
@@ -1836,17 +1836,22 @@
 ;%0A%09%7D%0A%0A%09/
-/
+**%0A%09 *
  Turns t
@@ -1867,22 +1867,98 @@
  into a 
-string
+String.%0A%09 * @return String The recipe that has been reformated into a string.%0A%09 */
 %0A%09public
@@ -2683,24 +2683,24 @@
 %7D%0A%09%7D%0A%09%0A%09/**%0A
-
 %09 * Posts 't
@@ -2728,16 +2728,54 @@
 csearch%0A
+%09 * %3Cp%3E%0A%09 * Not Currently Implemented%0A
 %09 */%0A%09pu

Update Recipe.java