package com.ruoyi.sim.controller;

import cn.ele6.catalyzer.ruoyi.enhance.TableDataInfo;
import com.ruoyi.sim.domain.vo.RealExamCollectionVo;
import com.ruoyi.sim.service.impl.RealExamCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.sim.domain.RealExamCollection;

/**
 * 考试集合Controller
 *
 * @author tom
 * @date 2024-12-17
 */
@RestController
@RequestMapping("/sim/real-exam-collection")
@Api("考试集合Controller")
public class RealExamCollectionController extends BaseController {

    @Autowired
    private RealExamCollectionService service;

    @GetMapping("/teacher/exam/list")
    @ApiOperation("[教师][分页]查询考试集合列表")
    public TableDataInfo listExamByTeacher(RealExamCollection p) {
        return service.listExamByTeacher(p);
    }

    @GetMapping("/teacher/exercise/list")
    @ApiOperation("[教师][分页]查询练习集合列表")
    public TableDataInfo listExerciseByTeacher(RealExamCollection p) {
        return service.listExerciseByTeacher(p);
    }

    @GetMapping(value = "/teacher/exam/{id}")
    @ApiOperation("[教师]获取考试集合详细信息")
    public AjaxResult getExamInfoByTeacher(@PathVariable("id") Long id) {
        return service.getExamInfoByTeacher(id);
    }

    @GetMapping(value = "/teacher/exercise/{id}")
    @ApiOperation("[教师]获取练习集合详细信息")
    public AjaxResult getExerciseInfoByTeacher(@PathVariable("id") Long id) {
        return service.getExerciseInfoByTeacher(id);
    }

    @PostMapping(value = "/teacher/exam/")
    @ApiOperation("[教师]新增考试集合")
    public AjaxResult addExam(@RequestBody RealExamCollectionVo vo) {
        return service.addExam(vo);
    }

    @PostMapping(value = "/teacher/exercise/")
    @ApiOperation("[教师]新增练习集合")
    public AjaxResult addExercise(@RequestBody RealExamCollectionVo vo) {
        return service.addExercise(vo);
    }

    @PutMapping(value = "/teacher/exam/")
    @ApiOperation("[教师]修改考试集合")
    public AjaxResult editExam(@RequestBody RealExamCollectionVo vo) {
        return service.editExam(vo);
    }

    @PutMapping(value = "/teacher/exercise/")
    @ApiOperation("[教师]修改练习集合")
    public AjaxResult edit(@RequestBody RealExamCollectionVo vo) {
        return service.editExercise(vo);
    }

    @DeleteMapping("/teacher/exam/{ids}")
    @ApiOperation("[教师]删除多个考试集合")
    public AjaxResult deleteExams(@PathVariable Long[] ids) {
        return service.deleteExams(ids);
    }

    @DeleteMapping("/teacher/exercise/{ids}")
    @ApiOperation("[教师]删除多个练习集合")
    public AjaxResult deleteExercises(@PathVariable Long[] ids) {
        return service.deleteExercises(ids);
    }

    @PutMapping(value = "/teacher/exam/open/{id}")
    @ApiOperation("[教师]打开考试集合")
    public AjaxResult openExam(@PathVariable("id") Long id) {
        return service.openExam(id);
    }

    @PutMapping(value = "/teacher/exam/close/{id}")
    @ApiOperation("[教师]关闭考试集合")
    public AjaxResult closeExam(@PathVariable("id") Long id) {
        return service.closeExam(id);
    }
}
