package com.ym.mec.web.controller.education;

import com.ym.mec.biz.dal.dto.InspectionItemPlanConclusionDto;
import com.ym.mec.biz.dal.entity.CourseSchedule;
import com.ym.mec.biz.dal.entity.InspectionItemPlanConclusion;
import com.ym.mec.biz.service.InspectionItemPlanConclusionService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = "教务巡查结果")
@RequestMapping("eduInspectionItemPlanConclusion")
@RestController
public class EduInspectionItemPlanConclusionController extends BaseController {
    @Autowired
    private InspectionItemPlanConclusionService InspectionItemPlanConclusionService;

    @ApiOperation(value = "巡查结果提交")
    @PostMapping("/add")
    public HttpResponseResult<InspectionItemPlanConclusionDto> add(@RequestBody InspectionItemPlanConclusionDto inspectionItemPlanConclusionDto) {
        return succeed(InspectionItemPlanConclusionService.add(inspectionItemPlanConclusionDto));
    }

    @ApiOperation(value = "获取日程的巡查结果")
    @GetMapping("/getInfo")
    @ApiImplicitParams({@ApiImplicitParam(name = "planId", value = "日程id", required = true, dataType = "int"),
            @ApiImplicitParam(name = "checkItem", value = "巡查结果项", required = false, dataType = "int")})
    public HttpResponseResult<Map<Integer, List<InspectionItemPlanConclusion>>> getInfo(Long planId, Integer checkItem) {
        return succeed(InspectionItemPlanConclusionService.getInfo(planId, checkItem));
    }

    @ApiOperation(value = "获取日程时间段内的课程信息")
    @GetMapping("/getPlanCourses")
    @ApiImplicitParams({@ApiImplicitParam(name = "planId", value = "日程id", required = true, dataType = "int")})
    public HttpResponseResult<List<CourseSchedule>> getPlanCourses(Long planId) {
        return succeed(InspectionItemPlanConclusionService.getPlanCourses(planId));
    }
}
