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

import mx.gob.slp.baseadminweb.domain.model.AppUser;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
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(@AuthenticationPrincipal AppUser user, Model model) {
        model.addAttribute("user", user);
        return "dashboard";
    }

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