package jnpf.cultivate.v2.controller.web.exam;

import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.model.cultivate.v2.exam.req.V2QueryExamRecordReq;
import jnpf.model.cultivate.v2.exam.req.V2ReadOverExamReq;
import jnpf.model.cultivate.v2.exam.req.V2RestartExamReq;
import jnpf.model.cultivate.v2.exam.vo.V2ExamUserVo;
import jnpf.model.cultivate.v2.exam.vo.V2UserExamDetailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * web用户考试管理模块
 *
 * @author shangyi
 */
@RestController
@Slf4j
@RequestMapping("/v2/web/user-exam")
public class V2CultivateExamUserController {

    /**
     * 批阅考试-用户考试列表
     *
     * @param req
     * @return
     */
    @GetMapping("/record")
    public ActionResult<PageListVO<V2ExamUserVo>> record(V2QueryExamRecordReq req) {
        return ActionResult.success(new PageListVO<>());
    }

    /**
     * 批阅-详情
     *
     * @param userExamId 考试用户ID
     * @return
     */
    @GetMapping("/get/{userExamId}")
    public ActionResult<V2UserExamDetailVo> get(@PathVariable("userExamId") String userExamId) {
        return ActionResult.success(new V2UserExamDetailVo());
    }

    /**
     * 批阅考试
     *
     * @param req
     * @return
     */
    @PostMapping("/readOver")
    public ActionResult<Boolean> readOver(@RequestBody V2ReadOverExamReq req) {
        return ActionResult.success(true);
    }


    /**
     * 发起重新考试
     *
     * @param req 考试用户ID
     * @return
     */
    @PostMapping("/restartExam")
    public ActionResult<Boolean> restartExam(@Valid @RequestBody V2RestartExamReq req) {
        return ActionResult.success("操作成功", true);
    }


    /**
     * 删除用户考试
     * @param id       用户考试ID
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ActionResult<Boolean> del(@PathVariable("id") String id) {
        return ActionResult.success(true);
    }

}
