/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package plate.wellmann.shop.controller;

import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.log4j.Logger;
import plate.wellmann.shop.business.CustomerManager;
import plate.wellmann.shop.business.PasswordManager;

/**
 *
 * @author Patrick
 */
@Named
@SessionScoped
public class CustomerController implements Serializable {
    @Inject
    private CustomerManager costumerManager;
    
    @Inject
    private PasswordManager passwordManager;
    
    private String username;
    private String password;
    
    final static Logger logger = Logger.getLogger(CustomerController.class);
    
    public CustomerController(){
        
    }
    
    public String login(){
        logger.info("User trying to log in: " + username);
        costumerManager.init();
        /*if(costumerManager.login(username, password)){
            logger.info("Login succesfull " + username);
            return "ressources/users/welcome.xhtml";
        }*/
        return "";
    }
    
    public String logout(){
        logger.info("User trying to logged out: " + username);
        costumerManager.logout();
        return "index.xhmtl";
    }
    
    public String demo(){
        return costumerManager.demo();
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    
    
    
}
