package com.example.demo.controller.api;

import com.example.demo.dto.request.exam.AddExamRequest;
import com.example.demo.dto.request.exam.BasePageRequest;
import com.example.demo.dto.request.exam.StemAndExamRequest;
import com.example.demo.dto.response.BaseResponse;
import com.example.demo.dto.response.ExamDto;
import com.example.demo.dto.response.admin.BaseAdminResponse;
import com.example.demo.service.ExamService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author hxh
 * @Date 2020-09-19 14:39
 * @Descrption TODO
 */
@Api(tags = "考试管理")
@RequestMapping("/api/exam")
@RestController
public class ExamApiController {
    @Autowired
    ExamService examService;

    @PostMapping("/list")
    public BaseAdminResponse list(@RequestBody BasePageRequest<StemAndExamRequest> request){
        return examService.list(request);
    }

    @PostMapping("/add")
    public BaseResponse addExam(@RequestBody AddExamRequest request){
        return examService.addExam(request);
    }

    @GetMapping("/{id}")
    public ExamDto getExam(@PathVariable("id") int id){
        return examService.getExamById(id);
    }

//    @DeleteMapping("/{id}/delete")
//    public BaseResponse deleteExam(){
//
//    }
}
