package com.auth.module.security.controller;


import com.auth.common.model.common.result.Result;
import com.auth.model.base.dto.LoginDto;
import com.auth.model.base.vo.LoginVo;
import com.auth.module.security.service.LoginService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "登录接口")
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class LoginController {

    private final LoginService loginService;

    @Operation(summary = "用户登录", description = "用户登录")
    @PostMapping("login")
    public Result<LoginVo> login(@RequestBody LoginDto loginDto) {
        LoginVo vo = loginService.login(loginDto);
        return Result.success(vo);
    }

}
