package com.yiboshi.science.rest.v1;


import com.yiboshi.arch.base.ResponseDataModel;
import com.yiboshi.science.entity.ComEvaluationItem;
import com.yiboshi.science.param.dto.ComEvaluationItemDTO;
import com.yiboshi.science.param.query.ComEvaluationItemQueryVO;
import com.yiboshi.science.rest.BaseController;
import com.yiboshi.science.service.ComEvaluationItemService;
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-item")
public class ComEvaluationItemController extends BaseController<ComEvaluationItemService, ComEvaluationItemQueryVO, ComEvaluationItemDTO, ComEvaluationItem> {

    @Autowired
    private ComEvaluationItemService comEvaluationItemService;

    @ApiOperation(value = "获取内容子项列表信息", httpMethod = "GET", notes = "获取内容子项列表信息")
    @GetMapping
    @RequestMapping("/getEvaluationItemByContentId")
    public ResponseDataModel<List<ComEvaluationItemDTO>> getEvaluationItemByContentId(String ContentId) {
        return ResponseDataModel.ok(comEvaluationItemService.getEvaluationItemByContentId(ContentId));
    }

    @ApiOperation(value = "获取内容子项信息", httpMethod = "GET", notes = "获取内容子项信息")
    @GetMapping
    @RequestMapping("/getEvaluationItemById")
    public ResponseDataModel<ComEvaluationItemDTO> getEvaluationItemById(String id) {
        return ResponseDataModel.ok(comEvaluationItemService.getEvaluationItemById(id));
    }

    @ApiOperation(value = "判断是否可以修改打分子项", httpMethod = "GET", notes = "判断是否可以修改打分子项")
    @GetMapping
    @RequestMapping("/CheckItemHasValues")
    public ResponseDataModel<String> CheckItemHasValues(@Validated @RequestBody ComEvaluationItemDTO dto) {
        return ResponseDataModel.ok(comEvaluationItemService.CheckItemHasValues(dto));
    }

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

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

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