package com.hdkj.lt.si.controller.auth;

import com.hdkj.lt.core.mvc.BaseController;
import com.hdkj.lt.si.service.auth.IAuthenticationService;
import com.hdkj.hussar.ApiResponse;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotEmpty;

/**
 * @Description:
 * @Author: wenhao
 * @Create: 2024/03/22 11:11
 * @Version: 1.0
 */
@Validated
@RestController
@AllArgsConstructor
@RequestMapping("/auth")
public class AuthenticationController extends BaseController {

    private final IAuthenticationService authenticationService;

    @GetMapping(value = "/token")
    public ApiResponse<String> token(@NotEmpty(message = "登录账号不允许为空") String userAccount,
                                     @NotEmpty(message = "登录密码不允许为空") String password) {
        return data(authenticationService.token(userAccount, password));
    }

}
