package com.ytpm.question.controller;

import com.ytpm.app.param.AnswerRecordParam;
import com.ytpm.app.view.QuestionListView;
import com.ytpm.general.Result;
import com.ytpm.general.ResultTable;
import com.ytpm.question.service.QuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
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;


@Api(tags = "题目管理模块")
@RestController
@RequestMapping("/question")
public class QuestionController {

    @Resource
    private QuestionService questionService;

    /**
     * 获取题库
     */
    @ApiOperation("获取题库")
    @GetMapping("/list")
    public ResultTable<QuestionListView> questionList() {
        return questionService.questionList();
    }

    /**
     * 回答问题
     */
    @ApiOperation("回答问题")
    @PostMapping("/answerQuestion")
    public Result<String> answerQuestion(@RequestBody AnswerRecordParam param) {
        return questionService.answerQuestion(param);
    }
}
