package com.platform2easy.genesis.web.controller;

import com.platform2easy.genesis.domain.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("user")
@AllArgsConstructor
public class UserController {

    private final UserService userService;

    @GetMapping("listar")
    public String listar(Model model) {
        model.addAttribute("titulo", "Usuários");
        model.addAttribute("users", userService.listAll());
        return "users/list";
    }
}
