package gov.samhsa.c2s.c2suiapi.web;

import gov.samhsa.c2s.c2suiapi.infrastructure.dto.UserActivationRequestDto;
import gov.samhsa.c2s.c2suiapi.infrastructure.dto.UserVerificationRequestDto;
import gov.samhsa.c2s.c2suiapi.service.UmsServiceImpl;
import gov.samhsa.c2s.c2suiapi.service.dto.ProfileResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

import java.util.Locale;

import static gov.samhsa.c2s.c2suiapi.infrastructure.UmsClient.*;

@RestController
@RequestMapping("/ums")
public class UmsRestController {

    @Autowired
    private UmsServiceImpl umsService;

    @PostMapping(value = "/users/verification")
    public Object verify(@Valid @RequestBody UserVerificationRequestDto userVerificationRequest) {
        return umsService.verify(userVerificationRequest);
    }

    @GetMapping(value = "/users/activation")
    public Object checkDuplicateUsername(@RequestParam String username) {
        return umsService.checkDuplicateUsername(username);
    }

    @PostMapping(value = "/users/activation")
    public Object activateUser(@Valid @RequestBody UserActivationRequestDto userActivationRequest,
                               @RequestHeader(X_FORWARDED_PROTO) String xForwardedProto,
                               @RequestHeader(X_FORWARDED_HOST) String xForwardedHost,
                               @RequestHeader(X_FORWARDED_PORT) int xForwardedPort) {
        return umsService.activateUser(userActivationRequest, xForwardedProto, xForwardedHost, xForwardedPort);
    }

    @GetMapping("/users/profile")
    public ProfileResponse getProfile() {
        return umsService.getProfile();
    }

    @PutMapping("/users/locale")
    @ResponseStatus(HttpStatus.OK)
    public void setDefaultLocale(@RequestHeader("Accept-Language") Locale locale) {
        umsService.setDefaultLocale(locale);
    }
}

@@ -438,53 +438,466 @@
 ork.
-security.oauth2.provider.OAuth2Authentication
+web.bind.annotation.GetMapping;%0Aimport org.springframework.web.bind.annotation.PostMapping;%0Aimport org.springframework.web.bind.annotation.PutMapping;%0Aimport org.springframework.web.bind.annotation.RequestBody;%0Aimport org.springframework.web.bind.annotation.RequestHeader;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestParam;%0Aimport org.springframework.web.bind.annotation.ResponseStatus
 ;%0Aim
@@ -941,17 +941,30 @@
 otation.
-*
+RestController
 ;%0A%0Aimpor
@@ -989,17 +989,16 @@
 .Valid;%0A
-%0A
 import j
@@ -1082,139 +1082,426 @@
 ent.
-*;%0A%0A@RestController%0A@RequestMapping(%22/ums%22)%0Apublic class UmsRestController %7B%0A%0A    @Autowired%0A    private UmsServiceImpl umsService;
+X_FORWARDED_HOST;%0Aimport static gov.samhsa.c2s.c2suiapi.infrastructure.UmsClient.X_FORWARDED_PORT;%0Aimport static gov.samhsa.c2s.c2suiapi.infrastructure.UmsClient.X_FORWARDED_PROTO;%0A%0A@RestController%0A@RequestMapping(%22/ums%22)%0Apublic class UmsRestController %7B%0A%0A    private final UmsServiceImpl umsService;%0A%0A    @Autowired%0A    public UmsRestController(UmsServiceImpl umsService) %7B%0A        this.umsService = umsService;%0A    %7D
 %0A%0A  

Remove wildcard import