package com.veggie.src.java.controllers.media;

import com.veggie.src.java.controllers.Controller;
import com.veggie.src.java.form.*;
import com.veggie.src.java.notification.*;
import com.veggie.src.java.database.*;

import java.util.List;

public class RemoveItemController implements Controller {

	//Instance Variables
	private int itemID;
	private Notification notification;
	private Form removeItemForm;
	private ItemDatabaseManager manager;

	//Methods
	public RemoveItemController(int id) {
		itemID = id;
		AbstractFormBuilder builder = AbstractFormBuilderFactory.getInstance().createFormBuilder();
		builder.addField("Status");
		removeItemForm = builder.getResult();
		manager = AbstractDatabaseManagerFactory.getInstance().createItemDatabaseManager();
	}

	public Form activate() {
		return removeItemForm;
	}

	public Notification submitForm(Form form) {
		List<String> formData = removeItemForm.getData();
		//TO DO
		return notification;
	}

	public void respondToNotification(Notification notif) {
		//TO DO
	}

}

@@ -319,29 +319,8 @@
 les%0A
-%09private int itemID;%0A
 %09pri
@@ -464,32 +464,11 @@
 ler(
-int id) %7B%0A%09%09itemID = id;
+) %7B
 %0A%09%09A
@@ -582,14 +582,15 @@
 ld(%22
-Status
+Item ID
 %22);%0A
@@ -825,67 +825,146 @@
 %7B%0A%09%09
-List%3CString%3E formData = removeItemForm
+removeItemForm = form;%0A%09%09notification = AbstractNotificationFactory
 .get
-Data();%0A%09%09//TO DO
+Instance().createConfirmNotification(%22Proceed with item removal?%22);
 %0A%09%09r
@@ -1050,15 +1050,138 @@
 %7B%0A%09%09
-//TO DO
+if (notif.ok()) %7B%0A%09%09%09List%3CString%3E formData = editItemForm.getData();%0A%09%09%09manager.removeItem(Integer.parseInt(formData.get(0)));%0A%09%09%7D
 %0A%09%7D%0A

Implement RemoveItemController