package svc.managers;

import org.springframework.stereotype.Component;

@Component
public class TwilioManager {
	//(480) 405-0882
	
	public String getResponse(String from, String message)
	{
		if("bed".equalsIgnoreCase(message))
		{
			return "Bed";
		}
		return "No bed";
	}
}

@@ -16,16 +16,45 @@
 agers;%0A%0A
+import javax.inject.Inject;%0A%0A
 import o
@@ -95,16 +95,72 @@
 onent;%0A%0A
+import svc.data.users.UserDAO;%0Aimport svc.models.User;%0A%0A
 @Compone
@@ -208,16 +208,44 @@
 405-0882
+%0A%0A%09@Inject%0A%09UserDAO userDAO;
 %0A%09%0A%09publ
@@ -304,69 +304,286 @@
 %7B%0A%09%09
-if(%22bed%22.equalsIgnoreCase(message))%0A%09%09%7B%0A%09%09%09return %22Bed
+User user = null;//userDAO.findByPhone(from);%0A%09%09if(%22bed%22.equalsIgnoreCase(message))%0A%09%09%7B%0A%09%09%09if(user == null)%0A%09%09%09%7B%0A%09%09%09%09return %22Limited beds available at St. Patrick's Center.%22;%0A%09%09%09%7D%0A%09%09%09else%0A%09%09%09%7B%0A%09%09%09%09return %22We've reserved you a bed at St. Patrick's Center for tonight.
 %22;%0A
+%09
 %09%09%7D%0A
+%09%09%7D%0A
 %09%09re
@@ -592,14 +592,50 @@
 rn %22
-No bed
+Text BED to reserve a bed.  HELP for help.
 %22;%0A%09

Twilio messages, need UserDAO.findByPhone()