package es.uv.saic.web;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import es.uv.saic.dto.RolDTO;
import es.uv.saic.dto.UsuariDTO;
import es.uv.saic.feign.UsuariClient;

@Controller
public class UsuariController {
    @Autowired
    private UsuariClient us;

    @GetMapping("/newUserrole")
	public String newUserRoleForm(Model model, Authentication auth) throws IOException {	
		List<UsuariDTO> users = us.findAllUsers();
		List<RolDTO> roles = us.findAllRols();
		model.addAttribute("users", users);
		model.addAttribute("roles", roles);
		return "components/form_new_manager";
	}
}
