package mx.gob.slp.baseadminweb.web.controller;

import mx.gob.slp.baseadminweb.web.support.WebUserView;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class DashboardController {

    @GetMapping("/")
    public String home() {
        return "redirect:/dashboard";
    }

    @GetMapping("/dashboard")
    public String dashboard(Authentication authentication, Model model) {
        model.addAttribute("user", WebUserView.from(authentication));
        return "dashboard";
    }

    @GetMapping("/admin")
    public String adminHome() {
        return "redirect:/dashboard";
    }
}