package cn.com.ty.lift.system.user.controller;


import cn.com.ty.lift.common.constants.ApiConstants;
import cn.com.ty.lift.system.user.dao.entity.model.UserApplyRequest;
import cn.com.ty.lift.system.user.service.IUserApplicationService;
import cn.com.xwy.boot.web.dto.RestResponse;
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;

import javax.annotation.Resource;

/**
 * <p>
 * 用户申请表 前端控制器
 * </p>
 *
 * @author huangyuan
 * @since 2019-12-13
 */
@RestController
@RequestMapping("/userapply")
public class UserApplicationController {

    @Resource
    private IUserApplicationService userApplicationService;

    /**
     * @param
     * @return
     * @description 获取申请列表
     * @date 2019-12-23 14:12
     */
    @RequestMapping("/list")
    public RestResponse list(@RequestBody UserApplyRequest userApplyRequest) {
        return userApplicationService.applyList(userApplyRequest);
    }

    /**
     * @param userApplyRequest
     * @return
     * @description 申请加入团队
     * @date 2019-12-13 16:40
     */
    @PostMapping("/applyTeam")
    public RestResponse applyTeam(@RequestBody UserApplyRequest userApplyRequest) {
        return userApplicationService.apply(userApplyRequest, ApiConstants.ApplicationConstants.APPLY_TYPE_TEAM);
    }

    /**
     * @param
     * @return
     * @description 申请项目
     * @date 2020-01-06 16:26
     */
    @PostMapping("/applyProject")
    public RestResponse applyProject(@RequestBody UserApplyRequest userApplyRequest) {
        return userApplicationService.apply(userApplyRequest, ApiConstants.ApplicationConstants.APPLY_TYPE_PROJECT);
    }

    /**
     * @param
     * @return
     * @description 审核通过
     * @date 2019-12-13 17:20
     */
    @PostMapping("/applyPass")
    public RestResponse applyPass(@RequestBody UserApplyRequest userApplyRequest) {
        return userApplicationService.applyPass(userApplyRequest);
    }

    /**
     * @param
     * @return
     * @description 审核不通过
     * @date 2019-12-13 17:30
     */
    @PostMapping("/applyFail")
    public RestResponse applyFail(@RequestBody UserApplyRequest userApplyRequest) {
        return userApplicationService.applyFail(userApplyRequest);
    }

}
