package com.headkeeper.controller;

import com.headkeeper.bean.view.CompanyInfoView;
import com.headkeeper.bean.view.TokenView;
import com.headkeeper.bean.view.UserLoginView;
import com.headkeeper.bean.view.UserView;
import com.headkeeper.security.service.exception.AuthenticationException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

public interface UserController {
    @RequestMapping(value = "/registration", method = RequestMethod.GET)
    String getUserPage();

    @RequestMapping(value = "/registration/company", method = RequestMethod.POST)
    @ResponseBody
    TokenView addNewCompany(@Validated @RequestBody CompanyInfoView companyInfo) throws AuthenticationException;

    @RequestMapping(value = "/registration/user", method = RequestMethod.POST)
    @ResponseBody
    TokenView addNewUser(@RequestBody UserView user) throws AuthenticationException;

    @RequestMapping(value = "/profile/{id}", method = RequestMethod.GET)
    String getProfile();

    @RequestMapping(value = "/profile/{id}", method = RequestMethod.POST)
    void changeProfile(@PathVariable int id,@RequestBody UserView user);

    @RequestMapping(value = "/profile/{id}/delete")
    void deleteUser(@PathVariable int id);

    @PreAuthorize("hasAnyAuthority('user', 'admin')")
    @RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
    @ResponseBody
    UserView getUserById(@PathVariable int id);

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    @ResponseBody
    TokenView login(@RequestBody UserLoginView userLogin) throws AuthenticationException;
}

@@ -591,16 +591,43 @@
 erPage()
+ throws ControllerException
 ;%0A%0A    @
@@ -824,32 +824,53 @@
 icationException
+, ControllerException
 ;%0A%0A    @RequestM
@@ -1028,32 +1028,53 @@
 icationException
+, ControllerException
 ;%0A%0A    @RequestM
@@ -1156,16 +1156,43 @@
 rofile()
+ throws ControllerException
 ;%0A%0A    @
@@ -1331,16 +1331,43 @@
 ew user)
+ throws ControllerException
 ;%0A%0A    @
@@ -1387,31 +1387,28 @@
 g(value = %22/
-profile
+user
 /%7Bid%7D/delete
@@ -1443,32 +1443,59 @@
 Variable int id)
+ throws ControllerException
 ;%0A%0A    @PreAutho
@@ -1508,11 +1508,8 @@
 hasA
-nyA
 utho
@@ -1523,17 +1523,8 @@
 ser'
-, 'admin'
 )%22)%0A
@@ -1657,16 +1657,43 @@
  int id)
+ throws ControllerException
 ;%0A%0A    @
@@ -1864,8 +1864,30 @@
 tion
+, ControllerException
 ;%0A%7D%0A
+%0A

resolve conflict in UserController