package ru.micord.ervu.account_applications.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ru.micord.ervu.account_applications.service.UserApplicationListService;

/**
 * @author gulnaz
 */
@RestController
@RequestMapping("/user")
public class AdminController {

  private final UserApplicationListService applicationListService;

  public AdminController(UserApplicationListService applicationListService) {
    this.applicationListService = applicationListService;
  }

  //TODO SUPPORT-9109 move to front
  @GetMapping("/exists")
  public ResponseEntity<Boolean> userExists(@RequestParam(name = "login") String login) {
    boolean result = applicationListService.userExists(login);
    return ResponseEntity.ok(result);
  }
}
