/home/caleb/ASDV-WebDev/Semester 2/Assignments/lab1-CalebFontenot/src/main/java/edu/slcc/asdv/LanguageBean.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package edu.slcc.asdv;

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

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

    private String language;

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language.trim();
    }

    public String showChoice() {
        if (language.equalsIgnoreCase("Java") || language.equalsIgnoreCase("Groovy")) {
            return ("goodLanguage");
        } else if (isMissing(language)) {
            return ("MissingLanguage");
        } else {
            return ("badLanguage");
        }
    }
    private boolean isMissing(String value) {
        return ((value == null) || (value.trim().isEmpty()));
    }
}