

package AOMCase;

import com.metamaxim.modelscope.callbacks.*;

public class EmployeeLogIn extends Behaviour {


	public String getState() {
		if (this.getString("Security Password").equals(""))
			return "uninitialized";
		if (this.getInteger("Tries") == 0)
			return "logged out";
		if (this.getInteger("Tries") <= 3
			&& this.getString("Entered Password").equals(this.getString("Security Password")))
			return "logged in";
		if (this.getInteger("Tries") >= 3)
			return "violation";
		return "trying";
	}

    public String getLogInStatus() {
		return this.getState("Employee Log In");
		}

	public void processSetLogin (Event event, String subscript) {
		this.setString("Security Password", event.getString("Password"));
	}

	public void processLogIn (Event event, String subscript) {
		this.setString("Entered Password", event.getString("Password"));
		this.setInteger("Tries", this.getInteger("Tries") + 1);
	}

	public void processLogOut (Event event, String subscript) {
		this.setInteger("Tries",0);
		this.setString("Entered Password","");
	}

	public void processReset (Event event, String subscript) {
		this.setInteger("Tries",0);
		this.setString("Entered Password","");
	}

}



