package cn.teammodel.controller.admin.controller;

import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.ExamService;
import cn.teammodel.model.dto.admin.art.ArtFindDto;
import cn.teammodel.model.dto.admin.exam.*;
import cn.teammodel.model.vo.admin.ArtElementsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("admin/exam")
@Api(tags = "管理员端-智育分析")
public class ExamController {
    @Resource
    private ExamService examService;
    @PostMapping("getOverView")
    @ApiOperation("获取智育看板详细内容")
    public R<Map<String, Object>> getOverView(@Valid @RequestBody OverViewDto overViewDto, HttpServletRequest request) {
        Map<String, Object> res = examService.getAnalysis(overViewDto,request);
        return R.success(res);
    }
    @PostMapping("getExamList")
    @ApiOperation("获取该学校该学段全年评测数据")
    public R<Map<String, Object>> getExamList(@Valid @RequestBody AnalysisDto analysisDto, HttpServletRequest request) {
        Map<String, Object> res = examService.getExamList(analysisDto,request);
        return R.success(res);
    }
    @PostMapping("getExamRecord")
    @ApiOperation("获取该活动的作答记录")
    public R<Map<String, Object>> getExamRecord(@Valid @RequestBody ExamRecordDto examRecordDto, HttpServletRequest request) {
        Map<String, Object> res = examService.getExamRecord(examRecordDto,request);
        return R.success(res);
    }
    @PostMapping("getExamSummary")
    @ApiOperation("获取该活动详细信息和部分分析结果")
    public R<Map<String, Object>> getExamSummary(@Valid @RequestBody FindExamDto findExamDto, HttpServletRequest request) {
        Map<String, Object> res = examService.getExamSimpleAnalysis(findExamDto,request);
        return R.success(res);
    }

    @PostMapping("getExamByStudent")
    @ApiOperation("获取单个学生的简易分析结果")
    public R<Map<String, Object>> getExamByStudent(@Valid @RequestBody FindByStudentDto findByStudentDto, HttpServletRequest request) {
        Map<String, Object> res = examService.getExamByStudent(findByStudentDto,request);
        return R.success(res);
    }

}
