package com.yiboshi.science.rest.v1;


import com.yiboshi.arch.base.ResponseDataModel;
import com.yiboshi.science.entity.ComEvaluationContent;
import com.yiboshi.science.param.dto.ComEvaluationContentDTO;
import com.yiboshi.science.param.query.ComEvaluationContentQueryVO;
import com.yiboshi.science.rest.BaseController;
import com.yiboshi.science.service.ComEvaluationContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "com-expert-spec", description = "评审内容表")
@RestController
@RequestMapping("/v1/science-admin/com-evaluation-content")
public class ComEvaluationContentController extends BaseController<ComEvaluationContentService, ComEvaluationContentQueryVO, ComEvaluationContentDTO, ComEvaluationContent> {

    @Autowired
    private ComEvaluationContentService comEvaluationContentService;

    @ApiOperation(value = "获取评审内容列表信息", httpMethod = "GET", notes = "获取评审内容列表信息")
    @GetMapping
    @RequestMapping("/getEvaluationContentByEvalId")
    public ResponseDataModel<List<ComEvaluationContentDTO>> getEvaluationContentByEvalId(String id) {
        return ResponseDataModel.ok(comEvaluationContentService.getEvaluationContentByEvalId(id));
    }

    @ApiOperation(value = "获取评审内容信息", httpMethod = "GET", notes = "获取评审内容信息")
    @GetMapping
    @RequestMapping("/getEvaluationContentById")
    public ResponseDataModel<ComEvaluationContentDTO> getEvaluationContentById(String id) {
        return ResponseDataModel.ok(comEvaluationContentService.getEvaluationContentById(id));
    }

    @ApiOperation(value = "判断是否可以添加子项或添加值", httpMethod = "POST", notes = "判断是否可以添加子项或添加值")
    @RequestMapping("/CheckContentHasItemsOrValues")
    @PostMapping
    public ResponseDataModel<String> CheckContentHasItemsOrValues(@Validated @RequestBody ComEvaluationContentDTO dto) {
        return ResponseDataModel.ok(comEvaluationContentService.CheckContentHasItemsOrValues(dto));
    }

    @ApiOperation(value = "判断是否可以修改打分子项", httpMethod = "POST", notes = "判断是否可以修改打分子项")
    @RequestMapping("/CheckContentHasValues")
    @PostMapping
    public ResponseDataModel<String> CheckContentHasValues(@Validated @RequestBody ComEvaluationContentDTO dto) {
        return ResponseDataModel.ok(comEvaluationContentService.CheckContentHasValues(dto));
    }

    @ApiOperation(value = "评审内容添加", httpMethod = "POST", notes = "评审内容添加")
    @RequestMapping("/insertEvaluationContent")
    @PostMapping
    public ResponseDataModel<String> insertEvaluationContent(@Validated @RequestBody ComEvaluationContentDTO dto) {
        return ResponseDataModel.ok(comEvaluationContentService.insertEvaluationContent(dto));
    }

    @ApiOperation(value = "评审内容修改", httpMethod = "POST", notes = "评审内容修改")
    @RequestMapping("/updateEvaluationContent")
    @PostMapping
    public ResponseDataModel<String> updateEvaluationContent(@Validated @RequestBody ComEvaluationContentDTO dto) {
        return ResponseDataModel.ok(comEvaluationContentService.updateEvaluationContent(dto));
    }

    @ApiOperation(value = "评审内容删除", httpMethod = "DELETE", notes = "评审内容删除")
    @DeleteMapping(value = "deleteEvaluationContent/{id}")
    public ResponseDataModel<String> deleteEvaluationContent(@PathVariable String id) {
        return ResponseDataModel.ok(comEvaluationContentService.deleteEvaluationContent(id));
    }
}
