package com.template.api;

import com.template.model.request.changePasswordRequest;
import com.template.model.request.loginRequest;
import com.template.model.result.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@RequestMapping("/api/login")
@Api(tags = {"LoginController"}, value = "登录")
public interface LoginControllerAPI {

    @GetMapping(value = "/Openid")
    @ApiOperation(value = "微校授权", notes = "微校授权", httpMethod = "POST")
    CommonResult Openid(@RequestParam String wxcode,@RequestParam String state,HttpServletResponse response) throws Exception;

    @GetMapping(value = "/captcha.jpg")
    void captcha(HttpServletResponse response, String uuid) throws IOException;

    @GetMapping(value = "/queryReduce")
    @ApiOperation(value = "查看系统版本", notes = "查看系统版本", httpMethod = "GET")
    CommonResult queryReduce();

    @PostMapping(value = "/Login")
    @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST")
    CommonResult Login(@Validated @RequestBody loginRequest lr, BindingResult bindingResult);

    @PostMapping(value = "/ChangePassword")
    @ApiOperation(value = "修改密码", notes = "修改密码", httpMethod = "POST")
    CommonResult ChangePassword(@RequestAttribute Integer userId,@Validated @RequestBody changePasswordRequest cpr, BindingResult bindingResult);

    //region 审批管理
    //获取审批列表集合
    @GetMapping("/queryApplyTypes")
    @ApiOperation(value = "获取审批列表集合", httpMethod = "GET")
    CommonResult queryTypes();

    //我发起的
    @GetMapping("/queryIinitiatedApply")
    @ApiOperation(value = "获取我发起的审批列表集合", httpMethod = "GET")
    CommonResult queryIinitiatedApply(@RequestParam int currentPage, @RequestParam int pageCount,@RequestAttribute Integer userId, @RequestParam int typeId, String keyword);

    //我审批的
    @GetMapping("/queryIapproveApply")
    @ApiOperation(value = "获取我审核的审批列表集合", httpMethod = "GET")
    CommonResult queryIapproveApply(@RequestParam int currentPage, @RequestParam int pageCount,@RequestAttribute Integer userId, @RequestParam int typeId, String keyword);

    //endregion
}
