package mx.gob.jumapacelaya.controllers;

import mx.gob.jumapacelaya.models.RedmineUser;
import mx.gob.jumapacelaya.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    private final UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/current-user")
    public RedmineUser getCurrentUser() {
        return userService.getAuthenticatedRedmineUser();
    }
}
