package com.template.api;

import com.template.model.request.deleteSmartScoreRequest;
import com.template.model.request.insertScoreRequest;
import com.template.model.request.updateScoreRequest;
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 org.springframework.web.multipart.MultipartFile;

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


@RequestMapping("/api/smartScore")
@Api(tags = {"SmartScoreController"}, value = "成绩")
public interface SmartScoreControllerAPI {

    @GetMapping(value = "/querySmartSemesters")
    @ApiOperation(value = "获取学期列表数据", notes = "获取学期列表数据", httpMethod = "GET")
    CommonResult querySmartSemesters();

    @GetMapping(value = "/queryUserGrade")
    @ApiOperation(value = "根据学生ID获取年级和班级数据", notes = "根据学生ID获取年级和班级数据", httpMethod = "GET")
    CommonResult queryUserGrade(@RequestParam int userId);

    @GetMapping(value = "/querySubjects")
    @ApiOperation(value = "获取科目集合数据", notes = "获取科目集合数据", httpMethod = "GET")
    CommonResult querySubjects();

    @GetMapping(value = "/queryExamTypes")
    @ApiOperation(value = "获取考试类型集合数据", notes = "获取考试类型集合数据", httpMethod = "GET")
    CommonResult queryExamTypes();

    @GetMapping(value = "/querySmartSecordPage")
    @ApiOperation(value = "获取学生分页数据", notes = "获取学生分页数据", httpMethod = "GET")
    CommonResult querySmartSecordPage(@RequestParam int currentPage, @RequestParam int pageCount, String name);

    @GetMapping(value = "/querySmartScorePage")
    @ApiOperation(value = "获取成绩分页数据", notes = "获取成绩分页数据", httpMethod = "GET")
    CommonResult querySmartScorePage(@RequestParam int currentPage, @RequestParam int pageCount, String name, String semester, String grade, String schoolClass, String subject, String examType, Double MinScore, Double MaxScore);

    @PostMapping(value = "/insertSmartScore")
    @ApiOperation(value = "添加成绩基本信息", notes = "添加成绩基本信息数据", httpMethod = "POST")
    CommonResult insertSmartScore(@Validated @RequestBody insertScoreRequest isr, BindingResult bindingResult);

    @PostMapping(value = "/updateSmartScoreById")
    @ApiOperation(value = "编辑成绩基本信息数据", notes = "编辑成绩基本信息数据", httpMethod = "POST")
    CommonResult updateSmartScoreById(@Validated @RequestBody updateScoreRequest usr, BindingResult bindingResult);

    @GetMapping(value = "/querySmartScore")
    @ApiOperation(value = "获取成绩基本信息数据", notes = "获取成绩基本信息数据", httpMethod = "GET")
    CommonResult querySmartScore();

    @GetMapping(value = "/queryPageSmartScore")
    @ApiOperation(value = "成绩基本信息分页数据", notes = "成绩基本信息分页数据", httpMethod = "GET")
    CommonResult queryPageSmartScores(@RequestParam int currentPage, @RequestParam int pageCount, String name);

    @GetMapping(value = "/deleteSmartScoreById")
    @ApiOperation(value = "根据ID删除指定成绩基本信息", notes = "根据ID删除指定成绩基本信息", httpMethod = "GET")
    CommonResult deleteSmartScoreById(@RequestParam int id);

    @PostMapping(value = "/deleteSmartScoreByIds")
    @ApiOperation(value = "根据ID删除对应成绩基本信息", notes = "根据ID集合删除对应成绩基本信息", httpMethod = "POST")
    CommonResult deleteSmartScoresByIds(@Validated @RequestBody deleteSmartScoreRequest dssr, BindingResult bindingResult);

    /**
     * 导出成绩数据
     */
    @GetMapping(value = "smartUserExport")
    @ApiOperation(value = "导出成绩数据", notes = "导出成绩数据", httpMethod = "GET")
    void smartUserExport(HttpServletResponse response, String name, String semester, String grade, String schoolClass, String subject, String examType, Double MinScore, Double MaxScore);

    /**
     * 导入成绩
     * 导入的时候如果存在重复的数据就提示
     */
    @PostMapping(value = "/importSmartScoreExcel")
    @ApiOperation(value = "导入成绩数据", notes = "导入成绩数据", httpMethod = "POST")
    CommonResult importSmartScoreExcel(@RequestParam("file") MultipartFile file) throws IOException;

    /**
     * 导出成绩模板
     * @return
     */
    @GetMapping(value = "/downloadScoreExcel")
    @ApiOperation(value = "导出成绩Excel模板", notes = "导出成绩Excel模板", httpMethod = "GET")
    CommonResult downloadScoreExcel();
}
