package com.qmth.exam.reserve.controller.student;

import com.qmth.boot.api.annotation.Aac;
import com.qmth.boot.api.constant.ApiConstant;
import com.qmth.exam.reserve.bean.examsite.ExamSiteInfo;
import com.qmth.exam.reserve.controller.BaseController;
import com.qmth.exam.reserve.service.ExamSiteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "【考生端】考点相关接口")
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/student/exam/site")
@Aac(strict = false, auth = true)
public class ExamSiteController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(ExamSiteController.class);

    @Autowired
    private ExamSiteService examSiteService;

    @ApiOperation(value = "获取“数据分类”关联的考点列表")
    @PostMapping(value = "/list")
    public List<ExamSiteInfo> list(@ApiParam("数据分类ID") @RequestParam(required = false) Long categoryId) {
        if (categoryId == null) {
            categoryId = curLoginStudent().getCategoryId();
        }

        return examSiteService.getExamSiteListForStudent(categoryId);
    }

}
