package com.ruoyi.web.work.api;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.work.api.config.BaseController;
import com.ruoyi.web.work.domain.dto.AuthDto;
import com.ruoyi.web.work.domain.dto.ChoiceDto;
import com.ruoyi.web.work.domain.dto.LoginDto;
import com.ruoyi.web.work.domain.dto.UserDto;
import com.ruoyi.web.work.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/user")
public class Api_UserController extends BaseController {

    @Autowired
    IUserService userService;

    @PostMapping("/login")
    public AjaxResult login(@Validated @RequestBody LoginDto dto) {
        return userService.login(dto);
    }

    /**
     * 实名认证
     *
     * @return
     */
    @PostMapping("/auth")
    public AjaxResult auth(@Validated @RequestBody AuthDto dto) {
        return userService.auth(dto);
    }

    @PostMapping("/edit")
    public AjaxResult edit(@Validated @RequestBody UserDto dto) {
        return userService.edit(dto);
    }

    @GetMapping("/info")
    public AjaxResult info() {
        return userService.info();
    }

    @PostMapping("/choice")
    public AjaxResult choice(@Validated @RequestBody ChoiceDto dto) {
        return userService.choice(dto);
    }


    @GetMapping("/exit")
    public AjaxResult exit() {
        return userService.exit();
    }

}

