/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/java/edu/slcc/asdv/pojo/Navigator.java
package edu.slcc.asdv.pojo;

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
 */

import jakarta.inject.Named;
import jakarta.enterprise.context.RequestScoped;

/**
 *
 * @author caleb
 */
@Named(value = "Navigator")
@RequestScoped
public class Navigator {

    /**
     * Creates a new instance of Navigator
     */
    public Navigator() {
    }

    public String determine(String origin) {
        int rand = (int) (Math.random() * 2);
        System.out.println(rand);
        String returnValue = "";
        switch (origin) {
            case "a":
                if (rand == 0) {
                    returnValue = "b.xhtml";
                } else {
                    returnValue = "defeat.xhtml";
                }
                break;
            case "b":
                if (rand == 0) {
                    returnValue = "c.xhtml";
                } else {
                    returnValue = "defeat.xhtml";
                }
                break;
            case "c":
                if (rand == 0) {
                    returnValue = "victory.xhtml";
                } else {
                    returnValue = "defeat.xhtml";
                }
                break;
        }
        System.out.println("Return value: " + returnValue);
        return returnValue;
    }
}